/// <summary> /// Creates a tank instance and adds it to specified city /// </summary> void DropTankOnCity() { // Get a random big city int cityIndex = map.GetCityIndex("Paris", "France"); // Get city location Vector2 cityPosition = map.cities [cityIndex].unity2DLocation; GameObject tankGO = Instantiate(Resources.Load <GameObject> ("Tank/CompleteTank")); tank = tankGO.WMSK_MoveTo(cityPosition); tank.autoRotation = true; tank.terrainCapability = TERRAIN_CAPABILITY.OnlyGround; // Set tank ownership tank.attrib["player"] = 1; }
/// <summary> /// Creates a tank instance and adds it to specified city /// </summary> void DropTankOnCity() { // Get a random big city int cityIndex = map.GetCityIndex("Lhasa", "China"); // Get city location Vector2 cityPosition = map.cities [cityIndex].unity2DLocation; if (tank != null) { DestroyImmediate(tank); } GameObject tankGO = Instantiate(Resources.Load <GameObject> ("Tank/CompleteTank")); tank = tankGO.WMSK_MoveTo(cityPosition); tank.type = (int)UNIT_TYPE.TANK; tank.autoRotation = true; tank.terrainCapability = TERRAIN_CAPABILITY.OnlyGround; // Zoom into tank map.FlyToLocation(cityPosition, 2.0f, 0.15f); }
/// <summary> /// Creates a tank instance and adds it to specified city /// </summary> void DropTankOnCity() { // Get a random big city int cityIndex = map.GetCityIndex("Paris", "France"); // Get city location Vector2 cityPosition = map.cities [cityIndex].unity2DLocation; if (tank != null) { DestroyImmediate(tank.gameObject); } tank = DropTankOnPosition(cityPosition); // Zoom into tank map.FlyToLocation(cityPosition, 2.0f, 0.15f); // Enable move on click in this demo enableAddTowerOnClick = false; enableClickToMoveShip = false; enableClickToMoveTank = true; }