Esempio n. 1
0
        public DmlObject Instantiate(Vector2 Position, DmlSystem system)
        {
            DmlBullet bullet = new DmlBullet(Position, this);
            DmlObject bulletObject = new DmlObject(DmlType.Bullet, bullet);
            bullet.SetObject(bulletObject);

            // Execute the initialziation code.
            Init.Execute(bulletObject, system);

            return bulletObject;
        }
Esempio n. 2
0
        public override void Initialize()
        {
            font = Globals.content.Load<SpriteFont>("smallfont");
            Mouse.SetPosition(Options.Resolutions.X / 2, Options.Resolutions.Y / 2);

            //song was paused before reaching here
            Globals.songPaused = false;
            //resets the wave so the next memblock is the first one
            Globals.wave.reset();
            //gets the Audio ready to play
            Globals.waveAudio = new Audio(Globals.wave, 250000);
            player = new Player("ship", new Vector2(Options.Resolutions.X / 2, Options.Resolutions.Y / 2), 8.5, 0);
            shipBullets = new List<ShipBullet>();
            DmlFileReader fileReader = new DmlFileReader(Globals.pathToCurrentMap);
            fileReader.Parse();

            system = (DmlSystem)fileReader.GetResult();
            system.Begin();
        }
Esempio n. 3
0
        public void Update(DmlSystem system)
        {
            // Append all the new timestamps to the currentlyActive list.
            while (Timestamps.Count > 0 && Timestamps[0].Start <= LocalTime)
            {
                currentlyActive.Add(Timestamps[0]);
                Timestamps.RemoveAt(0);
            }

            // Execute all the currently active Timestamps.
            foreach (DmlTimestamp timestamp in currentlyActive)
                if (timestamp.Active(LocalTime))
                    timestamp.Code.Execute(null, system);

            // Remove all the Timestamps whose times are up.
            currentlyActive.RemoveAll(t => t.End < LocalTime);

            LocalTime += Globals.deltaTime;
        }
Esempio n. 4
0
        public void Update(DmlSystem system)
        {
            factory.Update.Execute(bulletObj, system);
            LocalTime += Globals.deltaTime;
            position += Direction * (float)Speed;

            foreach (var component in Components)
                component.Update(this, system);

            Components.RemoveAll(c => c.Dead);
        }
Esempio n. 5
0
 public abstract void Update(DmlBullet bullet, DmlSystem system);