protected override void Awake() { base.Awake(); OnDeath += onDeath; navAgent = GetComponent <NavMeshAgent>(); stackOfStates = GetComponent <StackFSM>(); if (PotentialStates.Length > 0) { State patrol = PotentialStates.FirstOrDefault(x => x.StateName == StateNames.PatrolState); State idle = PotentialStates.FirstOrDefault(x => x.StateName == StateNames.IdleState); if (patrol) { stackOfStates.PushState(patrol); } else if (idle) { stackOfStates.PushState(idle); } } GetPlayer(); //TODO when speed changes also set the navAgentSpeed navAgent.speed = Speed; }
public override void OnUpdate(ref StackFSM stackStates) { base.OnUpdate(ref stackStates); stateExpireTime -= Time.deltaTime; if (stateExpireTime <= 0.0f) { stackStates.PopState(); } }
public override void OnUpdate(ref StackFSM stackStates) { if (stackStates.aiBase.LineSightToPlayer()) { State follow = stackStates.aiBase.PotentialStates.FirstOrDefault(x => x.StateName == StateNames.FollowState); if (follow) { stackStates.PushState(follow); } } }
// Update is called once per frame void Update() { State currentState = GetCurrentState(); if (currentState != null) { if (!aiBase.BossStopped) { StackFSM stackfsm = gameObject.GetComponent <StackFSM>(); currentState.OnUpdate(ref stackfsm); } } }
private void Awake() { _anim = GetComponent <Animator>(); _navAgent = GetComponent <NavMeshAgent>(); _collider = GetComponent <SphereCollider>(); _stateMachine = new StackFSM(); _nearbyTargets = new List <Agent>(); _target = null; _lastKnownPosition = Vector3.zero; _speed = _navAgent.speed; _navAgent.speed = 0.0f; _health = new Health(MaxHealth); }
void Awake() { instance = this; LevelStates = new State[] { new TransitState(StateType.Transit), new JumpState(StateType.Jump), new StationArrivalState(StateType.StationArrival), new StationInsideState(StateType.StationInside), new StationExitState(StateType.StationExit), new MissionCompleteState(StateType.MissionComplete) }; stateMachine = new StackFSM(); // Create Json data loader new JsonLoader(); // and Writer new JsonWriter(); // and ID Generator new ID_Generator(); }
public override void OnUpdate(ref StackFSM stackStates) { ref AIBase aiBase = ref stackStates.aiBase;
public RoamingPresence(IZone zone, PresenceConfiguration configuration) : base(zone, configuration) { _fsm = new StackFSM(); _fsm.Push(new SpawnState(this)); }
public Npc(TagHelper tagHelper) { _tagHelper = tagHelper; _threatManager = new ThreatManager(); AI = new StackFSM(); }
public void Init() { StateMachine = new StackFSM(); PushState(StateType.Idle); }
protected Egg() { _fsm = new StackFSM(); _fsm.Push(new WaitForSummonersState(this)); }
public abstract void OnUpdate(ref StackFSM stackStates);
public override void OnUpdate(ref StackFSM stackStates) { base.OnUpdate(ref stackStates); Patrol(ref stackStates); }
void Patrol(ref StackFSM stackStates) { ref AIBase aiBase = ref stackStates.aiBase;