コード例 #1
0
    public override void Enter()
    {
        //if(isFacingToPlayer)
        enemy.FaceToPlayer();

        base.Enter();
    }
コード例 #2
0
    public override void Enter()
    {
        base.Enter();

        enemy.FaceToPlayer();

        combatData.isParryDamage = false;
    }
コード例 #3
0
    public IEnumerator BattleBegin()
    {
        // set playerCanMove false: use converseState
        enemy.refPlayer.stateMachine.SwitchState(enemy.refPlayer.converseState);
        enemy.refPlayer.FaceTo(enemy.aliveGO.transform.position);
        // enemy.npc.npcConversationHandler.gameObject.SetActive(true);
        // enemy.npc.npcConversationHandler.InfoSignAnim.gameObject.SetActive(false);
        // enemy.npc.npcConversationHandler.selectionBox.gameObject.SetActive(false);
        // start conversation
        yield return(new WaitForSeconds(battleBeginDelay));

        NPCEventHandler npcEventHandler = enemy.npc.GetComponentInChildren <NPCEventHandler>();

        enemy.refPlayer.SetNPCEventHandler(npcEventHandler);
        enemy.npc.npcConversationHandler.gameObject.SetActive(true);
        npcEventHandler.OnNPCInteraction();

        yield return(new WaitForEndOfFrame());

        enemy.npc.npcConversationHandler.ResetTotalTime();

        //npcEventHandler.OnNPCInteraction();

        yield return(new WaitWhile(() => npcEventHandler.IsInteraction));

        enemy.npc.gameObject.SetActive(false);
        enemy.refPlayer.stateMachine.SwitchState(enemy.refPlayer.cinemaState);
        enemy.refPlayer.SetNPCEventHandler(null);
        // end conversation

        // yield return new WaitForSeconds(battleBeginDelay);
        var gm = GameObject.Find("GameManager").GetComponent <GameManager>();

        enemy.anim.SetBool("isBattleBegin", true);
        yield return(new WaitUntil(() => isBattleBegin));

        // set player position
        // play ui fade in
        yield return(new WaitForSeconds(gm.uiHandler.uiEffectHandler.OnPlayUIEffect(UIEffect.Transition_CrossFade, UIEffectAnimationClip.start)));

        Vector3 goyePos   = enemy.transform.Find("Combat Field/Goye Position").position;
        Vector3 playerPos = enemy.transform.Find("Combat Field/Player Position").position;

        enemy.refPlayer.SetPosition(playerPos);
        // set goye position
        enemy.objectToAlive.transform.position = goyePos;
        enemy.FaceToPlayer();
        // play ui fade out
        yield return(new WaitForSeconds(gm.uiHandler.uiEffectHandler.OnPlayUIEffect(UIEffect.Transition_CrossFade, UIEffectAnimationClip.end)));

        // set goye rigidbodytype2d to dynamic
        enemy.rb.bodyType = RigidbodyType2D.Dynamic;
        stateMachine.SwitchState(enemy.runState);
        enemy.refPlayer.stateMachine.SwitchState(enemy.refPlayer.idleState);
    }
コード例 #4
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        enemy.FaceToPlayer(false);

        DoChecks();

        if (defenceTimer < 0)
        {
            enemy.anim.SetBool("isDefence", false);
            isCounterAttack = false;
        }
        else if (detectPlayerInMeleeRange)
        {
            if (enemy.refPlayer.stateMachine.currentState == enemy.refPlayer.attackState)
            {
                stateMachine.SwitchState(enemy.parryState);
            }
            else if (enemy.meleeAttackState.CanAction())
            {
                stateMachine.SwitchState(enemy.meleeAttackState);
            }
            else
            {
                SetIsDefenceForward(false);
            }
        }
        else
        {
            SetIsDefenceForward(true);
        }

        /*
         * else if(detectPlayerInMaxAgro && !detectPlayerInMinAgro)
         * {
         *  if (enemy.chargeState.CanAction())
         *  {
         *      stateMachine.SwitchState(enemy.chargeState);
         *  }
         *  else
         *  {
         *      SetIsDefenceForward(true);
         *  }
         * }
         */
    }