Beispiel #1
0
 void Awake()
 {
     thisCs         = GetComponent <CharacterState>();
     aiSkillHandler = UnityUtil.AddComponetIfNull <AISkillHandler>(gameObject);
     aiSkillHandler.SetSkills(thisCs.GetSkills());
     OnAwake();
 }
Beispiel #2
0
    public void SwitchAutoMode(bool isAuto)
    {
        if (SceneUIManager.instance != null)
        {
            SceneUIManager.instance.autoFight.SetActive(isAuto);
            ResetAutoFightEffect(SceneUIManager.instance.autoFight.transform);
        }
        if (FightTouch._instance != null)
        {
            FightTouch._instance.autoBattleEffect.SetActive(isAuto);
        }

        if (!PlayerAlive())
        {
            return;
        }
        BasePlayerAI ai = player.GetComponent <BasePlayerAI>();

        if (ai != null)
        {
            ai.enabled = isAuto;
            if (isAuto)
            {
                AISkillHandler aisHandler = player.GetComponent <AISkillHandler>();
                if (aisHandler != null && FightTouch._instance != null)
                {
                    aisHandler.SetSkills(playerCS.GetSkills(), GetCds());
                }
            }
        }
        if (playerMotion.isAutoMode != isAuto)
        {
            playerMotion.isAutoMode  = isAuto;
            playerMotion.nav.enabled = false;
            playerMotion.nav.enabled = true;
            if (!isAuto)
            {
                playerMotion.Stop();
            }
        }
    }