void SpawnPlayer(MdlPlayer player) { var playerController = Instantiate(spore, transform); playerController.Init(player); controllers.Add(player.Id, playerController); }
public void AddExp() { MdlPlayer.AddCash(-FloorDataManager.GetFloorNextExpUpgradeCost(this)); Exp++; if (Exp >= FloorDataManager.FLOOR_MAX_EXP) { AddLvl(); Exp = 0; } }
public void Init(MdlPlayer mdlPlayer) { currentPlayer = mdlPlayer; text.text = mdlPlayer.Id; fullHp = currentPlayer.fullHp; currentPlayer.PlayerUpdated += MdlPlayerOnPlayerUpdated; currentPlayer.PlayerDamadged += Hit; }
private void CalculateMultipliedCash() { var baseCash = FloorDataManager.BaseCashOfFloor(_floor.Id); var lvlMultiplier = FloorDataManager.MultiplierOfLevel(_floor.Level); var expMultiplier = _floor.Level != 1 ? _floor.Level * FloorDataManager.FLOOR_MAX_EXP + _floor.Exp : _floor.Exp; var cash = baseCash * lvlMultiplier * expMultiplier; MdlPlayer.AddCash(cash); _owner.RebuildWidgets(); //RebuildWidget(); }
public void Init() { var floors = MdlPlayer.GetAllFloorsByCurrentTower(); //floors.Reverse(); var bottomBuildingPref = Resources.Load <GameObject>("Prefabs/Towers/Tower_1/Bottom"); var floorPref = Resources.Load <GameObject>("Prefabs/Towers/Tower_1/Floor"); var roofPref = Resources.Load <GameObject>("Prefabs/Towers/Tower_1/Roof"); Instantiate(bottomBuildingPref, FloorsGridParent); foreach (var floor in floors) { var go = Instantiate(floorPref, FloorsGridParent); go.transform.localScale = Vector3.one; go.SetActive(true); var goComp = go.GetComponent <FloorWidget>(); goComp.Init(floor, this); } Instantiate(roofPref, FloorsGridParent); }