public void CreateUnit(UnitType unit, ProvinceIdentifier province) { Province mapProvince = _map.GetProvince(province.Province, province.Nation); // Get city location Vector2 cityPosition = mapProvince.center; GameObject soldierGO = Instantiate(_prefabProvider.GetUnitTransform(UnitPrefabType.BASIC_SOLDIER)).gameObject; soldierGO.transform.Rotate(Vector3.up, 180); GameObjectAnimator soldier = soldierGO.WMSK_MoveTo(cityPosition); soldier.autoRotation = false; soldier.terrainCapability = TERRAIN_CAPABILITY.OnlyGround; var guid = Guid.NewGuid(); // Set tank ownership soldier.attrib["player"] = 1; soldier.attrib["uuid"] = guid.ToString(); var createdUnit = _gameState.CreateUnit(new WorldMapGameUnit() { UnitType = unit, Guid = guid, Name = "SuccessfullyCreated!" }); soldierGO.GetComponent <GameUnitBehavior>().UnitAttributes = createdUnit; }
public void SpawnNewCountry(ProvinceIdentifier id, GameCountry newCountry) { Debug.Assert(id != null); Debug.Assert(newCountry != null); Debug.Log("Spawning new country " + newCountry.Name + " from province : " + id.Province); var formerProvince = _map.GetProvince(id.Province, id.Nation); _map.ProvinceToCountry(formerProvince, newCountry.Name); var newCountryIndex = _map.GetCountryIndex(_map.GetCountry(newCountry.Name)); //_map.ToggleCountryMainRegionSurface(newCountryIndex,true, _flagProvider.getFlag(newCountry.Flag)); }
public void TransferControlOfProvince(ProvinceIdentifier id, GameCountry newCountry) { Debug.Assert(id != null); Debug.Assert(newCountry != null); Debug.Log("Transferring control of province : " + id.Province); var province = _map.GetProvince(id.Province, id.Nation); var newCountryIndex = _map.GetCountryIndex(_map.GetCountry(newCountry.Name)); _map.CountryTransferProvinceRegion(newCountryIndex, province.mainRegion); //_map.ToggleCountryMainRegionSurface(newCountryIndex,true, _flagProvider.getFlag(newCountry.Flag)); //TODO: This graphical effect appears to be buggy. }