예제 #1
0
    /// <summary>
    /// 设置角色死亡
    /// </summary>
    public void SetCharacterDead()
    {
        //死亡
        handler_Character.CleanCharacter(this);
        //如果是友方角色死亡 降低升级所需金币
        if (characterData.characterType == CharacterTypeEnum.Player)
        {
            handler_Game.GetGameData().LevelDownForPlayerPirateNumber(1);
            //播放粒子特效
            handler_Effect.PlayEffect(EffectInfo.PIRATE_DIE_BLUE, transform.position + new Vector3(0, 0.7f, 0));
        }
        else if (characterData.characterType == CharacterTypeEnum.Enemy)
        {
            //播放粒子特效
            handler_Effect.PlayEffect(EffectInfo.PIRATE_DIE_RED, transform.position + new Vector3(0, 0.7f, 0));
        }
        //刷新UI
        handler_Game.manager_UI.RefreshAllUI();
        //设置角色闲置
        SetIntentForIdle();
        //掉落金币
        if (handGold)
        {
            handGold.SetDrop();
        }
        //关闭寻路
        aiForCharacterPath.ClosePath();
        //协程-删除角色
        float destoryTime = handler_GameData.GetCharacterCorpseDestoryTime();

        StartCoroutine(CoroutineForCharacterDead(destoryTime));
    }