public void AddPoints(int pointsToAdd) { _points += pointsToAdd; if (Player.ByIndex(playerIndex).CurrentPoints() >= 1000) { GameController.EndGame(); } PlayerPointsBar.ResizeByIndex(this.playerIndex); }
public void SetPoints(int newPoints) { _points = newPoints; if (Player.ByIndex(playerIndex).CurrentPoints() >= 1000) { GameController.EndGame(); } PlayerPointsBar.ResizeByIndex(this.playerIndex); }
void Load() { if (!controllersInitialized && CursorController.loaded && VoxelController.instance) { Cursor cursor = CursorController.cursorMatrix[xPos][zPos]; print("cursor for " + unitName + ": " + cursor); loaded = true; GetComponent <ModelBehavior>().Load(); yPos = 0; SetTransformPosition(); controllersInitialized = true; animator = transform.Find("Body").Find("CharacterModel").GetComponent <Animator>(); SetTransformPosition(); transform.Find("Marker").GetComponent <Renderer>().material.color = Color.white; transform.Find("Body").Find("CharacterModel").Find("ArmLeft1").GetComponent <Renderer>().material.color = _color; transform.Find("Body").Find("CharacterModel").Find("ArmRight1").GetComponent <Renderer>().material.color = _color; transform.Find("Body").Find("CharacterModel").Find("Body1").GetComponent <Renderer>().material.color = _color; transform.parent = GameObject.Find("Units").transform; cursor.standingUnit = this; all.Add(this); GameObject pointsObject = Instantiate(pointsPrefab, Vector3.zero, Quaternion.identity); pointsObject.GetComponent <Points>().unit = this; PlayerPointsBar.ResizeByIndex(playerIndex); GameObject instance; ReflectCurrent(); } }