コード例 #1
0
ファイル: BlockSprite.cs プロジェクト: sinhpham/tanka
 // Constructors
 public BlockSprite(SpriteInfo spriteInfo, BlockSpriteState state, SpriteDestroyedHandler handlers)
     : base(spriteInfo)
 {
     this.position = new Vector2(state.mapPoint.X * Map.CellSize, state.mapPoint.Y * Map.CellSize);
     this.type = state.type;
     this.maxHealth = state.maxHealth;
     this.Health = state.health;
     layer = Map.Layer1 - 0.0001f * state.mapPoint.Y + 0.01f;
     if (type != BlockSpriteType.Invisible)
         blockAmmo = true;
     hasBeenDestroyed = handlers;
 }
コード例 #2
0
ファイル: Factory.cs プロジェクト: sinhpham/tanka
        // Constructors
        public Factory(ContentManager contentManager, SpriteCreatedHandler created, SpriteDestroyedHandler destroyed)
        {
            Factory.created = created;
            Factory.destroyed = destroyed;
            // Clear
            Factory.tankSpriteInfo.Clear();
            Factory.gunTextures.Clear();
            Factory.ammoSpriteInfo.Clear();
            Factory.blockSpriteSI.Clear();
            Factory.effectSpriteInfo.Clear();
            Factory.itemSpriteInfo.Clear();
            gunSound.Clear();

            InitializeTankFactory(contentManager);
            InitializeAmmoFactory(contentManager);
            InitializeBlockSpriteFactory(contentManager);
            InitializeEffectFactory(contentManager);
            InitializeItemFactory(contentManager);

            tankHealthBar = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/hp_bar_overtank");
            tankMainHealthBar = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/main_hp_bar");
            tankHPbackground = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/hpbg");

            healthFont = contentManager.Load<SpriteFont>(@"Fonts/HealthFont");
            itemInfoFont = contentManager.Load<SpriteFont>(@"Fonts/ItemInfo");

            myselfColor = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/me");
            teamColor = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/team");
            enemyColor = contentManager.Load<Texture2D>(@"Images/GamePlay/Tank/enemy");

            statHeader = contentManager.Load<Texture2D>(@"Images/GamePlay/Stat_header");
            statBlue = contentManager.Load<Texture2D>(@"Images/GamePlay/Stat_blue");
            statTeam = contentManager.Load<Texture2D>(@"Images/GamePlay/stat_team");
            statFooter = contentManager.Load<Texture2D>(@"Images/GamePlay/Stat_footer");

            explosion = contentManager.Load<SoundEffect>(@"Sound/explosion2");
            SoundEffect gun = contentManager.Load<SoundEffect>(@"Sound/basic");
            gunSound.Add(AmmoType.Basic, gun);
            gun = contentManager.Load<SoundEffect>(@"Sound/fireball");
            gunSound.Add(AmmoType.FireBall, gun);
            gun = contentManager.Load<SoundEffect>(@"Sound/phitieu");
            gunSound.Add(AmmoType.PhiTieu, gun);
            gun = contentManager.Load<SoundEffect>(@"Sound/rocket");
            gunSound.Add(AmmoType.Rocket, gun);
        }
コード例 #3
0
ファイル: Effect.cs プロジェクト: sinhpham/tanka
        public Effect(SpriteInfo si, EffectState state, SpriteDestroyedHandler handler)
            : base(si)
        {
            this.type = state.type;
            this.position = state.position;
            this.startFrame = state.startFrame;
            this.endFrame = state.endFrame;
            this.attachedTankIndex = state.attachedTankIndex;
            scale = 1;
            if (!normalScale.Contains(type))
                scale = 0.6f;

            origin.X = (int)(si.frameSize.X / 2);
            origin.Y = (int)(si.frameSize.Y / 2);
            lastingTime = state.lastingTime;
            if (lastingTime == 0)
                oneTimeEffect = true;
            if (!state.oldEffect)
                SetFrame(state.startFrame);
            else
                SetFrame(state.currentFrame);
            hasBeenDestroyed = handler;
        }
コード例 #4
0
ファイル: UserTank.cs プロジェクト: sinhpham/tanka
 // Constructors
 public UserTank(SpriteInfo si, Texture2D gunTexture, TankState ts, SpriteDestroyedHandler handler)
     : base(si, ts, handler)
 {
     this.gunTexture = gunTexture;
     this.playerIndex = ts.playerIndex;
 }
コード例 #5
0
ファイル: Item.cs プロジェクト: sinhpham/tanka
        public Item(SpriteInfo si, ItemState state, SpriteDestroyedHandler handler)
            : base(si)
        {
            this.position = state.position;
            this.activeTime = state.activeTime;
            this.waitingTime = state.waitingTime;
            this.type = state.type;
            this.hasBeenDestroyed = handler;
            this.affectedTankIndex = state.affectedTankIndex;
            this.oldValue = state.oldValue;
            this.itemIndex = state.itemIndex;

            if (waitingTime <= 0)
                activated = true;

            occupiedArea.X = (int)position.X;
            occupiedArea.Y = (int)position.Y;
            occupiedArea.Width = FrameWidth;
            occupiedArea.Height = FrameHeight;
        }