Exemplo n.º 1
0
 //次のステップへ行く、もし最後のステップだったら死ぬ
 public void goToNextPhase()
 {
     //まずは現在のステップから出ます
     currentPhase.ExitState();
     phaseIndex++;
     if (phaseIndex >= phases.Count)
     {
         Death();
     }
     else
     {
         currentPhase = phases[phaseIndex];
         //ステップに入る
         currentPhase.EnterState();
         restoreHealth();
     }
 }
Exemplo n.º 2
0
    void Start()
    {
        anim   = GetComponent <Animator>();
        ag     = GetComponent <NavMeshAgent>();
        p      = FindObjectOfType <Player>();
        w      = GetComponentInChildren <Weapon>();
        health = GetComponent <EnemyHealth>();
        //バトルはステップに別れています、リストのなかでステップを作る
        BossPhase phase1 = new Phase1(ag, anim, state, w, p, transform, this);
        BossPhase phase2 = new Phase2(ag, anim, state, w, p, transform, this);
        BossPhase phase3 = new Phase3(ag, anim, state, w, p, transform, this);

        phases.Add(phase1);
        phases.Add(phase2);
        phases.Add(phase3);
        //スポーンポジションを登録する
        startPos = transform.position;
        smoke    = GetComponentInChildren <ParticleSystem>();
        //現在phaseの設定
        currentPhase = phases[phaseIndex];
        //phaseエントリー
        currentPhase.EnterState();
        wp = GetComponentInChildren <Weapon>();
        //スポンサー設定
        Transform[] allChildren = GetComponentsInChildren <Transform>();
        foreach (var c in allChildren)
        {
            if (c.gameObject.name == "KnifeSpawner")
            {
                knifeSpawner = c.transform;
            }
            else if (c.gameObject.name == "MagicSpawner")
            {
                magicSpawner = c.transform;
            }
        }
        //スポーンprefab
        enemy = enemyToSpawn;
    }