Untitled
unknown
plain_text
5 months ago
4.2 kB
16
Indexable
using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; using JetBrains.Annotations; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; public class ColorScript : MonoBehaviour { public Color[] color = new Color[5]; public int puyoColor = 4; public bool pieceRotate = true; public bool pieceFall = false; public PuyoScript puyoScript; public GameObject puyoSpawn; public SpawnPuyoScript spawnPuyoScript; public Customization customization; int colorCount = 1; List<int> colors = new List<int>(); public GameObject puyo1; public int randomColor; public bool randomize; public bool tagChange; void Start() { if (puyoColor == 3) this.gameObject.GetComponent<SpriteRenderer>().color = color[Random.Range(0, 3)]; if (puyoColor == 4) this.gameObject.GetComponent<SpriteRenderer>().color = color[Random.Range(0, 4)]; if (puyoColor == 5) this.gameObject.GetComponent<SpriteRenderer>().color = color[Random.Range(0, 5)]; randomColor = Random.Range(1, 6); } void Update() { if (pieceRotate == true) if (Input.GetKeyDown(KeyCode.X)) { transform.eulerAngles += new UnityEngine.Vector3(0, 0, 90); } if (pieceFall == true) { transform.position -= new UnityEngine.Vector3(0, 0.001f, 0); } if (pieceFall == false) { transform.position -= new UnityEngine.Vector3(0, 0, 0); } if (tagChange == true) { pieceRotate = false; } } void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == 2) { pieceRotate = true; pieceFall = false; } if (other.gameObject.layer == 3) { pieceRotate = true; pieceFall = false; } if (other.gameObject.layer == 4) { pieceRotate = false; pieceFall = false; } if (other.gameObject.layer == 5) { pieceRotate = false; pieceFall = false; } if (other.gameObject.layer == 6) { pieceRotate = false; pieceFall = false; } if (other.gameObject.layer == 7) { pieceRotate = false; pieceFall = false; tagChange = true; this.gameObject.tag = "Other Falling 2"; } if (other.gameObject.layer != 7) { pieceRotate = true; pieceFall = false; } if (other.gameObject.tag == "Falling") { this.gameObject.tag = "Not Falling"; pieceFall = true; } if (other.gameObject.tag == "Not Falling") { this.gameObject.tag = "Not Falling"; pieceFall = false; } if (other.gameObject.tag == "Other Falling") { this.gameObject.tag = "Falling"; pieceFall = false; } if (other.gameObject.tag == "Other Falling 2") if (this.gameObject.tag == "Not Falling") { tagChange = true; this.gameObject.tag = "Other Falling"; pieceRotate = false; } if (this.gameObject.tag == "Other Falling") { pieceRotate = false; } if (this.gameObject.tag == "Not Falling") { pieceFall = false; } if (this.gameObject.tag == "Other Falling 2") { other.gameObject.tag = "Other Falling"; Debug.Log("Pain"); } } void OnTriggerStay2D (Collider2D other) { if (this.gameObject.tag == "Not Falling") { other.gameObject.tag = "Other Falling"; Debug.Log("Pain"); } } }
Editor is loading...
Leave a Comment