Ejemplo n.º 1
0
        public override void TakeDamage(int damage, DamageType damageType)
        {
            if (!enabled)
            {
                return;
            }
            health = Mathf.Clamp(health - damage, 0, maxHealth);
            if (damage > 0)
            {
                rampingDown = true;
                rampValue   = 1;
            }
            if (health <= 0)
            {
                GameManager.GM.enemyKills++;
                Transform deathBone = transform.Find("hero_root/hero_spine_1/hero_spine_2/hero_head");
                if (deathEffect != null)
                {
                    Transform deathT = (Instantiate(deathEffect, deathBone.position, deathBone.rotation) as GameObject).transform;
                    deathT.parent        = deathBone;
                    deathT.localPosition = Vector3.zero;
                }
                attackMod.Death(damageType);
                moveMod.Death(damageType);
                aimMod.Death(damageType);
                specialMod.Death(damageType);

                attackMod.enabled  = false;
                moveMod.enabled    = false;
                aimMod.enabled     = false;
                specialMod.enabled = false;

                attackMod  = null;
                moveMod    = null;
                aimMod     = null;
                specialMod = null;
                anim.SetTrigger("Death");
                CharacterController enemyController = GetComponent <CharacterController>();
                Rigidbody           enemyRigid      = GetComponent <Rigidbody>();
                Destroy(enemyController);
                Destroy(enemyRigid);
                enabled = false;

                //Destroy(gameObject);
            }
        }
Ejemplo n.º 2
0
        public virtual void Awake()
        {
            anim       = GetComponent <Animator>();
            attackMod  = GetComponent <AttackModule>();
            moveMod    = GetComponent <MovementModule>();
            aimMod     = GetComponent <AimModule>();
            specialMod = GetComponent <SpecialModule>();

            renderers = GetComponentsInChildren <Renderer>();
            maxHealth = (health > 0) ? health : 1;

            aimMod.Init();
            attackMod.Init();
            moveMod.Init();
            specialMod.Init();

            //HCC = GameObject.FindGameObjectWithTag("Player").GetComponent<HeroCharacterController>();
            FM = Camera.main.GetComponent <FocusMode>();
        }
Ejemplo n.º 3
0
        public override void Init()
        {
            base.Init();
            aimMod     = enemy.aimMod;
            anim       = GetComponent <Animator>();
            weaponBone = transform.Find("hero_root/hero_spine_1/hero_spine_2/hero_shoulder_R/hero_elbow_R/hero_wrist_R/hero_hand_1_R");
            if (!equipped && weapon != null)
            {
                equip               = (Instantiate(weapon, weaponBone.position, weaponBone.rotation) as GameObject).transform;
                equip.parent        = weaponBone;
                equip.localPosition = Vector3.zero;
                equipped            = true;

                /*weaponRenderer = equip.GetComponent<Renderer>();
                 * if (weaponRenderer == null)
                 * {
                 *      weaponRenderer = equip.GetComponentInChildren<Renderer>();
                 * }
                 * weaponRenderer.enabled = false;*/
                equip.gameObject.SetActive(false);
            }
            //player = GameObject.FindGameObjectWithTag("Player").transform;
        }