// Add and initialize all states protected void Awake() { Instance = this; _keycardIds = new HashSet <string>(); _fpsStats = GetComponent <FpsStats>(); _fpsLook = GetComponent <FpsLook>(); _fpsMove = GetComponent <FpsMove>(); Rigidbody = GetComponent <Rigidbody>(); FpsControl.Initialize(shiftRunNotSneak: true); FpsHeroFiniteState[] states = GetComponentsInChildren <FpsHeroFiniteState>(); _finiteStates = new Dictionary <Enum, FpsHeroFiniteState>(); foreach (FpsHeroFiniteState state in states) { if (state.Name == null) { Debug.LogError(this.GetType().ToString() + ".Awake: Ignored null state name on " + state.gameObject.name, gameObject); continue; } if (_finiteStates.ContainsKey(state.Name) == false) { if (PrintDebug) { Debug.LogFormat(this.GetType().ToString() + ".Awake: Add state {0}", state.Name); } _finiteStates.Add(state.Name, state); state.Initialize(this); } else { Debug.LogWarning(this.GetType().ToString() + ".Awake: Ignored duplicate state " + state.Name + " on " + state.gameObject.name, gameObject); } } }
protected void Awake() { _fpsStats = GetComponent <FpsStats>(); }