void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("chainsaw") == null) { return; } PointKeeper.addPoints(earnedPoints); }
// Use this for initialization public void SetUp(Faction.FactionType p_faction, int ID, GameObject bossObject) { //Set ID playerID = ID; localPlayerObject = bossObject; publicPlayerAttributes = bossObject.GetComponent <PlayerStatistics>(); //Create player UI pieces. 7 pieces. playerPieces = new PlayerPiece[] { Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>(), Instantiate(playerPeice).GetComponent <PlayerPiece>() }; //Set the faction and tell it to set up an income map. faction = Faction.GetNewFaction(p_faction); faction.SetUp(); //Setup playerPieces SetUpPieces(); //points pk = new PointKeeper(); publicPlayerAttributes.CmdSetPoints(20); //Shipping & terraform upgrade levels shipping = faction.GetDefaultShipping(); current_upgrade_terraform = 0; //Starting list of "built upon" coordinates is empty buildingLocs = new List <Coordinate>(); //Starting cult tracks cd = new CultData(faction.Get_Default_CultData()); publicPlayerAttributes.CmdSetCultStandings(cd.GetLevels()); //Setup UI to start with ui = GameObject.Find("UI").GetComponent <UI_Updater>(); ui.UpdatePlayerBuildingCosts(faction.Get_cost_build_dwelling(), faction.Get_cost_build_TP(), faction.Get_cost_build_temple(), faction.Get_cost_build_sanctuary(), faction.Get_cost_build_stronghold()); ui.UpdatePlayerCultText(cd); //Starting resources and income and update UI resources/income publicPlayerAttributes.CmdSetGold(faction.Starting_gold); publicPlayerAttributes.CmdSetWorkers(faction.Starting_worker); publicPlayerAttributes.CmdSetPriests(faction.Starting_priest); shovel_count = faction.Starting_shovels; CalculateIncome(); tierMagic = faction.GetDefaultMagic(); UpdateMagicPublicVariables(); PointsForTown = 7; //Update the UI after setting up all variables UpdateResourceText(); }
void UpdateData() { PointKeeper pk = LevelController.control.m_PointKeeper; for (int i = 0; i < 3; i++) { GameObject stars1_go = Utils.GetChildGO(gameObject, "Star" + (i + 1).ToString()); Utils.LoadSpriteIntoGO(pk.GetStarSpriteName(i), stars1_go); } DrawTextNearIcon("StopWatch", pk.TimeBonus.ToString()); DrawTextNearIcon("Bomb", pk.BombsSaved.ToString() + "/" + pk.BombsWas.ToString()); DrawTextNearIcon("Vase", pk.VaseSaved.ToString() + "/" + pk.VaseWas.ToString()); }
void DrawPointsText() { PointKeeper pk = LevelController.control.m_PointKeeper; GameObject stopwatch_go = Utils.GetChildGO(gameObject, "Star2"); SpriteRenderer sr = (SpriteRenderer)stopwatch_go.GetComponentInChildren(typeof(SpriteRenderer)); Vector3 anchor_p = new Vector3(sr.bounds.center.x, sr.bounds.max.y, 0.0f); GameObject score_text = new GameObject(); m_TextObjects.Add(score_text); score_text.name = "ScoreGUIText"; score_text.transform.position = Camera.main.WorldToViewportPoint(anchor_p); score_text.AddComponent <GUIText>(); score_text.guiText.color = Color.black; score_text.guiText.fontSize = 26; score_text.guiText.fontStyle = FontStyle.Bold; score_text.guiText.text = "Score: " + pk.Points.ToString(); score_text.guiText.anchor = TextAnchor.LowerCenter; score_text.guiText.pixelOffset = new Vector2(0, 10); }
// Private members -------------------------- void Init() { m_PointKeeper = new PointKeeper(); }