Пример #1
0
        public Bullet()
        {
            mBulletAtlas = null;
            mBulletType  = "";
            mBulletColor = 0;

            mPosition     = new Vector2(0, 0);
            mVelocity     = new Vector2(0, 0);
            mAcceleration = new Vector2(0, 0);

            mHitBox      = new Rectangle(0, 0, 2, 2);
            mDirectional = false;
            mAngle       = 0;
            mAllied      = false;

            mTextureAlpha = mAllied ? 0.5f : 1.0f;
        }
Пример #2
0
        public void SpawnPlayerBullet(SpriteAtlas atlas, string bulletType,
                                      Vector2 pos, Vector2 vel, Vector2 acc, Rectangle hitBox,
                                      bool angled)
        {
            Bullet bullet = new Bullet();

            bullet.mBulletAtlas  = atlas;
            bullet.mBulletType   = bulletType;
            bullet.mPosition     = pos;
            bullet.mVelocity     = vel;
            bullet.mAcceleration = acc;
            bullet.mHitBox       = hitBox;
            bullet.mDirectional  = angled;
            bullet.SetAllied();

            mPlayerBullets.Add(bullet);
        }
Пример #3
0
        public Enemy(SpriteAtlas atlas, string name)
        {
            mEnemyAtlas = atlas;
            mSpriteName = name;
            mHitBox     = new Rectangle(0, 0, 50, 50);

            mPosition     = new Vector2(0, 0);
            mVelocity     = new Vector2(0, 0);
            mAcceleration = new Vector2(0, 0);
            mMoveSpeed    = 3f;

            mFirePatterns = new List <Pattern>();

            mPathManager = new PathManager();
            mHealth      = 10;
            mMoveState   = MoveState.IDLE;
        }
Пример #4
0
 public Player()
 {
     mPosition      = new Vector2();
     mVelocity      = new Vector2();
     mHitBox        = new Rectangle(0, 0, 4, 4);
     mLives         = 3;
     mBombs         = 3;
     mPowerLevel    = 1;
     mMovementSpeed = 200;
     mSpriteName    = "pl00";
     mAtlas         = null;
     mFiring        = false;
     mDead          = false;
     mFocusing      = false;
     mBombing       = false;
     mIsGhostObject = false;
     mRespawnTime   = 2;
     mInvulnTime    = 2;
 }
Пример #5
0
        public void LoadContent(ContentManager content)
        {
            string[] descriptors = System.IO.Directory.GetFiles("Descriptors/Images/Enemy/", "*.json", System.IO.SearchOption.TopDirectoryOnly);
            foreach (var descriptor in descriptors)
            {
                string         aJson      = File.ReadAllText(descriptor);
                EnemyAtlasInfo aInfo      = JsonConvert.DeserializeObject <EnemyAtlasInfo>(aJson);
                Texture2D      image      = content.Load <Texture2D>("Images/Enemy/" + aInfo.Image);
                SpriteAtlas    enemyAtlas = new SpriteAtlas();
                Dictionary <string, List <Rectangle> > clipMap = new Dictionary <string, List <Rectangle> >();
                Dictionary <string, int> originMap             = new Dictionary <string, int>();
                foreach (var clipset in aInfo.ClipSets)
                {
                    List <Rectangle> clips = new List <Rectangle>();
                    foreach (var clip in clipset.Set)
                    {
                        clips.Add(new Rectangle(clip[0], clip[1], clip[2], clip[3]));
                    }
                    clipMap.Add(clipset.Key, clips);
                    originMap.Add(clipset.Key, 0);
                    mNameToAtlasMap.Add(clipset.Key, enemyAtlas);
                }
                enemyAtlas.SetImage(image);
                enemyAtlas.SetClipMap(clipMap, originMap);

                foreach (var enemy in aInfo.EnemySequences)
                {
                    Dictionary <string, SpriteSequenceData> sequenceMap = new Dictionary <string, SpriteSequenceData>();
                    foreach (var sequence in enemy.Sequences)
                    {
                        SpriteSequenceData s = new SpriteSequenceData();
                        s.mSequence = sequence.Seq;
                        s.mLooping  = sequence.Looping;
                        s.mSubLoop  = sequence.SubLoop;
                        sequenceMap.Add(sequence.Key, s);
                    }
                    mNameToSequencesetMap.Add(enemy.Key, sequenceMap);
                }
            }
        }
Пример #6
0
 public void Init(SpriteAtlas atlas, string type, int color)
 {
     mBulletAtlas = atlas;
     mBulletType  = type;
     mBulletColor = color;
 }
Пример #7
0
 public void SetAtlas(SpriteAtlas atlas)
 {
     mEnemyAtlas = atlas;
 }