Exemplo n.º 1
0
        public Player(PlayerID _id)
        {
            lives = 4;
            id = _id;
            createLives(id);

            state = PlayerState.alive;

            emptySprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.box);

            if (_id == PlayerID.one)
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                             ImageManager.Instance().getImage(ImageEnum.bluebomb1), false);
                missileType = GameObjType.p1missiles;
            }
            else
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                             ImageManager.Instance().getImage(ImageEnum.greenbomb1), false);
                missileType = GameObjType.p2missiles;
            }

            bombSpriteIndex = 5;
            numMissiles = 0;
        }
Exemplo n.º 2
0
        public void Set(GameObject _obj)
        {
            base.Initialize();

            this.gameObj = _obj;
            this.type = _obj.type;
        }
Exemplo n.º 3
0
        public Player(PlayerID _id)
        {
            lives = 4;
            id    = _id;
            createLives(id);

            state = PlayerState.alive;

            emptySprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.box);

            if (_id == PlayerID.one)
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                                        ImageManager.Instance().getImage(ImageEnum.bluebomb1), false);
                missileType = GameObjType.p1missiles;
            }
            else
            {
                bombSprite = new Sprite(SpriteEnum.Bomb, 0, 0, 50, 50, true, 0,
                                        ImageManager.Instance().getImage(ImageEnum.greenbomb1), false);
                missileType = GameObjType.p2missiles;
            }

            bombSpriteIndex = 5;
            numMissiles     = 3;
        }
Exemplo n.º 4
0
        public Ship(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type = _type;
            spriteRef = _spriteRef;

            waveBank = WaveBankManager.WaveBank();
            soundBank = SoundBankManager.SoundBank();
        }
Exemplo n.º 5
0
        public Ship(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type      = _type;
            spriteRef = _spriteRef;


            waveBank  = WaveBankManager.WaveBank();
            soundBank = SoundBankManager.SoundBank();
        }
Exemplo n.º 6
0
        public Wall(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type      = _type;
            spriteRef = _spriteRef;

            anim = new Animation(spriteRef.sprite);

            setUpAnimation();

            soundBank = SoundBankManager.SoundBank();
            waveBank  = WaveBankManager.WaveBank();
        }
Exemplo n.º 7
0
        public Wall(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type = _type;
            spriteRef = _spriteRef;

            anim = new Animation(spriteRef.sprite);

            setUpAnimation();

            soundBank = SoundBankManager.SoundBank();
            waveBank = WaveBankManager.WaveBank();
        }
Exemplo n.º 8
0
        public void pushPhysics(float rot, Vector2 loc, GameObjType type)
        {
            GameObjType goType = type;

            LocationHdr hdr;
            hdr.goIndex = this.indexNum;
            hdr.position = loc;
            hdr.rotation = rot;

            hdr.networked = false;

            OutputQueue.pushHeader(ref hdr);
            //rotation = rot;
            //location = loc;
        }
Exemplo n.º 9
0
        public Bomb(GameObjType _type, PlayerID _owner, Ship s)
        {
            type = _type;

            createBomb(_owner, s);

            owner = _owner;

            soundBank = SoundBankManager.SoundBank();
            waveBank = WaveBankManager.WaveBank();

            playBombLaySound();

            armBomb();
        }
Exemplo n.º 10
0
        public Missile(GameObjType _type, Sprite_Proxy _spriteRef, PlayerID _owner)
        {
            type = _type;

            spriteRef = _spriteRef;

            objSpeed = new Vector2(0, -15);

            soundBank = SoundBankManager.SoundBank();
            waveBank  = WaveBankManager.WaveBank();

            owner = _owner;

            playFireSound();
        }
Exemplo n.º 11
0
        public Missile(GameObjType _type, Sprite_Proxy _spriteRef, PlayerID _owner)
        {
            type = _type;

            spriteRef = _spriteRef;

            objSpeed = new Vector2(0, -15);

            soundBank = SoundBankManager.SoundBank();
            waveBank = WaveBankManager.WaveBank();

            owner = _owner;

            playFireSound();
        }
Exemplo n.º 12
0
        public Bomb(GameObjType _type, PlayerID _owner, Ship s)
        {
            type = _type;

            createBomb(_owner, s);

            owner = _owner;

            soundBank = SoundBankManager.SoundBank();
            waveBank  = WaveBankManager.WaveBank();

            playBombLaySound();

            armBomb();
        }
Exemplo n.º 13
0
        // --------------------------------------------------------------- IsInHazard
        bool IsInHazard(Ball ball, GameObjType hazard)
        {
            bool result = false;

            Array.ForEach(holeGeometry.Hazards, (Hazard h) =>
            {
                var d = GetDistance(new Point(ball.X, ball.Y), new Point(h.X, h.Y));
                if ((d < h.Radius) && h.Type == hazard)
                {
                    result = true;
                }
                ;
            });
            return(result);
        }
Exemplo n.º 14
0
        public GameObject find(GameObjType type)
        {
            ManLink mLink = this.active;

            while (mLink != null)
            {
                if (mLink.getName().Equals(type))
                {
                    break;
                }

                mLink = mLink.next;
            }

            if (mLink != null)
                return ((GameObjNode)mLink).gameObj;
            else
                return null;
        }
Exemplo n.º 15
0
 public FencePost(GameObjType _type, Sprite_Proxy _spriteRef)
 {
     type = _type;
     spriteRef = _spriteRef;
 }
Exemplo n.º 16
0
 public FencePost(GameObjType _type, Sprite_Proxy _spriteRef)
 {
     type      = _type;
     spriteRef = _spriteRef;
 }
Exemplo n.º 17
0
        /// <summary>
        /// Create a game object and add it to the object registry
        /// </summary>
        /// <param name="type">Type of object to be created</param>
        /// <param name="args">Args for object constructor. Refer to comments</param>
        public GameObject CreateGameObject(GameObjType type, params object[] args)
        {
            // Untyped resultant variable
            GameObject result = null;

            switch (type)
            {
            case GameObjType.pc:
                result = new Actor(ActorType.pc);       // ActorType player character
                break;

            // Reserved
            case GameObjType.npc:
                result = new Actor(ActorType.npc);      // ActorType bot character
                break;

            case GameObjType.bullet:
                result = new Bullet(
                    (Vector2)args[0],           // Vector2 source position
                    (float)args[1]              // float rotation
                    );
                Shoot = result as Bullet;       // One bullet exists at a time
                break;

            case GameObjType.celestialObj:
                result = new CelestialObject(
                    (CelesObjType)args[0],      // CelesObjectType type of star
                    (float)args[1],             // float mass
                    (float)args[2]              // float size
                    );
                break;

            // Params:
            case GameObjType.orbital:
                result = new Orbital(
                    (Vector2)args[0],           // Vector2 position
                    (float)args[1],             // float rotation
                    (float)args[2],             // float angular velocity
                    (ParticleBase)args[3],      // ParticleBase base for type of orbital
                    (int)args[4]                // int Orbital rotation rate
                    );
                Orbs.Add(result as Orbital);
                break;

            case GameObjType.particle:
                result = new Particle(
                    (Vector2)args[0],           // Vector2 position
                    (Vector2)args[1],           // Vector2 velocity
                    (float)args[2],             // float rotation
                    (float)args[3],             // float angular velocity
                    (int)args[4],               // int time to live
                    (ParticleBase)args[5]       // ParticleBase base for type of particle
                    );
                break;

            case GameObjType.galaxy:            // Params: nil
                result = new Galaxy();
                break;
            }

            // Add to object registry
            CreationQueue.Add(result);

            return(result);
        }