///-------------------------------------------------------------------- /// LocalConsole methods ///-------------------------------------------------------------------- public override void Init() { if (HubrisCore.Instance == null || HubrisCore.Instance.Console != this) { return; } SubTick(); _settings = new SettingsHub(); _cmdQueue = new CmdQueue(); _cmdData = new List <string>(); _setVarTemp = Settings.None; Ready = true; if (HubrisPlayer.Instance != null) { _pScript = HubrisPlayer.Instance; } else { if (HubrisCore.Instance.Debug) { Log("LocalConsole OnEnable(): Waiting for Player.Instance...", true); } _pScript = null; } }
public override void CleanUp(bool full = true) { if (!this._disposed) { if (full) { _act = false; _name = null; } _pScript = null; UnsubTick(); // Need to Unsubscribe from Tick Event to prevent errors _disposed = true; } }
// FixedTick is called once per fixed time interval with MonoBehaviour.FixedUpdate() public override void FixedTick() { if (_pScript == null && HubrisPlayer.Instance != null) { _pScript = HubrisPlayer.Instance; // Settings.UpdateAllDirtyVars( false ); // False because we don't want to spam the console with them if (HubrisCore.Instance.Debug) { Log("LocalConsole Update(): FPSControl.Player found"); } } if (Active && Ready) { ProcessInstructions(); } }
/// <summary> /// Register the HubrisPlayer in the dictionary and return the unique Id assigned /// </summary> public ulong RegisterPlayer(HubrisPlayer player, GameObject obj = null) { if (player == null) { return(0); } ulong id = PullUniqueId(); GameObject root = player.transform.root.gameObject; _playerDict.Add(id, player); _entDict.Add(id, player); _rootObjDict.Add(player, root); _objToEntDict.Add(root, player); return(id); }