private void SetMushrooms(GameObject shrooms, ShroomPool.ShroomType[] shroomList, int posIndex)
 {
     foreach (ShroomPool.ShroomType shroom in shroomList)
     {
         GameObject          newShroom = (GameObject)Instantiate(Resources.Load("Obstacles/Mushroom"), shrooms.transform);
         Spawnable.SpawnType spawnTf   = shroom.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newShroom.GetComponent <Mushroom>().SetTransform(newShroom.transform, spawnTf);
     }
 }
Esempio n. 2
0
 public void SetupStalactitesInList(StalType[] stalList, float xOffset)
 {
     foreach (StalType stal in stalList)
     {
         Stalactite          newStal = GetNextObject();
         Spawnable.SpawnType spawnTf = stal.SpawnTranform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newStal.Activate(spawnTf, stal.DropEnabled, stal.TriggerPos, xOffset);
     }
 }
Esempio n. 3
0
 public void SetupTriggersInList(TriggerType[] triggerList, float xOffset)
 {
     foreach (TriggerType trigger in triggerList)
     {
         TriggerClass        newTrigger = GetNextObject();
         Spawnable.SpawnType spawnTf    = trigger.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newTrigger.Activate(trigger, spawnTf);
     }
 }
Esempio n. 4
0
 public void SetupMothsInList(MothType[] mothList, float xOffset)
 {
     foreach (MothType moth in mothList)
     {
         Moth newMoth = GetNextObject();
         Spawnable.SpawnType spawnTf = moth.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newMoth.Activate(spawnTf, moth.Colour, moth.PathType);
     }
 }
Esempio n. 5
0
 public void SetupMushroomsInList(ShroomType[] shroomList, float xOffset)
 {
     foreach (ShroomType shroom in shroomList)
     {
         Spawnable.SpawnType spawnTf = shroom.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         Mushroom mushroom = GetNextObject();
         mushroom.Activate(spawnTf);
     }
 }
Esempio n. 6
0
 public void SetupWebsInList(WebType[] webList, float xOffset)
 {
     foreach (WebType web in webList)
     {
         WebClass            newWeb  = GetNextObject();
         Spawnable.SpawnType spawnTf = web.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newWeb.Activate(spawnTf, web.SpecialWeb);
     }
 }
Esempio n. 7
0
 public void SetupObjectsInList(NpcType[] npcList, float xOffset)
 {
     foreach (NpcType npc in npcList)
     {
         NPC newNpc = GetNextObject();
         Spawnable.SpawnType spawnTf = npc.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newNpc.Activate(spawnTf, npc.Type);
     }
 }
Esempio n. 8
0
 public void SetupSpidersInList(SpiderType[] spiderList, float xOffset)
 {
     foreach (SpiderType spider in spiderList)
     {
         SpiderClass         newSpider = GetNextObject();
         Spawnable.SpawnType spawnTf   = spider.SpawnTransform;
         spawnTf.Pos += new Vector2(xOffset, 0f);
         newSpider.Activate(spawnTf, spider.SpiderSwings);
     }
 }
    private Spawnable.SpawnType ProduceSpawnTf(Transform objTf, int index)
    {
        var spawnTf = new Spawnable.SpawnType
        {
            Pos      = new Vector2(objTf.position.x - _tileSizeX * index, objTf.position.y),
            Scale    = objTf.localScale,
            Rotation = objTf.localRotation
        };

        return(spawnTf);
    }
 private void SetMoths(GameObject moths, MothPool.MothType[] mothList, int posIndex)
 {
     foreach (MothPool.MothType moth in mothList)
     {
         GameObject          newMoth = (GameObject)Instantiate(Resources.Load("Collectibles/Moth"), moths.transform);
         Spawnable.SpawnType spawnTf = moth.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newMoth.GetComponent <Moth>().SetTransform(newMoth.transform, spawnTf);
         newMoth.GetComponent <Moth>().Colour   = moth.Colour;
         newMoth.GetComponent <Moth>().PathType = moth.PathType;
     }
 }
Esempio n. 11
0
    private void ActivateStal(int index)
    {
        const float startY = 10f;

        Spawnable.SpawnType spawnTf = new Spawnable.SpawnType
        {
            Pos      = new Vector2(_playerTf.position.x, startY),
            Rotation = new Quaternion(),
            Scale    = Vector2.one
        };
        _stals[index].Activate(spawnTf, false, Vector2.zero);
    }
