Example #1
0
 public FloaterAttackState(FloatBlastEnemyController controller) : base(controller.gameObject)
 {
     type               = StateType.Attack;
     this.controller    = controller;
     awarenessProvider  = controller.awarenessProvider;
     movementController = gameObject.GetComponent <FloaterMovementController>();
 }
Example #2
0
 public FloaterPatrolState(EnemyController controller) : base(controller.gameObject)
 {
     type               = StateType.Patrol;
     this.controller    = controller;
     awarenessProvider  = controller.awarenessProvider;
     movementController = gameObject.GetComponent <FloaterMovementController>();
     origPosition       = movementController.transform.position;
 }
    public void Awake()
    {
        if (!movementController)
        {
            movementController = GetComponent <FloaterMovementController>();
        }
        if (!awarenessProvider)
        {
            awarenessProvider = GetComponent <AwarenessProvider>();
        }
        GetComponentInChildren <FloatBlasterVulnerable>().vulnerableTo = vulnerableTo;

        Dictionary <StateType, BaseState> states = new Dictionary <StateType, BaseState>()
        {
            { StateType.Patrol, new FloaterPatrolState(this) },
            { StateType.Attack, new FloaterAttackState(this) }
        };

        stateMachine.SetStates(states);
    }