Exemplo n.º 1
0
    public void SetMoveByState(EnemyStates.State state)
    {
        switch (state)
        {
        case EnemyStates.State.PATROL:
            SetForPatrol();
            break;

        case EnemyStates.State.FREE_PATROL:
            SetForFreePatrol();
            break;

        case EnemyStates.State.CHASE:
            SetForChase();
            break;

        case EnemyStates.State.ATTACK:
            SetForAttack();
            break;

        case EnemyStates.State.SEEK:
            SetForSeek();
            break;

        case EnemyStates.State.IDLE:
            // no changes
            break;

        default:
            throw new Exception("No such state " + state);
        }
    }
Exemplo n.º 2
0
    public void ChangeStateTo(EnemyStates.State state)
    {
        IEnemyStateActivity currentActivity;

        if (StatesDic.TryGetValue(state, out currentActivity))
        {
            // Prepare state to be used
            if (this.state != state)
            {
                currentActivity.PreStartActivity();
            }
        }
        else
        {
            throw new Exception($"Enemy {this.gameObject.name} have no activity {EnemyStates.StatesNames.First(_ => _.Key == state).Value}");
        }

        this.state = state;
        EnemyMoveController.ChangeStateTo(state);
    }
Exemplo n.º 3
0
 public void ChangeState(EnemyStates.State state)
 {
     controller.ChangeStateTo(state);
 }
Exemplo n.º 4
0
 public void ChangeState(EnemyStates.State state)
 {
     controller.EnemyMoveController.ContinueMoving();
     controller.ChangeStateTo(state);
 }
Exemplo n.º 5
0
    public void ChangeStateTo(EnemyStates.State state)
    {
        var builder = new EnemyMoveSettingsBuilder(instance, agent); // recreate to change during debug by instance

        builder.SetMoveByState(state);
    }