예제 #1
0
    // CHANGE STATE

    public void ChangeState(UnitState state, object data)
    {
        // TODO : ajouter un timer dans l'attackComponent
        attackComponent.Stop();

        switch (state)
        {
        case UnitState.ATTACKING:
            movementComponent.StopMovement();
            attackComponent.Attack();
            break;

        case UnitState.TARGETING:
            attackComponent.Stop();
            attackComponent.DefineTarget((GameObject)data);
            movementComponent.GoToTarget((GameObject)data);
            break;

        case UnitState.LANING:
            movementComponent.GoToWaypoint();
            attackComponent.Stop();
            attackComponent.UndefineTarget();
            break;

        case UnitState.IDLE:
            movementComponent.StopMovement();
            attackComponent.Stop();
            attackComponent.UndefineTarget();
            break;

        case UnitState.DEAD:
            movementComponent.StopMovement();
            attackComponent.Stop();
            attackComponent.UndefineTarget();
            break;
        }

        this.state = state;
    }