public void Awake() { if (!Mathf.Approximately(Spawns.Sum(hS => hS.Chance), 1f)) throw new UnityException(this.gameObject.name + ": Sum of chances must be == 1"); animator = GetComponent<Animator>(); units = new List<GameObject>(); idle = new StateIdle(this); ready = new StateReady(this); wait = new StateWait(this); spawn = new StateSpawn(this); open = new StateOpen(this); push = new StatePush(this); close = new StateClose(this); ready.Wait = wait; wait.Spawn = spawn; spawn.Open = open; open.Push = push; push.Close = close; close.Ready = ready; currentState = ready; ready.OnStateEnter(); }
public virtual void PaySkillPoints() { //Ensure we're in a ready state Debug.Assert(skill.chrOwner.curStateReadiness.Type() == StateReadiness.TYPE.READY); StateReady stateReady = (StateReady)(skill.chrOwner.curStateReadiness); //Ensure we have enough Skill Points left to use this skill Debug.Assert(stateReady.nCurSkillsLeft >= GetSkillPointCost()); stateReady.nCurSkillsLeft -= GetSkillPointCost(); }
// This is the end of the section that should be copied and pasted public override void ExecuteEffect() { Debug.Assert(chrTarget.nFatigue == 0); //Initially give the character Skill Points equal to their maximum StateReady newState = new StateReady(chrTarget, chrTarget.nMaxSkillsLeft); //Just transition to the ready state chrTarget.SetStateReadiness(newState); fDelay = ContTime.fDelayStandard; sLabel = chrTarget.sName + " has Readied"; }
public AirVRClientStateMachine(Context context, float delayToResume) { _context = context; stateDisconnected = new StateDisconnected(this); stateReady = new StateReady(this); stateUnfocused = new StateUnfocused(this); statePlaying = new StatePlaying(this); stateInactive = new StateInactive(this); statePaused = new StatePaused(this); stateResuming = new StateResuming(this, delayToResume); _state = stateDisconnected; _lastAppFocused = true; }
/// <summary> /// Emits a new state. /// </summary> public void PushState(PresenceState presenceState) => StateReady?.Invoke(this, presenceState);