public void TakeDamage(int DmgAmount)
        {
            BossHealth -= DmgAmount;
            animator.SetTrigger("Hurt");

            if (BossHealth <= 0)
            {
                animator.SetBool("Dead", true);
                BossBulbatoeHandler.BossKilled();
            }
        }
Exemple #2
0
        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;
        }