Esempio n. 1
0
    public override void OnDeath(DamageData damagedata = null)
    {
        if (hpBar != null)
        {
            hpBar.SetActive(false);
        }

        if (citizenUi != null)
        {
            citizenUi.SetActive(false);
        }

        if (null != Character.m_actorUIData.c_show)
        {
            UIManager.Instance.Close(Character.m_actorUIData.c_show);
            Character.m_actorUIData.c_show = null;
        }

        if (null != Character.m_actorUIData.show)
        {
            UIManager.Instance.Close(Character.m_actorUIData.show);
            Character.m_actorUIData.show = null;
        }

        //string enemyScore = "50";
        //UIManager.Instance.OpenScoreText(Character.m_actorUIData.hpPos, enemyScore);

        DropItem item = gameObject.GetComponent <DropItem>() as DropItem;

        if (item != null)
        {
            item.Process();
        }

        m_data.agent.enabled = false;

        Explosion explosionOrigin = gameObject.GetComponent <Explosion>() as Explosion;

        if (explosionOrigin != null)
        {
            explosionOrigin.Process();
        }


        if (damagedata != null)
        {
            if (damagedata.AttackType == AttackType.Splash)
            {
                if (m_ragdoll != null)
                {
                    m_ragdoll.PlayRagdoll();
                    HitBox hit = this.GetComponentsInChildren <HitBox>()[0];// 성민 추가
                    if (hit != null)
                    {
                        (InGameManager.Instance.Player.CurrentRightWeapon as GunBaseRight).Enemy_Break(hit, BreakName, BodyPart.Torso);
                    }
                    m_coroutineCommand = CoroutineManager.Instance.Register(DeadTimer());
                }
                else
                {
                    Character.AnimatorAction.Action(AnimatorState.Dead);
                }
            }
            else
            {
                //Character.AnimatorAction.Action(AnimatorState.Dead);
                if (m_ragdoll != null)
                {
                    m_ragdoll.PlayRagdoll();
                    //HitBox hit = this.GetComponentsInChildren<HitBox>()[0];// 성민 추가
                    //if (hit != null)
                    //{
                    //    (InGameManager.Instance.Player.CurrentRightWeapon as GunBaseRight).Enemy_Break(hit, BreakName, BodyPart.Torso);

                    //}
                    m_coroutineCommand = CoroutineManager.Instance.Register(DeadTimer());
                }
                else
                {
                    Character.AnimatorAction.Action(AnimatorState.Dead);
                }
            }
        }
        else
        {
            if (m_ragdoll != null)
            {
                m_ragdoll.PlayRagdoll();
                //HitBox hit = this.GetComponentsInChildren<HitBox>()[0];// 성민 추가
                //if (hit != null)
                //{
                //    (InGameManager.Instance.Player.CurrentRightWeapon as GunBaseRight).Enemy_Break(hit, BreakName, BodyPart.Torso);

                //}
                m_coroutineCommand = CoroutineManager.Instance.Register(DeadTimer());
            }
            else
            {
                Character.AnimatorAction.Action(AnimatorState.Dead);
            }
        }


        if (Character.Team == TeamFlag.Hostage)
        {
            InGameManager.Instance.InGameData.TotalScore -= 3000;
            if (0 > InGameManager.Instance.InGameData.TotalScore)
            {
                InGameManager.Instance.InGameData.TotalScore = 0;
                InGameManager.Instance.InGameData.WaveScore  = 0;
            }
        }
        else
        {
            InGameManager.Instance.InGameData.TotalScore += 50;
            InGameManager.Instance.InGameData.WaveScore  += 50;
        }
    }