private void CheckAndStartRotation(int direction) { //Check if rotation time is bigger than remaining time to go down. If it is, don't rotate float remainingTime = blockController.game.currentPeriod - blockController.verticalTimer; float rotationTime = (1f / blockController.blockControllerData.blockTurningSpeed) * Time.fixedDeltaTime; bool enoughTime = remainingTime > rotationTime; if (!blockController.isRotating && blockController.allowRotation && enoughTime) { int rotation = -90 * direction; //Check if rotation is allowed bool allowed = CanBlockMove(Vector2Int.zero, rotation); if (allowed) { //Play rotation SFX eventEmitter.SetFMODGlobalParameter( FMODEvents.GetString <GlobalParameters>(GlobalParameters.DIRECTION), direction); eventEmitter.PlaySFXOneShot(FMODEvents.GetString <SFX>(SFX.ROTATION)); IEnumerator coroutine = Rotate(rotation); StartCoroutine(coroutine); } } }
// Start is called before the first frame update void Start() { instance = this; // print(events[(int)General.LEAVES]); }
//Get event string in Description data annotation public static string GetString <TEnum>(this TEnum enumValue) where TEnum : struct { return(FMODEvents.GetEnumDescription((Enum)(object)((TEnum)enumValue))); }