Untitled
unknown
plain_text
2 years ago
1.6 kB
15
Indexable
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using UnityEngine;
using UnityEngine.UIElements;
using Vector3 = System.Numerics.Vector3;
public class PuyoScript : MonoBehaviour
{
private int dropSet = 1;
private int preDropSet = 0;
private bool Falling = true;
private bool Rotating = true;
void Start() {
}
void Update() {
if (transform.position.y > -5)
if (transform.rotation.z == 0)
transform.Translate (0, -1, 0);
if (transform.rotation.z == 90)
transform.Translate (1, 0, 0);
if (transform.rotation.z == 180)
transform.Translate (0, 1, 0);
if (transform.rotation.z == -90)
transform.Translate (-1, 0, 0);
if (Input.GetKeyDown(KeyCode.Space)) {
if (Rotating == true) {
transform.Rotate (0, 0, 90);
}
}
if (Input.GetKey(KeyCode.RightArrow)) {
if (transform.position.x < -14.5) {
if (Falling == true) {
transform.Translate(-1, 0, 0);
}
}
}
if (Input.GetKey(KeyCode.LeftArrow)) {
if (transform.position.x > -9.5) {
if (Falling == true) {
transform.Translate(1, 0, 0);
}
}
}
void OnTriggerEnter2D (Collider2D collider) {
Falling = false;
Rotating = false;
}
}
}Editor is loading...
Leave a Comment