// Initializes onEnable so the Enemy is Initialized first void Awake() { if (health == null) { health = GetComponent <EnemyHealth>(); } if (health != null) { health.InitializeHealth(StartingHealth); } else { throw new ArgumentNullException("Could not find EnemyHealth"); } if (wallowBoss == null) { wallowBoss = GameObject.Find("WallowBossCore").GetComponent <WallowBoss>(); } if (bossBulbatoes == null) { bossBulbatoes = GetComponent <BossBulbatoes>(); } }
void Start() { if (Cinemachine == null) { Cinemachine = GameObject.Find("CM_vcam1").GetComponent <CinemachineVirtualCamera>(); } if (transposer == null) { transposer = Cinemachine.GetCinemachineComponent <CinemachineFramingTransposer>(); } if (BossCamera == null) { BossCamera = this.transform.Find("CameraTarget").GetComponent <Transform>(); } if (CameraOriginalTransform == null) { CameraOriginalTransform = Cinemachine.Follow; } if (BossBarrier == null) { BossBarrier = GameObject.Find("BossBarrier").GetComponent <Collider2D>(); } if (playerCharacter == null) { playerCharacter = GameObject.Find("Darwin").GetComponent <PlayerCharacter>(); } if (wallowBoss == null) { wallowBoss = GameObject.Find("WallowBossCore").GetComponent <WallowBoss>(); } }
void Start() { if (WallowBoss == null) { WallowBoss = GameObject.Find("WallowBossCore").GetComponent <WallowBoss>(); } if (BossBulbatoeHandler == null) { BossBulbatoeHandler = GameObject.Find("BossBulbatoeSpawnPoints").GetComponent <BossBulbatoeHandler>(); } if (damageableBossBulbatoe == null) { damageableBossBulbatoe = GetComponent <DamageableBossBulbatoe>(); } if (this.rigidbody2D == null) { this.rigidbody2D = GetComponent <Rigidbody2D>(); if (this.rigidbody2D == null) { this.rigidbody2D = GetComponentInChildren <Rigidbody2D>(); } } if (this.spriteRenderer == null) { this.spriteRenderer = GetComponent <SpriteRenderer>(); if (this.spriteRenderer == null) { this.spriteRenderer = GetComponentInChildren <SpriteRenderer>(); } } if (this.animator == null) { this.animator = GetComponent <Animator>(); if (this.animator == null) { this.animator = GetComponentInChildren <Animator>(); } } // This only works if the GFX subcomponent is a child game object of the main. TODO: Think of a better implementation if (this.boxCollider == null) { this.boxCollider = GetComponent <BoxCollider2D>(); if (this.boxCollider == null) { this.boxCollider = GetComponentInChildren <BoxCollider2D>(); } } if (this.damageable == null) { damageable = GetComponent <DamageableEnemy>(); } Activated = false; }