public void PlaceShape(ShapeMovementController shapeToPlace) { int y = 0; shapeToPlace?.ManageStopFalling(); StartCoroutine(DeleteRows(y)); }
private void Awake() { mustUseMalusBonus = true; NotificationManager.Instance.AttachNotif(EventNotification.ShapeCreation, this, (o) => { currentCreatedShape++; mustUseMalusBonus = currentCreatedShape % _shapeCreationInterval == 0; ShapeMovementController newShape = Managers.Game.currentShape.movementController; if (mustUseMalusBonus) { var selected = newShape.GetComponentsInChildren <BonusMalusSlot>().Random(); GameObject.Instantiate(AllBonusMalus.Random(), selected.transform, false); } }); }
void Awake() { movementController = GetComponent <ShapeMovementController>(); // AssignRandomColor(); }
void Awake() { movementController = GetComponent <ShapeMovementController>(); }
public void Touch(GameObject go, Gun.BulletType type = Gun.BulletType.Null, bool inverse = false) { string order = type == Gun.BulletType.Null ? go.tag : System.Enum.GetName(typeof(Gun.BulletType), type); _shapeController = _shapeController ?? GetComponentInParent <ShapeMovementController>(); _bonusMalus = _bonusMalus ?? GetComponentInChildren <BonusMalus>(); _bonusMalus?.Fire(); switch (order) { case "TurnRight": if (_shapeController.transform.position.x > go.transform.position.x) { if (!inverse) { _shapeController.RotateClockWise(true); } else { _shapeController.RotateClockWise(false); } } else { if (!inverse) { _shapeController.RotateClockWise(false); } else { _shapeController.RotateClockWise(true); } } break; case "TurnLeft": if (_shapeController.transform.position.x > go.transform.position.x) { if (!inverse) { _shapeController.RotateClockWise(true); } else { _shapeController.RotateClockWise(false); } } else { if (!inverse) { _shapeController.RotateClockWise(false); } else { _shapeController.RotateClockWise(true); } } break; case "Fall": _shapeController.InstantFall(); break; case "Move": if (_shapeController.transform.position.x > go.transform.position.x) { _shapeController.MoveHorizontal(!inverse ? ShapeMovementController.Direction.Right : ShapeMovementController.Direction.Left); } else { _shapeController.MoveHorizontal(!inverse ? ShapeMovementController.Direction.Left : ShapeMovementController.Direction.Right); } break; default: Debug.Log("collision detected but " + go.name); break; } }