public LaserEnemyModel(LaserEnemyView view, Transform owner, List <ANode> availableNodes, float speed, List <Transform> patrolWaypoints, bool patrolLoop, Transform objective, float distArroundPlayer, Laser attack, Transform castPoint, LaserEnemy entity) { _view = view; _stateMachine = new StateMachineClassic(); _stateMachine.AddState(new MyPatrolState(_stateMachine, owner, speed, patrolWaypoints, patrolLoop)); _stateMachine.AddState(new MoveNearObjective(_stateMachine, availableNodes, owner, objective, distArroundPlayer, speed)); _stateMachine.AddState(new ChargeAttack(_stateMachine, attack, owner, objective, castPoint, entity)); }
private void Start() { _sm = new StateMachineClassic(); _sm.AddState(new EnemyRangedMetheoriteSpawner_AttackState(_sm, this)); _sm.AddState(new EnemyRangedMetheoriteSpawner_SpawnState(_sm, this)); _sm.AddState(new EnemyRangedMetheoriteSpawner_CooldownState(_sm, this)); _sm.AddState(new EnemyRangedMetheoriteSpawner_PathfindingState(_sm, this, FindObjectOfType <NodesList>().GetNodes())); _sm.SetState <EnemyRangedMetheoriteSpawner_SpawnState>(); attackTimer = 0; }
protected override void Awake() { base.Awake(); sm = new StateMachineClassic(); sm.AddState(new LaserEnemy_R_CastLaserState(sm, this)); sm.AddState(new LaserEnemy_R_IdleState(sm, this)); sm.SetState <LaserEnemy_R_IdleState>(); anim = GetComponent <Animator>(); target = FindObjectOfType <Player>(); }
protected override void Awake() { base.Awake(); initialPosition = transform.position; initialRotation = transform.rotation; rigi = GetComponent <Rigidbody>(); target = FindObjectOfType <Player>(); EventsManager.SuscribeToEvent("PlayerResurrect", SetInitialPosAndRotation); sm = new StateMachineClassic(); sm.AddState(new GhostEnemy_R_ChaseState(sm, this)); }