Exemplo n.º 1
0
    void HandleTetrominoOverlap()
    {
        while (true)
        {
            CollisionTarget overlapedObject = gameGrid.CheckHasOverlapAtPos(Vector2.zero);
            if (overlapedObject == CollisionTarget.None)
            {
                gameGrid.UpdateGrid();
                return;
            }

            switch (overlapedObject)
            {
            case CollisionTarget.GridLeft:
                currentTetromino.transform.position += new Vector3(1.0f, 0.0f, 0.0f);
                break;

            case CollisionTarget.GridRight:
                currentTetromino.transform.position += new Vector3(-1.0f, 0.0f, 0.0f);
                break;

            case CollisionTarget.GridDown:
            case CollisionTarget.Mino:
                currentTetromino.transform.position += new Vector3(0.0f, 1.0f, 0.0f);
                break;
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.gameObject.tag)
        {
        case "DeadZone":
            _targets |= CollisionTarget.Dead;
            break;

        case "GoalZone":
            _targets |= CollisionTarget.Goal;
            break;
        }
    }
Exemplo n.º 3
0
 public bool IsCollisionWith(CollisionTarget target)
 {
     return((_targets & target) == target);
 }
Exemplo n.º 4
0
 void Start()
 {
     _targets = CollisionTarget.None;
 }
Exemplo n.º 5
0
 void Start()
 {
     collTarget  = GameObject.FindGameObjectWithTag("Aim").GetComponent <CollisionTarget>();
     gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
 }
Exemplo n.º 6
0
 bool CollidableTo(CollisionTarget mask)
 {
     return ignores.Contains(mask) == false;
 }
Exemplo n.º 7
0
 private bool IsCollisionWith(CollisionTarget target)
 {
     return(_ballGameObject.GetComponent <BallCollisionChecker>()?.IsCollisionWith(target) ?? false);
 }