예제 #1
0
파일: Enemy.cs 프로젝트: Shichifu-gd/MAIO
    private void EnemyMove()
    {
        bool move = true;

        if (DirectionTravel_enemy == DirectionTravel.North)
        {
            move = bodyMovementWalking.StepNorth();
        }
        if (DirectionTravel_enemy == DirectionTravel.South)
        {
            move = bodyMovementWalking.StepSouth();
        }
        if (DirectionTravel_enemy == DirectionTravel.East)
        {
            move = bodyMovementWalking.StepEast();
        }
        if (DirectionTravel_enemy == DirectionTravel.West)
        {
            move = bodyMovementWalking.StepWest();
        }
        if (!move)
        {
            EnemyAttack();
        }
        InMove = false;
    }
예제 #2
0
    private IEnumerator DetermineAction()
    {
        bool move = true;

        OnUpdateDirections();
        yield return(new WaitForSeconds(0.2f));

        PlayerMove = gameController.SetPlayerMove();
        if (PlayerMove)
        {
            if (DirectionTravel_player == DirectionTravel.North)
            {
                move = bodyMovementWalking.StepNorth();
            }
            if (DirectionTravel_player == DirectionTravel.South)
            {
                move = bodyMovementWalking.StepSouth();
            }
            if (DirectionTravel_player == DirectionTravel.East)
            {
                move = bodyMovementWalking.StepEast();
            }
            if (DirectionTravel_player == DirectionTravel.West)
            {
                move = bodyMovementWalking.StepWest();
            }
            if (!move)
            {
                AttackPlayer();
            }
            StartCoroutine(WaitingForEndOfAction());
        }
    }