예제 #1
0
	public void xorState(TetrimoEmotionState state){
		this.emotionState ^= state;
	}
예제 #2
0
    void Start () {
		emotionState = 0;
        switch (State) {
        case TetrimoState.Spawning:
            NextFall = FallingCooldown;

            // Create shape and translate it at the center top of the game field.
            // REMARK: Do not use translate here! Instantiate create a copy of the current object.
            CreateShape();
            transform.position = new Vector3((int)(FieldSize.Right / 2), FieldSize.Top - 1, 0);

            // Check if the player has lost the game
            foreach (Transform child in transform) {
                if (FieldMatrix[(int)child.position.y, (int)child.position.x] != null) {
                    Application.LoadLevel("GameOver");
                }
            }
            name = "Tetrimo#" + (TetrimoCount-1);
            State = TetrimoState.Falling;
            break;

        case TetrimoState.Preview:
            RotationIndex = Random.Range(0, Shapes.GetLength(1));
            ShapeIndex    = Random.Range(0, Shapes.GetLength(0));
            CreateShape();
            transform.position = new Vector3(PreviewHUD.x, PreviewHUD.y);

            NextTetrimo = this;

            TetrimoCount++;
            name = "Tetrimo#" + TetrimoCount;
            break;
        }
	}