public void SelectSpaceshipOnShop(SpaceshipManager.SpaceshipType spaceshipType) { if (spaceshipType != null) { //Debug.Log("SelectSpaceshipOnShop [" + spaceshipType.typeName + "]"); selectedSpaceshipType = spaceshipType; if (ResourcesManager.instance.CanPayResourceAmounts(spaceshipType.resourceCosts) && SpaceshipManager.instance.HasAvailableFleetPointsNb(selectedSpaceshipType.fleetPointsNeeded)) { buySpaceshipButton.SetActive(true); EnableOnlyThisSpaceshipShopItemBorder(spaceshipType); } else { buySpaceshipButton.SetActive(false); DisableAllSpaceshipShopItemsBorder(); } } }
// Deprecated public void SpawnSpaceshipOfType(SpaceshipManager.SpaceshipType spaceshipType) { Debug.Log("SpawnSpaceshipOfType [" + spaceshipType.typeName + "]"); Vector2 randomCirclePos = Random.insideUnitCircle.normalized; Vector3 pos = transform.position + new Vector3(randomCirclePos.x * spawnRadius, randomCirclePos.y * spawnRadius, 0f); GameObject instantiatedSpaceship = Instantiate(spaceshipType.prefab, pos, Quaternion.Euler(0, 90, 0)); instantiatedSpaceship.transform.SetParent(SpaceshipManager.instance.spaceshipsParent); // Set attributes instantiatedSpaceship.GetComponent <Spaceship>().SetSpaceshipType(spaceshipType); instantiatedSpaceship.GetComponent <Spaceship>().homeSpaceport = gameObject; attachedSpaceships.Add(instantiatedSpaceship); SpaceshipManager.instance.AddAlliedSpaceshipToList(instantiatedSpaceship); //SpaceportInfoPanel.instance.ImportInfo(); }
public void EnableOnlyThisSpaceshipShopItemBorder(SpaceshipManager.SpaceshipType spaceshipType) { DisableAllSpaceshipShopItemsBorder(); spaceshipType.associatedSpaceshipShopItem.GetComponent <SpaceshipTypeShopPanel>().DisplayBorderPanel(true); }
public void SetAssociatedSpaceshipType(SpaceshipManager.SpaceshipType spaceshipType) { associatedSpaceshipType = spaceshipType; }
public void SetSpaceshipType(SpaceshipManager.SpaceshipType sType) { spaceshipType = sType; }