Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
4.6 kB
34
Indexable
Never
public class PuyoScript : MonoBehaviour
{
    public bool Spawn = true;
    public bool Fall = true;
    public bool Rotate = true;
    public bool Left = true;
    public bool Right = true;
    public int dropSet = -1;
    public bool next1 = true;
    public bool next2 = true;
    public GameObject puyo;
    public GameObject puyoSpawn;
    public float gameStart = 0;
    public float transition = 0;
    public SpawnPuyoScript spawnPuyoScript;
    public ColorScript colorScript;
    public Customization customization;
    void Start()
    {

    }

    void Update()
    {
        gameStart = Time.time;
        transition = Time.time;

        if (Fall == true)
        {
            transform.position -= new UnityEngine.Vector3(0, 0.001f, 0);
        }

        if (Fall == false)
        {
            transform.position -= new UnityEngine.Vector3(0, 0, 0);
        }

        if (Rotate == true)
            if (Input.GetKeyDown(KeyCode.X))
            {
                transform.eulerAngles += new UnityEngine.Vector3(0, 0, 90);
                if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 90)))
                    transform.position -= new UnityEngine.Vector3(0.5f, 0, 0);
                else if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 180)))
                    transform.position += new UnityEngine.Vector3(0.5f, 0, 0);
                else if (transform.eulerAngles == (new UnityEngine.Vector3(0, 0, 270)))
                    transform.position += new UnityEngine.Vector3(0.5f, 0, 0);
                else
                    transform.position -= new UnityEngine.Vector3(0.5f, 0, 0);
            }

        if (Left == true)
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                transform.position -= new UnityEngine.Vector3(1, 0, 0);
            }

        if (Right == true)
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                transform.position += new UnityEngine.Vector3(1, 0, 0);
            }
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == 2)
        {
            spawnPuyoScript.Spawn = true;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            this.gameObject.tag = "Finish";
        }

        if (other.gameObject.layer == 3)
        {
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
        }

        if (other.gameObject.layer == 4)
        {
            Fall = true;
            Rotate = true;
            Left = true;
            Right = true;
            spawnPuyoScript.Spawn = false;
            this.gameObject.tag = "Respawn";
        }

        if (other.gameObject.layer == 5)
        {
            Fall = false;
            Rotate = false;
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -1;
        }

        if (other.gameObject.layer == 6)
        {
            Fall = false;
            Rotate = false;
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -1;
        }

        if (other.gameObject.layer == 7)
        {
            spawnPuyoScript.Spawn = true;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = 1;
            this.gameObject.tag = "Finish";
        }

        if (other.gameObject.layer == 8)
        {
            spawnPuyoScript.Spawn = false;
            Fall = true;
            Rotate = true;
            Left = true;
            Right = false;
        }

        if (other.gameObject.layer == 9)
        {
            spawnPuyoScript.Spawn = false;
            Fall = true;
            Rotate = true;
            Left = false;
            Right = true;
        }

        if (other.gameObject.layer == 10)
        {
            spawnPuyoScript.Spawn = false;
            Fall = false;
            Rotate = false;
            Left = false;
            Right = false;
            dropSet = -3;
        }

        if (other.gameObject.tag == "Not Falling")
        {
            Debug.Log("Caramel");
        }
    }
}
Leave a Comment