private static SingleSpawn Parse(Packet packet)
        {
            SingleSpawn data = new SingleSpawn();

            try
            {
                uint objectID = packet.ReadUInt32();

                if (MediaData.Mobs.ContainsKey(objectID)) // object is mob
                {
                    Mob mob = MediaData.Mobs[objectID];

                    #region Mob Parsing
                    if (mob.Type.StartsWith("MOB"))
                    {
                        MobSpawn mobSpawned = ParseMobSpawned(packet);

                        data.Type = SpawnedType.Mob;
                        data.Mob  = mobSpawned;
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                Views.BindingFrom.WriteLine("[ERROR][0x3015][Single Spawn] " + ex.Message);
            }
            return(data);
        }
        public WaveSpawn(Wave wave, Action onWaveSpawned, Action onWaveFinished)
        {
            this.onWaveSpawned  = onWaveSpawned;
            this.onWaveFinished = onWaveFinished;

            int noSpawns = 0;

            foreach (var sw in wave.subwaves)
            {
                noSpawns += sw.numberOfUnits;
            }

            spawns = new SingleSpawn[noSpawns];
            int index = 0;

            foreach (var sw in wave.subwaves)
            {
                for (int i = 0; i < sw.numberOfUnits; ++i)
                {
                    spawns[index++] = new SingleSpawn()
                    {
                        unitId = sw.unitId, time = sw.spawnDelay + sw.spawnInterval * i, pathId = sw.pathId
                    }
                }
            }
            ;
            this.index   = 0;
            unitFinished = 0;

            Array.Sort(spawns);
        }
 private static void Share(SingleSpawn data)
 {
     if (data.Type == SpawnedType.Mob)
     {
         //Metadata.Globals.MobSpawns.Add(data.Mob);
         Globals.AddMob(data.Mob);
     }
 }
    public void Start()
    {
        spawner = gameObject.GetComponent <Spawner>();

        var baseSpawn = new SingleSpawn(new BulletSpawnPos(Vector2.zero, 0f, 1f, 0f));

        var pattern = new FanSpawn(baseSpawn, 12, 30f);

        spawner.Spawn(pattern, new Vector2(1, 1) * 3f, 0f);
        spawner.Spawn(pattern, new Vector2(1, -1) * 3f, 0f);
        spawner.Spawn(pattern, new Vector2(-1, 1) * 3f, 0f);
        spawner.Spawn(pattern, new Vector2(-1, -1) * 3f, 0f);
    }
    public void FillDelay(float delay)
    {
        SingleSpawn singleSpawn = this;

        base.Invoke(new Action(singleSpawn.Fill), delay);
    }