//Show unit info when cursor is over (bottom right panel) public void ShowUnitInfo(int unitId) { UnitDatabase currentUnit = units[unitId]; descriptionInfo.SetActive(true); descriptionUnitName.text = currentUnit.unitName; goldCost.text = currentUnit.goldCost.ToString(); woodCost.text = currentUnit.woodCost.ToString(); foodCost.text = currentUnit.foodCost.ToString(); descriptionText.text = currentUnit.description; }
//Abort unit creation (bottom left panel) public void AbortDeploy(int queueId, int player) { UnitDatabase unitData = units[players[player].queueUnits[queueId].id]; players[player].gold += unitData.goldCost; players[player].wood += unitData.woodCost; players[player].food += unitData.foodCost; UpdateResources(player); players[player].queueUnits.RemoveAt(queueId); abortDeploy[player] = false; UpdateQueuePanel(player); UpdateDeployableFrames(player); }
public UnitInstance(int newGuid, int newOwner, GameObject newUnitObject, NavMeshAgent newAgent, Animator newAnim, UnitDatabase newUnit) { guid = newGuid; owner = newOwner; unitObject = newUnitObject; navAgent = newAgent; anim = newAnim; id = newUnit.id; unitName = newUnit.unitName; currentHP = newUnit.maxHP; maxHP = newUnit.maxHP; attack = newUnit.attack; defense = newUnit.defense; canAttack = newUnit.canAttack; attackRange = newUnit.attackRange; target = -1; }