Created
October 6, 2017 06:56
-
-
Save AndrewWeston9/2b6a1c82182e71b5adf26e73578b2a18 to your computer and use it in GitHub Desktop.
PlayerMove.cs Snippet: functions for resource changes, communicating with PlayerState class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Current block type selected by the player to be placed. | |
int currentBlockType = 1; | |
/// Is the player flag placed in the world. | |
public bool playerFlagPlaced = false; | |
bool inTrigger = false; | |
GameObject flagShortest; | |
/// Timer for flag check | |
int flagTimer = 0; | |
bool checkFlagRangeLast = false; | |
PlayerState playerState; | |
public Animator anim; | |
public float speed = 2.0f; | |
public float rotationSpeed = 75.0f; | |
int timer = 0; | |
public List<float> resourceLevelsPMove; | |
/// Take Resources action. | |
if (Input.GetKeyDown (KeyCode.G) && !checkFlagRange()) | |
{ | |
PlayerState pstate = gameObject.GetComponent<PlayerState> (); | |
pstate.takeResource (); | |
//Debug.LogError ("Taking Resources from playermove!!!"); | |
} | |
public void adjustResource() | |
{ | |
playerState.expendResorce (currentBlockType, -0.1f); | |
} | |
public bool checkResource() | |
{ | |
if(playerState.getResource (currentBlockType) >= 0.1f) | |
{ | |
return true; | |
} | |
return false; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment