private void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } foreach (Transform child in berm.transform) { bermParts.Add(child.GetChild(0).gameObject); } foreach (Transform child in testbed.transform) { testbedParts.Add(child.GetChild(0).gameObject); } foreach (Transform child in thorns.transform) { thornsParts.Add(child.GetChild(0).gameObject); } }
// Use this for initialization void Start() { phase = 0; phase1 = this.gameObject.GetComponent <Phase1>(); phase2 = this.gameObject.GetComponent <Phase2>(); phase3 = this.gameObject.GetComponent <Phase3>(); phase4 = this.gameObject.GetComponent <Phase4>(); phase5 = this.gameObject.GetComponent <Phase5>(); }
public void screamOuch(int count) { Console.WriteLine("Entering ScreamOuch"); // Phase1 - encountered only one time BEFORE entering the loop //if (Phase1 != null) Phase1(); Phase1?.Invoke(); for (int i = 1; i <= count; i++) { Phase2?.Invoke(i, count); // Phase2 - encountered count times, once before each WriteLine Console.WriteLine($"{Perp} is looking at {Victim} time {i} of {count}"); Phase3?.Invoke(i, count); // Phase3 - encountered count times, once after each WriteLine } Phase4?.Invoke(); // Phase4 - encountered only one time AFTER finishing all iterations of the loop Console.WriteLine("Exiting screamOuch"); }
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; }