Пример #1
0
 public PointGroup()
 {
     // mID = inID;
     mBundleID    = 0;
     mSpawnChance = 100;
     mPoints      = new List <PointInfo>();
     mSpawnType   = eSpawnType.None;
     mCurveType   = eCurveType.Linear;
 }
Пример #2
0
    //=====================================================

    private static void AddSpawnPointOfType(eSpawnType type)
    {
        Object pfb;

        if (type != eSpawnType.RESPAWN)
        {
            pfb = ResourcesDoors.GetSpawnPointPrefab();
        }
        else
        {
            pfb = ResourcesDoors.GetRespawnPointPrefab();
        }

        if (pfb == null)
        {
            return;
        }

        // Create containers for collectables if they don't already exist
        var container      = GameObject.Find("SpawnPoints");
        var sceneStart     = GameObject.Find("SceneStarts");
        var respawn        = GameObject.Find("Respawns");
        var crawlThrough   = GameObject.Find("CrawlTroughs");
        var oblivionPortal = GameObject.Find("OblivionPortals");

        if (container == null)
        {
            container = CreateContainer("SpawnPoints");

            if (sceneStart == null)
            {
                sceneStart = CreateContainer("SceneStarts", container);
            }

            if (respawn == null)
            {
                respawn = CreateContainer("Respawns", container);
            }

            if (crawlThrough == null)
            {
                crawlThrough = CreateContainer("CrawlTroughs", container);
            }

            if (oblivionPortal == null)
            {
                oblivionPortal = CreateContainer("OblivionPortals", container);
            }
        }

        var prefab = PrefabUtility.InstantiatePrefab(pfb) as GameObject;

        if (prefab == null)
        {
            return;
        }

        var script = prefab.GetComponent <SpawnPoint>();

        switch (type)
        {
        case eSpawnType.SCENE_START:
            prefab.name             = "SpawnStart";
            prefab.transform.parent = sceneStart.transform;
            break;

        case eSpawnType.RESPAWN:
            prefab.name             = "Respawn";
            prefab.transform.parent = respawn.transform;
            break;

        case eSpawnType.CRAWL_THROUGH:
            prefab.name             = "SpawnCrawl";
            prefab.transform.parent = crawlThrough.transform;
            break;

        case eSpawnType.OBLIVION_PORTAL:
            prefab.name             = "SpawnPortal";
            prefab.transform.parent = oblivionPortal.transform;
            break;
        }

        if (script != null)
        {
            script.Type = type;
        }

        PositionObjectAndSelect(prefab);
    }