Untitled
unknown
plain_text
2 years ago
2.5 kB
29
Indexable
public bool Spawn = true;
public bool Fall = true;
public bool Rotate = true;
public bool Left = true;
public bool Right = true;
public int dropSet = 0;
public GameObject puyo;
public GameObject puyoSpawn;
void Start()
{
}
void Update()
{
if (Fall == true)
{
transform.position -= new UnityEngine.Vector3(0, 0.01f, 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);
}
else if (Input.GetKeyDown(KeyCode.Z))
{
transform.eulerAngles -= new UnityEngine.Vector3(0, 0, 90);
}
if (Left == true)
if (Input.GetKey(KeyCode.LeftArrow))
{
transform.position -= new UnityEngine.Vector3(1, 0, 0);
}
if (Right == true)
if (Input.GetKey(KeyCode.RightArrow))
{
transform.position += new UnityEngine.Vector3(1, 0, 0);
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.layer == 2)
{
Spawn = true;
Fall = false;
Rotate = false;
Left = false;
Right = false;
}
if (other.gameObject.layer == 3)
{
Spawn = false;
Fall = false;
Rotate = true;
Left = false;
Right = false;
}
if (other.gameObject.layer == 5)
{
Spawn = false;
Fall = false;
Rotate = false;
Left = false;
Right = false;
}
if (Spawn == true)
{
transform.position += new UnityEngine.Vector3(0, 0, 0);
Spawn = false;
}
if (other.gameObject.layer == 6)
{
Spawn = false;
Fall = false;
Rotate = false;
Left = false;
Right = false;
if (Spawn == true)
{
transform.position += new UnityEngine.Vector3(0, 3, 0);
Spawn = false;
}
}
}Editor is loading...
Leave a Comment