public GameObject ManagerSpawn(SpawnableType s) { // TODO: Is this to make sure that the player has not yet landed // what if player lands on a different altitude? if (pod.transform.position.y > 2) { return _objectPools[s].GetPooledObject(); } return null; }
void SetInstances(int i) { SpawnableType spawnable = spawnables[i]; UnityEngine.Random.InitState(spawnable.seed); float3[] positions = new float3[spawnable.n]; for (int j = 0; j < spawnable.n; j++) { positions[j] = UnityEngine.Random.insideUnitSphere * spawnable.spawnRadius; } BillboardsManager.active.UpdatePositions(spawnable.billboardId, positions); }
public void QuickConstruct() { SpawnableType type = qCurrentCategory == 0 ? SpawnableType.Offence : qCurrentCategory == 1 ? SpawnableType.Defence : SpawnableType.Decoration; string spawnableName = qSpawnables.GetChild(qCurrentCategory).GetChild(qCurrentSpawnable).name; if (spawnableName == "FloatingPlatform") { PlatformSelected(); } else { ConstructionSelected(type, qSpawnables.GetChild(qCurrentCategory).GetChild(qCurrentSpawnable).name); } }
public void SpawnSpawnable(SpawnableType type, string id, Vector3 location, Quaternion rotation, EPlayerController owner) { Spawnable receivedBlueprint = GetBlueprint(type, id); //GameObject spawnedSpawnable = Instantiate(receivedBlueprint.prefab, location, rotation); GameObject spawnedSpawnable = PhotonNetwork.Instantiate(Path.Combine(receivedBlueprint.pathStrings), location, receivedBlueprint.isGridAligned?GetGridAlignedRotation(rotation):rotation, 0); spawnedSpawnable.GetComponent <SpawnableGO>().displayName = receivedBlueprint.displayName; if (spawnedSpawnable.GetComponent <SpawnableHealth>()) { spawnedSpawnable.GetComponent <SpawnableHealth>().InitiateSystems(receivedBlueprint.health); } if (spawnedSpawnable.GetComponent <DefensiveBase>()) { spawnedSpawnable.GetComponent <DefensiveBase>().SetOwner(owner); } }
private SpawnInfo(SpawnableType spawnableType, SpawnType spawnType, GameObject prefab, BaseClothData clothData, ClothingVariantType clothingVariantType, int clothingVariantIndex, Vector3 worldPosition, Transform parent, Quaternion rotation, float?scatterRadius, int count, Occupation occupation, GameObject clonedFrom = null, CharacterSettings characterSettings = null, bool naked = false, bool cancelIfImpassable = false) { SpawnableType = spawnableType; SpawnType = spawnType; PrefabUsed = prefab; ClothData = clothData; ClothingVariantType = clothingVariantType; ClothingVariantIndex = clothingVariantIndex; WorldPosition = worldPosition; Parent = parent; Rotation = rotation; ScatterRadius = scatterRadius; Count = count; Occupation = occupation; ClonedFrom = clonedFrom; CharacterSettings = characterSettings; Naked = naked; CancelIfImpassable = cancelIfImpassable; }
public void ConstructionSelected(SpawnableType type, string id) { Vector3 loc = Vector3.zero; Quaternion rot = Quaternion.identity; if (player.GetSpawnLocationAndRotation(out loc, out rot)) { if (gameObject.activeSelf) { player.ToggleConstructionMenu(); } Spawnable tSpawn = gameManager.GetBlueprint(type, id); if (tSpawn.constructionEnergyRequired < player.playerEnergy.GetEnergy()) { player.playerEnergy.SpendEnergy(tSpawn.constructionEnergyRequired); gameManager.SpawnSpawnable(type, id, loc, rot, player); } else { player.playerUI.DisplayAlertMessage("You don't have enough energy"); } } }
public Spawnable GetBlueprint(SpawnableType type, string id) { switch (type) { case SpawnableType.Offence: foreach (Spawnable curr in offensiveSpawnables) { if (curr.name == id) { return(curr); } } break; case SpawnableType.Defence: foreach (Spawnable curr in defensiveSpawnables) { if (curr.name == id) { return(curr); } } break; case SpawnableType.Decoration: foreach (Spawnable curr in decorativeSpawnables) { if (curr.name == id) { return(curr); } } break; } //return new Spawnable(); return(ScriptableObject.CreateInstance <Spawnable>()); }
private DevSpawnerDocument(string name, SpawnableType type) { Name = name; this.Type = type; }