public TroopInfo GetTroopInfo(eTroopType type, eCountry country) { foreach (TroopInfo ti in troopList) { if (ti.type == type && ti.country == country) { return(ti); } } return(null); }
public int GetTroopPrice(eTroopType type) { switch (type) { case eTroopType.rock: return(GameDef.BASE_TROOP_COST + rockPriceOffset); case eTroopType.paper: return(GameDef.BASE_TROOP_COST + paperPriceOffset); case eTroopType.scissors: return(GameDef.BASE_TROOP_COST + scissorPriceOffset); default: break; } return(0); }
public void MakeTroop(eTroopType type, eCountry country, int x, int y) { TroopInfo ti = troopData.GetTroopInfo(type, country); GameObject troopGo = Instantiate(ti.prefab, transform); troopGo.transform.localPosition = GridToPosition(x, y); Troop t = troopGo.GetComponent <Troop>(); t.type = type; t.country = country; t.x = x; t.y = y; t.SetTapCallback(onTapTroop); t.sortingGroup.sortingOrder = GetTroopOrder(x, y); t.FINISH_ACTION = true; mapTiles[x + "_" + y].troop = t; }
// 建造部队 private void onMakeTroop(eTroopType troopType, eCountry country, int x, int y) { view.MakeTroop(troopType, country, x, y); }