private void Awake() { anim = GetComponent <Animator>(); Source = GetComponent <AudioSource>(); flipped = false; currentPhaseIndex = 0; currentPhase = allPhases[currentPhaseIndex]; //GoToNextPhase(); }
/// <summary> /// Unredisters the phase. /// </summary> /// <param name="phase">Phase.</param> public void UnredisterPhase(PhaseBase phase) { phases.Remove (phase); //Error Check if (Find (phase.PhaseName) != null) { Debug.LogError ("failed to unregister '" + phase.PhaseName + "'"); } }
/// <summary> /// Registers the phase. /// </summary> /// <param name="phase">Phase.</param> public void RegisterPhase(PhaseBase phase) { // Error Check if (Find (phase.PhaseName) != null) { Debug.LogError ("'" + phase.PhaseName + "' is already registed"); return; } phases.Add (phase); }
/// <summary> /// Goto the specified nextPhase. /// </summary> /// <param name="nextPhase">Next phase.</param> public bool Goto(PhaseBase nextPhase) { if (currentPhase != null) { currentPhase.OnExit (nextPhase); } PhaseBase prevPhase = currentPhase; currentPhase = nextPhase; if (nextPhase != null) { nextPhase.OnEnter (prevPhase); } return true; }
IEnumerator Battle() { while (!(phaseState is EndPhase)) { // フェーズの実行 yield return(phaseState.Execute(battleContext)); // 次のフェーズに以降 phaseState = phaseState.next; } // EndPhaseの実行 yield return(phaseState.Execute(battleContext)); yield break; // ここより下は実行しない }
public void GoToNextPhase() { anim.ResetTrigger("Attack"); anim.ResetTrigger("Hurt"); anim.SetTrigger("Transition"); currentPhaseIndex++; currentPhase = allPhases[currentPhaseIndex]; if (currentPhaseIndex == 1) { Destroy(MyClaw); } if (currentPhaseIndex == 2) { EnableShockers(); } }
void Start() { phaseState = new StartPhase(); StartCoroutine(Battle()); }