public static string ToButtonNames(this ButtonNameType self) { switch (self) { case ButtonNameType.MoveHorizontal: return(ButtonNames.MoveHorizontal); case ButtonNameType.MoveVertical: return(ButtonNames.MoveVertical); case ButtonNameType.CameraHorizontal: return(ButtonNames.CameraHorizontal); case ButtonNameType.CameraVertical: return(ButtonNames.CameraVertical); case ButtonNameType.Fire: return(ButtonNames.Fire); case ButtonNameType.Lockon: return(ButtonNames.Lockon); case ButtonNameType.Skill0: return(ButtonNames.Skill0); case ButtonNameType.Skill1: return(ButtonNames.Skill1); case ButtonNameType.Skill2: return(ButtonNames.Skill2); default: Assert.IsTrue(false, string.Format("未対応の値です {0}", self)); return(String.Empty); } }
private void DoAction(ButtonNameType bType) { if (!CanUse(bType)) return; switch (bType) { case ButtonNameType.StaminaPlus: ModifyStamina(ButtonModificatorType.Plus); break; case ButtonNameType.StaminaMinus: ModifyStamina(ButtonModificatorType.Minus); break; case ButtonNameType.PowerPlus: ModifyPower(ButtonModificatorType.Plus); break; case ButtonNameType.PowerMinus: ModifyPower(ButtonModificatorType.Minus); break; case ButtonNameType.Reset: Setup(); break; case ButtonNameType.OK: SavePlayerData(); SceneManager.LoadScene(NamesScene.GAME_SURVIVAL); break; default: break; //"Debug.Error WTF?" } }
private bool CanUse(ButtonNameType bType) { switch (bType) { case ButtonNameType.StaminaPlus: case ButtonNameType.PowerPlus: return CheckCanSpendPoint(); case ButtonNameType.StaminaMinus: return (CheckCanGetBackPoint() && CanDecreaseStamina()); case ButtonNameType.PowerMinus: return (CheckCanGetBackPoint() && CanDecreasePower()); case ButtonNameType.Reset: case ButtonNameType.OK: //no validation needed return true; default: //"Debug.Error WTF?" return false; } }