/// <summary> /// Raises the enable event when LoadCommand is loaded. /// </summary> public void OnEnable() { OCLogger.Fine(gameObject.name + " is enabled."); }
/// <summary> /// Update is called once per frame. /// </summary> public void Update() { OCLogger.Fine(gameObject.name + " is updated."); }
/// <summary> /// Reset this instance to its default values. /// </summary> public void Reset() { Uninitialize(); Initialize(); OCLogger.Fine(gameObject.name + " is reset."); }
/// <summary> /// Raises the destroy event when Console is about to be destroyed. /// </summary> public void OnDestroy() { Uninitialize(); OCLogger.Fine(gameObject.name + " is about to be destroyed."); }
/// <summary> /// Use this for initialization /// </summary> public new void Start() { base.Start(); OCLogger.Fine(gameObject.name + " is started."); }
/// <summary> /// Update is called once per frame. /// </summary> public void Update() { _panelHeight = Screen.height * 0.30f; if (Input.GetKeyDown(KeyCode.BackQuote)) { // If the window is already visible and isn't disappearing... if (_isShown && _movementState != Movement.DISAPPEARING) { CloseChatWindow(); _player.GetComponent <OCInputController>().enabled = true; _player.GetComponent <OCCharacterMotor>().enabled = true; _player.GetComponent <MouseLook>().enabled = true; } else { _isShown = true; _player.GetComponent <OCInputController>().enabled = false; _player.GetComponent <OCCharacterMotor>().enabled = false; _player.GetComponent <MouseLook>().enabled = false; _movementState = Movement.APPEARING; } } // Below this line is only relevent when console is active if (!this.IsActive()) { return; } if (Input.GetKeyDown(KeyCode.Return) && _currentInput.Length > 0) { // && // GUI.GetNameOfFocusedControl() == "CommandArea") this.ProcessConsoleLine(_currentInput); _currentInput = ""; // blank input field _inputHistoryCurrent = null; // reset current position in input history } // Implement input history using up/down arrow if (Input.GetKeyDown(KeyCode.UpArrow)) { if (_inputHistoryCurrent == null) { // TODO save current output so that we can push down to restore // previously written text _inputHistoryCurrent = _inputHistory.First; } else if (_inputHistoryCurrent.Next != null) { _inputHistoryCurrent = _inputHistoryCurrent.Next; } if (_inputHistoryCurrent != null) { _currentInput = _inputHistoryCurrent.Value; } } else if (Input.GetKeyDown(KeyCode.DownArrow)) { if (_inputHistoryCurrent != null && _inputHistoryCurrent.Previous != null) { _inputHistoryCurrent = _inputHistoryCurrent.Previous; } if (_inputHistoryCurrent != null) { _currentInput = _inputHistoryCurrent.Value; } } if (_isShown) { //_inputController.SetCharacterControl(false); } OCLogger.Fine(gameObject.name + " is updated."); }
/// <summary> /// Raises the disable event when Console goes out of scope. /// </summary> public void OnDisable() { OCLogger.Fine(gameObject.name + " is disabled."); }
/// <summary> /// Update is called once per frame. /// </summary> public void Update() { if (UnityEngine.Screen.showCursor) { return; } if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.LeftControl)) { Vector3i?point = GetCursor(false); if (point.HasValue) { byte sun = _map.GetSunLightmap().GetLight(point.Value); byte light = _map.GetLightmap().GetLight(point.Value); OCLogger.Info("Sun " + " " + sun + " Light " + light); } } if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.RightControl)) { Vector3i?point = GetCursor(true); if (point.HasValue) { byte sun = _map.GetSunLightmap().GetLight(point.Value); byte light = _map.GetLightmap().GetLight(point.Value); OCLogger.Info("Sun " + sun + " Light " + light); } } if (UnityEngine.Input.GetMouseButtonDown(0)) { Vector3i?point = GetCursor(true); if (point.HasValue) { _map.SetBlockAndRecompute(new OpenCog.Map.OCBlockData(), point.Value); } } if (UnityEngine.Input.GetMouseButtonDown(1)) { Vector3i?point = GetCursor(false); if (point.HasValue) { bool empty = !BlockCharacterCollision.GetContactBlockCharacter(point.Value, transform.position, gameObject.GetComponent <CharacterController>()).HasValue; if (empty) { OpenCog.Map.OCBlockData block = new OpenCog.Map.OCBlockData(_selectedBlock, OpenCog.Utility.VectorUtil.Vector3ToVector3i(point.Value)); block.SetDirection(GetDirection(-transform.forward)); _map.SetBlockAndRecompute(block, point.Value); } } } Vector3i?cursor = GetCursor(true); _cursor.SetActive(cursor.HasValue); if (cursor.HasValue) { _cursor.transform.position = cursor.Value; } OCLogger.Fine(gameObject.name + " is updated."); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- /// <summary> /// Called when the script instance is being loaded. /// </summary> public void Awake() { Initialize(); OCLogger.Fine(gameObject.name + " is awake."); }
/// <summary> /// Update is called once per frame. /// </summary> public void Update() { _reticuleTexture.pixelInset = new Rect(Screen.width / 2, Screen.height / 2, 16, 16); OCLogger.Fine(gameObject.name + " is updated."); }
/// <summary> /// Use this for initialization /// </summary> public void Start() { OCLogger.Fine(gameObject.name + " is started."); }
/// <summary> /// Update is called once per frame. /// </summary> public void Update() { if (UnityEngine.Screen.showCursor) { return; } if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.LeftControl)) { Vector3i?point = GetCursor(false); if (point.HasValue) { byte sun = _map.GetSunLightmap().GetLight(point.Value); byte light = _map.GetLightmap().GetLight(point.Value); OCLogger.Info("Sun " + " " + sun + " Light " + light); } } if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.RightControl)) { Vector3i?point = GetCursor(true); if (point.HasValue) { byte sun = _map.GetSunLightmap().GetLight(point.Value); byte light = _map.GetLightmap().GetLight(point.Value); OCLogger.Info("Sun " + sun + " Light " + light); } } if (UnityEngine.Input.GetMouseButtonDown(0)) { Vector3i?point = GetCursor(true); if (point.HasValue) { // Vector3i above = point.Value; // above.y += 1; // OCBlockData blockAbove = _map.GetBlock(above); // OCBlockData blockData = _map.GetBlock (point.Value); // if(blockAbove.IsEmpty() && !blockData.IsEmpty()) // { // _map.SetBlockAndRecompute(blockData, above); // _map.SetBlockAndRecompute(OCBlockData.CreateInstance<OCBlockData>().Init(null, point.Value), point.Value); // } // else _map.SetBlockAndRecompute(OCBlockData.CreateInstance <OCBlockData>().Init(null, point.Value), point.Value); } } if (UnityEngine.Input.GetMouseButtonDown(1)) { Vector3i?point = GetCursor(false); if (point.HasValue) { bool empty = !BlockCharacterCollision.GetContactBlockCharacter(point.Value, transform.position, gameObject.GetComponent <CharacterController>()).HasValue; if (empty) { OpenCog.Map.OCBlockData block = OCBlockData.CreateInstance <OCBlockData>().Init(_selectedBlock, OpenCog.Utility.VectorUtil.Vector3ToVector3i(point.Value)); block.SetDirection(GetDirection(-transform.forward)); _map.SetBlockAndRecompute(block, point.Value); OCGoalController[] goalControllers = (OCGoalController[])GameObject.FindObjectsOfType(typeof(OCGoalController)); foreach (OCGoalController goalController in goalControllers) { if (goalController.GoalBlockType == _selectedBlock) { Vector3 sourcePos = goalController.gameObject.transform.position; Vector3 oldDistanceVec = ((Vector3)goalController.GoalBlockPos) - sourcePos; Vector3 newDistanceVec = point.Value - sourcePos; if (newDistanceVec.sqrMagnitude < oldDistanceVec.sqrMagnitude) { goalController.GoalBlockPos = point.Value; goalController.MoveTargetsIfNecessary(); } } } } } } Vector3i?cursor = GetCursor(true); _cursor.SetActive(cursor.HasValue); if (cursor.HasValue) { _cursor.transform.position = cursor.Value; } OCLogger.Fine(gameObject.name + " is updated."); }
/// <summary> /// Raises the disable event when OCNetworkElement goes out of scope. /// </summary> public void OnDisable() { OCLogger.Fine(this.name + " is disabled."); }
/// <summary> /// Reset this instance to its default values. /// </summary> public void Reset() { Uninitialize(); Initialize(); OCLogger.Fine(this.name + " is reset."); }
/// <summary> /// Use this for initialization /// </summary> public void Start() { OCLogger.Fine(this.name + " is started."); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- /// <summary> /// Called when the script instance is being loaded. /// </summary> public void Awake() { Initialize(); OCLogger.Fine(this.name + " is awake."); }