void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); BoostController = new BoostController(_boostView); MoneyController = new MoneyController(_moneyView, BoostController); ShopController = new ShopController(_listOfBoosts, _shopView); ManagerController = new ManagerController(_listOfManagers, _managerView); if (_useClearSavegame) { PlayerPrefs.SetFloat("money", 3000); } float oldMoney = PlayerPrefs.GetFloat("money"); MoneyController.AddMoney(oldMoney); }
void Update() { if (hp <= 0) { moneyController.AddMoney(moneyForDestruct); Destroy(gameObject); } }
const int COEFFICIENT = 2; // how much less money for the sale than for the purchase public void Sell() { GameObject curTower = refOnTower.currentTowerObj; float salePrice = curTower.GetComponent <AddiData>().currTowerPrice / COEFFICIENT; moneyController.AddMoney(salePrice); curTower.GetComponentInParent <TowerPlace>().CleanSocket(); Destroy(curTower); }
public async Task When_AddMoney_Then_ShouldReturn_Ok() { var fixture = new Fixture(); var moneyRequesDto = new MoneyRequesDto(); _moneyExchangeAppServiceMock.Setup(x => x.AddMoney(moneyRequesDto)); var moneyController = new MoneyController(_moneyExchangeAppServiceMock.Object); var result = await moneyController.AddMoney(moneyRequesDto); result.ShouldBeOfType <OkObjectResult>(); }
public void Refill() { TowerShootLogic towerShootLogic = refOnTower.currentTowerObj.GetComponent <TowerShootLogic>(); int dataNumBull = towerShootLogic.currNumBullets; if (moneyController.numMoney >= priceRefill) { towerShootLogic.RefillBullets(); } if (towerShootLogic.currNumBullets > dataNumBull) { moneyController.AddMoney(-priceRefill); } }
public void Instantiate() { playerMoneyController = GameObject.FindGameObjectWithTag("Player").GetComponent <MoneyController>(); if (playerMoneyController.numMoney >= price) { socket = gameObject.transform.parent.transform.parent.GetComponentInParent <SocketControl>().currentlySocket; // call place = socket.GetComponent <TowerPlace>(); place.InstantiateTower(prefab, speedRotation, damage, speedBullets, shootSpeed, numBullets, price); playerMoneyController.AddMoney(-price); } else { Debug.Log("no money"); } }
void Update() { Vector3 curMove = transform.position - previousPosition; curSpeed = curMove.magnitude / Time.deltaTime; previousPosition = transform.position; timer += Time.deltaTime; anim.SetFloat("Speed_f", curSpeed / 4); var isClosed = timeController.IsClosingTime(); switch (currentState) { case (customerState.entering): if (timer >= moveDelay && temp != null) { agent.SetDestination(temp.transform.position); currentState = customerState.browsing; } if (isClosed) { currentState = customerState.leaving; if (temp != null) { temp.GetComponent <BookshelfController>().setOccupid(false); } } break; case (customerState.browsing): dist = agent.remainingDistance; if (dist != Mathf.Infinity && agent.pathStatus == NavMeshPathStatus.PathComplete && agent.remainingDistance == 0) { agent.transform.rotation = (temp.GetComponent <BookshelfController>().transform.rotation); if (timer >= pickingBookDuration) { currentState = customerState.buying; temp.GetComponent <BookshelfController>().setOccupid(false); } } else { timer = 0.0f; } if (isClosed) { currentState = customerState.leaving; if (temp != null) { temp.GetComponent <BookshelfController>().setOccupid(false); } } break; case (customerState.buying): agent.SetDestination(cashierObject.transform.position); currentState = customerState.paying; break; case (customerState.paying): dist = agent.remainingDistance; if (dist != Mathf.Infinity && agent.pathStatus == NavMeshPathStatus.PathComplete && agent.remainingDistance <= 0.2) { if (timer >= buyingBookDuration) { currentState = customerState.leaving; moneyController.AddMoney(30); } } else { timer = 0.0f; } break; case (customerState.leaving): agent.SetDestination(exitTarget.transform.position); currentState = customerState.remove; break; case (customerState.remove): dist = agent.remainingDistance; if (dist != Mathf.Infinity && agent.pathStatus == NavMeshPathStatus.PathComplete && agent.remainingDistance <= 0.2) { Destroy(this.gameObject); customerSpawner.DecrementCustomerCount(); } break; case (customerState.standing): break; } }