Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.5 kB
9
Indexable
Never
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;
    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);
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == 2)
        {
            pieceRotate = false;
            pieceFall = false;
            this.gameObject.tag = "Other Falling";
        }

        if (other.gameObject.layer == 3)
        {
            pieceRotate = false;
            pieceFall = false;
            this.gameObject.tag = "Other Falling";
        }

        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;
            this.gameObject.tag = "Not Falling";
        }

        if (other.gameObject.layer != 2)
        {
            pieceRotate = true;
            pieceFall = true;
            puyoScript.Fall = false;
            this.gameObject.tag = "Not Falling";
        }

        if (other.gameObject.layer != 3)
        {
            pieceRotate = true;
            pieceFall = true;
            puyoScript.Fall = false;
            this.gameObject.tag = "Not Falling";
        }

        if (other.gameObject.layer != 7)
        {
            pieceRotate = true;
            pieceFall = true;
            puyoScript.Fall = false;
            this.gameObject.tag = "Not Falling";
        }

        if (other.gameObject.tag == "Not Falling")
        {
            pieceFall = true;
        }

        if (this.gameObject.tag == "Falling")
        {
            pieceFall = true;
        }

        if (this.gameObject.tag == "Not Falling")
        {
            pieceFall = false;
        }

        if (this.gameObject.tag == "Other Falling")
        {
            other.gameObject.tag = "Falling";
        }
    }
}
Leave a Comment