} //end void Start() // custom overloaded constructor public void InitThis(GameObject p_PlayerEntity, int p_travelDistance) { //player entity m_PlayerEntity = p_PlayerEntity; //turn just started m_isInSelectPathToTakeState = true; //store orig position m_origPlayerPosition = p_PlayerEntity.transform.position; //how much can the player move m_initialTravelDist = p_travelDistance; m_currTravelDist = m_initialTravelDist; //resetDisplacement Value m_displacementVector = new Vector3(0.0f, 0.0f, 0.0f); // Player character script. m_playerCharacterScript = m_PlayerEntity.GetComponent <GSP.Char.Character>(); // Generate the initial set of highlight objects. Highlight.GenerateHighlight(m_origPlayerPosition, m_currTravelDist); //movement script } //end public void InitThis()
} //end OnGUI() private void GUIMovementPads() { int width = 32; int height = 32; int gridXShift = -8; int gridYShift = -8; //Button color GUI.backgroundColor = Color.red; if (m_currTravelDist > 0) { //left if (GUI.Button(new Rect((Screen.width - (3 * width) + gridXShift), (Screen.height - (2 * height) + gridYShift), width, height), "<")) { m_displacementVector = m_MovementScript.MoveLeft(m_PlayerEntity.transform.position); //uncomment this and comment above when Brents Movement class is ready m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.WEST); // Face the character to the west which is to the left. MovePlayer(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_PlayerEntity.transform.position, m_currTravelDist); // Recreate the highlights with the new values. audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWalking); //Play walking sound } //right if (GUI.Button(new Rect((Screen.width - (1 * width) + gridXShift), (Screen.height - (2 * height) + gridYShift), width, height), ">")) { m_displacementVector = m_MovementScript.MoveRight(m_PlayerEntity.transform.position); //uncomment this and comment above when Brents Movement class is ready m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.EAST); // Face the character to the east which is to the right. MovePlayer(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_PlayerEntity.transform.position, m_currTravelDist); // Recreate the highlights with the new values. audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWalking); //Play walking sound } //cancel if (GUI.Button(new Rect((Screen.width - (2 * width) + gridXShift), (Screen.height - (2 * height) + gridYShift), width, height), "X")) { m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.SOUTH); // Face the character to the south which is to the left. This is the default facing. //MOVE BACK TO ORIG POSITION CancelMove(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_origPlayerPosition, m_currTravelDist); // Recreate the highlights with the new values. audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWalking); //Play walking sound } //up if (GUI.Button(new Rect((Screen.width - (2 * width) + gridXShift), (Screen.height - (3 * height) + gridYShift), width, height), "^")) { m_displacementVector = m_MovementScript.MoveUp(m_PlayerEntity.transform.position); //uncomment this and comment above when Brents Movement class is ready m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.NORTH); // Face the character to the north which is up. MovePlayer(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_PlayerEntity.transform.position, m_currTravelDist); // Recreate the highlights with the new values. audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWalking); //Play walking sound } //down if (GUI.Button(new Rect((Screen.width - (2 * width) + gridXShift), (Screen.height - (1 * height) + gridYShift), width, height), "v")) { m_displacementVector = m_MovementScript.MoveDown(m_PlayerEntity.transform.position); //uncomment this and comment above when Brents Movement class is ready m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.SOUTH); // Face the character to the south which is down. MovePlayer(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_PlayerEntity.transform.position, m_currTravelDist); // Recreate the highlights with the new values. audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWalking); //Play walking sound } } //end if( m_currDistTravel > 0 ) else { if (GUI.Button(new Rect((Screen.width - (2 * width) + gridXShift), (Screen.height - (2 * height) + gridYShift), width, height), "X")) { m_playerCharacterScript.Face(GSP.Char.Character.FacingDirection.SOUTH); // Face the character to the south which is to the left. This is the default facing. //TODO: CANCEL MOVE, MOVE BACK TO ORIG POSITION CancelMove(); Highlight.ClearHightlight(); // Clear the highlight objects. Highlight.GenerateHighlight(m_origPlayerPosition, m_currTravelDist); // Recreate the highlights with the new values. } //display travel distance is 0 GUI.Box(new Rect((Screen.width - (3 * width) + gridXShift), (Screen.height - (3 * height) + gridYShift), 3 * width, height), "Out of Distance."); } } //private void GUIMovementPads()