void SpawnEnemy(int enemyNumber) { Transform enemy; enemy = Instantiate(prefabs[enemyNumber], new Vector3(spawner.position.x, spawner.position.y - 7.5f, spawner.position.z), spawner.rotation); k = enemy.GetComponent <Enemy>(); k.getPlayer(player); kk = enemy.GetComponent <HeyImWalkingHere>(); kk.getPlayer(player); }
public void BuyEnemy(int enemyNumber) { if (player.money >= enemyPrices[enemyNumber]) { Transform enemy; enemy = Instantiate(prefabs[enemyNumber], spawnerP2.position, spawnerP2.rotation); k = enemy.GetComponent <Enemy>(); k.getPlayer(player2); kk = enemy.GetComponent <HeyImWalkingHere>(); kk.getPlayer(player2); player.incomeMoney(-enemyPrices[enemyNumber]); } else { errorMsgScript errMsg = errorMsgs.GetComponent <errorMsgScript>(); errMsg.NotEnoughMoney(); Debug.Log("neuzteko pinigu fermai"); } }