コード例 #1
0
ファイル: Player.cs プロジェクト: frobro98/School-Projects
        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;
        }
コード例 #2
0
        public void Set(GameObject _obj)
        {
            base.Initialize();

            this.gameObj = _obj;
            this.type = _obj.type;
        }
コード例 #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;
        }
コード例 #4
0
ファイル: Ship.cs プロジェクト: frobro98/School-Projects
        public Ship(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type = _type;
            spriteRef = _spriteRef;

            waveBank = WaveBankManager.WaveBank();
            soundBank = SoundBankManager.SoundBank();
        }
コード例 #5
0
        public Ship(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type      = _type;
            spriteRef = _spriteRef;


            waveBank  = WaveBankManager.WaveBank();
            soundBank = SoundBankManager.SoundBank();
        }
コード例 #6
0
ファイル: Wall.cs プロジェクト: dmaulikr/OmegaRace
        public Wall(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type      = _type;
            spriteRef = _spriteRef;

            anim = new Animation(spriteRef.sprite);

            setUpAnimation();

            soundBank = SoundBankManager.SoundBank();
            waveBank  = WaveBankManager.WaveBank();
        }
コード例 #7
0
ファイル: Wall.cs プロジェクト: frobro98/School-Projects
        public Wall(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type = _type;
            spriteRef = _spriteRef;

            anim = new Animation(spriteRef.sprite);

            setUpAnimation();

            soundBank = SoundBankManager.SoundBank();
            waveBank = WaveBankManager.WaveBank();
        }
コード例 #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;
        }
コード例 #9
0
ファイル: Bomb.cs プロジェクト: frobro98/School-Projects
        public Bomb(GameObjType _type, PlayerID _owner, Ship s)
        {
            type = _type;

            createBomb(_owner, s);

            owner = _owner;

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

            playBombLaySound();

            armBomb();
        }
コード例 #10
0
ファイル: Missile.cs プロジェクト: dmaulikr/OmegaRace
        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();
        }
コード例 #11
0
ファイル: Missile.cs プロジェクト: frobro98/School-Projects
        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();
        }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #15
0
ファイル: FencePost.cs プロジェクト: frobro98/School-Projects
 public FencePost(GameObjType _type, Sprite_Proxy _spriteRef)
 {
     type = _type;
     spriteRef = _spriteRef;
 }
コード例 #16
0
ファイル: FencePost.cs プロジェクト: dmaulikr/OmegaRace
 public FencePost(GameObjType _type, Sprite_Proxy _spriteRef)
 {
     type      = _type;
     spriteRef = _spriteRef;
 }
コード例 #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);
        }