コード例 #1
0
 private void Awake()
 {
     anim              = GetComponent <Animator>();
     Source            = GetComponent <AudioSource>();
     flipped           = false;
     currentPhaseIndex = 0;
     currentPhase      = allPhases[currentPhaseIndex];
     //GoToNextPhase();
 }
コード例 #2
0
    /// <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 + "'");
        }
    }
コード例 #3
0
    /// <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);
    }
コード例 #4
0
    /// <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;
    }
コード例 #5
0
    IEnumerator Battle()
    {
        while (!(phaseState is EndPhase))
        {
            // フェーズの実行
            yield return(phaseState.Execute(battleContext));

            // 次のフェーズに以降
            phaseState = phaseState.next;
        }
        // EndPhaseの実行
        yield return(phaseState.Execute(battleContext));


        yield break; // ここより下は実行しない
    }
コード例 #6
0
    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();
        }
    }
コード例 #7
0
 void Start()
 {
     phaseState = new StartPhase();
     StartCoroutine(Battle());
 }