Esempio n. 12
0
    /// <summary>
    /// Moth activation used in stationary levels e.g. Boss fights
    /// </summary>
    public void ActivateMothInRange(float minY, float maxY, Moth.MothColour colour)
    {
        Moth  newMoth = GetNextObject();
        float xPos    = 10f + GameObject.FindGameObjectWithTag("MainCamera").transform.position.x;
        var   spawnTf = new Spawnable.SpawnType
        {
            Pos      = new Vector2(xPos, Random.Range(minY, maxY)),
            Rotation = new Quaternion(),
            Scale    = Vector2.one
        };

        newMoth.Activate(spawnTf, colour, MothPathHandler.MothPathTypes.Sine);
    }
 private void SetNpcs(NPCPool.NpcType[] npcList, int posIndex)
 {
     if (npcList == null)
     {
         return;
     }
     foreach (NPCPool.NpcType npc in npcList)
     {
         GameObject          newNpc  = (GameObject)Instantiate(Resources.Load("NPCs/Nomee"), _npcParent);
         Spawnable.SpawnType spawnTf = npc.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newNpc.GetComponent <NPC>().SetTransform(newNpc.transform, spawnTf);
     }
 }
Esempio n. 14
0
    public void ActivateMothFromEssence(Vector2 spawnLoc, Moth.MothColour colour, float despawnTimer)
    {
        Moth newMoth = GetNextObject();

        spawnLoc += new Vector2(GameObject.FindGameObjectWithTag("MainCamera").transform.position.x, 0f);
        var spawnTf = new Spawnable.SpawnType
        {
            Pos      = spawnLoc,
            Rotation = new Quaternion(),
            Scale    = Vector2.one
        };

        newMoth.Activate(spawnTf, colour, MothPathHandler.MothPathTypes.Clover);
        newMoth.StartCoroutine("SpawnFromEssence", despawnTimer);
    }
 private void SetWebs(GameObject webs, WebPool.WebType[] webList, int posIndex)
 {
     if (webList == null)
     {
         return;
     }
     foreach (WebPool.WebType web in webList)
     {
         GameObject          newWeb  = (GameObject)Instantiate(Resources.Load("Obstacles/Web"), webs.transform);
         Spawnable.SpawnType spawnTf = web.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newWeb.GetComponent <WebClass>().SetTransform(newWeb.transform, spawnTf);
         newWeb.GetComponent <WebClass>().SpecialWeb = web.SpecialWeb;
     }
 }
 private void SetSpiders(GameObject spiders, SpiderPool.SpiderType[] spiderList, int posIndex)
 {
     if (spiderList == null)
     {
         return;
     }
     foreach (SpiderPool.SpiderType spider in spiderList)
     {
         GameObject          newSpider = (GameObject)Instantiate(Resources.Load("Obstacles/Spider"), spiders.transform);
         Spawnable.SpawnType spawnTf   = spider.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newSpider.GetComponent <SpiderClass>().SetTransform(newSpider.transform, spawnTf);
         newSpider.GetComponent <SpiderClass>().SwingingSpider = spider.SpiderSwings;
     }
 }
 private void SetTriggers(GameObject triggers, TriggerHandler.TriggerType[] triggerList, int posIndex)
 {
     if (triggerList == null)
     {
         return;
     }
     foreach (TriggerHandler.TriggerType trigger in triggerList)
     {
         GameObject          newTrigger = (GameObject)Instantiate(Resources.Load("Interactables/Trigger"), triggers.transform);
         Spawnable.SpawnType spawnTf    = trigger.SpawnTransform;
         spawnTf.Pos += new Vector2(posIndex * _tileSizeX, 0f);
         newTrigger.GetComponent <TriggerClass>().SetTransform(newTrigger.transform, spawnTf);
         newTrigger.GetComponent <TriggerClass>().EventId    = trigger.EventId;
         newTrigger.GetComponent <TriggerClass>().EventType  = trigger.EventType;
         newTrigger.GetComponent <TriggerClass>().PausesGame = trigger.PausesGame;
     }
 }