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; } } }
private void OnTriggerEnter(Collider other) { switch (other.gameObject.tag) { case "DeadZone": _targets |= CollisionTarget.Dead; break; case "GoalZone": _targets |= CollisionTarget.Goal; break; } }
public bool IsCollisionWith(CollisionTarget target) { return((_targets & target) == target); }
void Start() { _targets = CollisionTarget.None; }
void Start() { collTarget = GameObject.FindGameObjectWithTag("Aim").GetComponent <CollisionTarget>(); gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); }
bool CollidableTo(CollisionTarget mask) { return ignores.Contains(mask) == false; }
private bool IsCollisionWith(CollisionTarget target) { return(_ballGameObject.GetComponent <BallCollisionChecker>()?.IsCollisionWith(target) ?? false); }