Untitled
unknown
plain_text
2 years ago
3.5 kB
17
Indexable
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using JetBrains.Annotations;
using TMPro;
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;
int colorCount = 1;
List<int> colors = new List<int>();
public GameObject puyo1;
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)];
if (color[puyoColor] == Color.red)
{ Debug.Log("Yes!"); }
}
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;
}
if (other.gameObject.layer == 3)
{
pieceRotate = false;
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;
}
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;
Debug.Log("Yes");
}
if (this.gameObject.tag == "Puyo 1")
{
pieceFall = true;
}
if (this.gameObject.tag == "Puyo 2")
{
pieceFall = true;
}
if (this.gameObject.tag == "Not Falling")
{
pieceFall = false;
}
}
}Editor is loading...
Leave a Comment