public SoldierAsset CreateAsset() { SoldierAsset asset = ScriptableObject.CreateInstance <SoldierAsset>(); asset.unitSoldier = new Soldier(); asset.unitSoldier.CreateUnit(health, strength, speed, defense, cost, customObject); return(asset); }
public void OnCustomUnitClick(UnitUICustomStats customUnit) { SoldierAsset sa = customUnit.CreateAsset(); if (PlayerManager.instance.playerCurrentTurn.playerMoney >= sa.unitSoldier.cost) { NavigaTo(CanvasNavigation.none); placementUnit.selectSoldier = sa; } }
public void SpawnUnit(Vector3 point, bool nextTurn) { Vector3 spawnHeight = new Vector3(0, 2, 0); GameObject spawnUnit = Instantiate(selectSoldier.unitSoldier.objectMesh, point + spawnHeight, Quaternion.identity) as GameObject; spawnUnit.AddComponent <Character>().init(selectSoldier.unitSoldier, GameManager.instance.isPlayerBlue, PlayerManager.instance.playerCurrentTurn.playerGameObject.Count); spawnUnit.transform.parent = PlayerManager.instance.playerCurrentTurn.playerHome; PlayerManager.instance.playerCurrentTurn.playerGameObject.Add(spawnUnit); PlayerManager.instance.playerCurrentTurn.playerMoney -= selectSoldier.unitSoldier.cost; //PlayerManager.instance.playerRed[0].playerNormalStats.name = "hello";; selectSoldier = null; if (nextTurn) { GameControl.instance.NextPlayerPrepare(); } }