Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
    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);
        }
    }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
    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");
            }
        }
    }
Ejemplo n.º 7
0
    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>());
    }
Ejemplo n.º 8
0
 private DevSpawnerDocument(string name, SpawnableType type)
 {
     Name      = name;
     this.Type = type;
 }