Exemplo n.º 1
0
    protected override void Spawn()
    {
        GameObject       myObject;
        SaveableResource saveable      = spawnQueue[queueIndex].GetComponent <SaveableResource>();
        Vector3          spawnPosition = spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position;

        if (saveable != null)
        {
            myObject = SaveableResource.InstantiateSaveableResource(saveable, spawnPosition, Quaternion.identity).gameObject;
        }
        else
        {
            myObject = Instantiate(spawnQueue[queueIndex], spawnPosition, Quaternion.identity);
        }

        StateController stateController = myObject.GetComponent <StateController>();

        if (stateController)
        {
            stateController.target = system.aiTarget;
        }

        queueIndex += 1;
        myObject.AddComponent <SpawnableObject>().spawner = this;
        SubscribeObject(myObject);
        spawnQueueReady = false;
    }
Exemplo n.º 2
0
    // Instantiate Saveable Resource methods
    public static SaveableResource InstantiateSaveableResource(SaveableResource obj)
    {
        SaveableResource myObject = Instantiate(obj);

        // myObject.instantiated = true;
        myObject.SubscribeManager();

        return(myObject);
    }
Exemplo n.º 3
0
    public static SaveableResource InstantiateSaveableResource(SaveableResource obj, Vector3 position, Quaternion rotation, Transform parent)
    {
        SaveableResource myObject = Instantiate(obj, position, rotation, parent);

        // myObject.instantiated = true;
        myObject.SubscribeManager();

        return(myObject);
    }
Exemplo n.º 4
0
    public static SaveableResource InstantiateSaveableResource(SaveableResource obj, Transform parent, bool instantiateInWorldSpace)
    {
        SaveableResource myObject = Instantiate(obj, parent, instantiateInWorldSpace);

        // myObject.instantiated = true;
        myObject.SubscribeManager();

        return(myObject);
    }
Exemplo n.º 5
0
    protected override void Spawn()
    {
        GameObject       myObject;
        SaveableResource saveable = spawnObject.GetComponent <SaveableResource>();

        if (saveable != null)
        {
            myObject = SaveableResource.InstantiateSaveableResource(saveable, RandomPointContstant(transform.position, (int)spawnRadius * 1000), Quaternion.identity).gameObject;
        }
        else
        {
            myObject = Instantiate(spawnObject, RandomPointContstant(transform.position, (int)spawnRadius * 1000), Quaternion.identity);
        }
        myObject.AddComponent <SpawnableObject>().spawner = this;
        SubscribeObject(myObject);
        spawnQueueReady = false;
    }