コード例 #1
0
ファイル: PlayerThing.cs プロジェクト: Davermouse/HeartAttack
        public PlayerThing(MainGameScene scene, int restingHeartRate)
            : base(scene)
        {
            m_RestingHeartRate = restingHeartRate;

            var content = HeartAttack.theGameInstance.Content;

            normalHeart = content.Load<Texture2D>("Heart/Heart");
            cross = content.Load<Texture2D>("cross");

            lFrames = new List<Texture2D>()
            {
                content.Load<Texture2D>("Heart/Heartl1"),
                content.Load<Texture2D>("Heart/Heartl2"),
                content.Load<Texture2D>("Heart/Heartl3"),
              //  content.Load<Texture2D>("Heart/Heartl4")
            };

            sFrames = new List<Texture2D>()
            {
                content.Load<Texture2D>("Heart/Hearts1"),
                content.Load<Texture2D>("Heart/Hearts2"),
                content.Load<Texture2D>("Heart/Hearts3"),
            //    content.Load<Texture2D>("Heart/Hearts4")
            };

            m_Sprite = new Sprite(normalHeart,
                DirtyGlobalHelpers.CentreOfScreen());

            this.m_Health = 100;
            this.Radius = 45;
            m_Sprite.Scale = new Vector2(0.5f, 0.5f);
            m_FireSound = HeartAttack.theGameInstance.Content.Load<SoundEffect>("fire");
        }
コード例 #2
0
ファイル: Bullet.cs プロジェクト: Davermouse/HeartAttack
        public Bullet(MainGameScene scene, Vector2 pPosition, Vector2 pVelocity, int pPower)
            : base(scene)
        {
            m_Power = pPower;
            IsMiss = false;
            CanDelete = false;
            frames = new List<Texture2D>();
            var content = HeartAttack.theGameInstance.Content;
            cross = content.Load<Texture2D>("cross");
            for (int i = 1; i <= 4; i++)
            {
                frames.Add(content.Load<Texture2D>("Bullet/bullet" + i));
            }

            m_Sprite = new Sprite(frames[0], pPosition);
            m_Sprite.AddUpdater(new VelocityUpdater(pVelocity));
            m_Sprite.Scale = new Vector2(0.15f);
            //m_Sprite.Centre *= m_Sprite.Scale;
            var anim = new SpriteAnimation(Scene.ClockManager,
                    frames,
                    frames[0],
                    this.m_Sprite,
                    0.05f);

            anim.Start();

            anim.Complete += (s, e) =>
                {
                    anim.Reset();
                    anim.Start();
                };
        }
コード例 #3
0
 public NewPingManager(MainGameScene scene)
 {
     m_Oldest = 0;
     m_PingDistances = new Vector4(0, 0, 0, 0);
     m_HeartBeat = HeartAttack.theGameInstance.Content.Load<SoundEffect>("heartBeat1");
     this.scene = scene;
 }
コード例 #4
0
ファイル: Bug.cs プロジェクト: Davermouse/HeartAttack
        public Bug(MainGameScene scene, Vector2 pPosition, int pHealth, float pSpeed)
            : base(scene)
        {
            this.scene = scene;
            m_Health = pHealth;
            radius = 15;

            frames = new List<Texture2D>();
            var content = HeartAttack.theGameInstance.Content;
            cross = content.Load<Texture2D>("cross");
            for (int i = 1 ; i <= 4 ; i++)
            {
                frames.Add(content.Load<Texture2D>("Bug/bug" + i));
            }

            blinkFrames = new List<Texture2D>();
            for (int i = 1; i <= 4; i++)
            {
                blinkFrames.Add(content.Load<Texture2D>("Bug/bugblink" + i));
            }

            m_bugDeathSound = HeartAttack.theGameInstance.Content.Load<SoundEffect>("bugDeath1");
            m_HeartHitSound = HeartAttack.theGameInstance.Content.Load<SoundEffect>("heartHit");
            m_Sprite = new Sprite(frames[0], pPosition);
            m_Sprite.Scale = new Vector2(0.1f, 0.1f);
               // m_Sprite.Centre *= m_Sprite.Scale;
            m_Sprite.Colour = Color.Transparent;

            Vector2 velocity = (new Vector2(HeartAttack.theGameInstance.GraphicsDevice.Viewport.Width / 2,
                HeartAttack.theGameInstance.GraphicsDevice.Viewport.Height / 2) - pPosition);
            velocity.Normalize();
            velocity *= DirtyGlobalHelpers.config.BugSpeed;

            m_Sprite.AddUpdater(new VelocityUpdater(velocity));
        }
コード例 #5
0
ファイル: Ping.cs プロジェクト: Davermouse/HeartAttack
        public Ping(MainGameScene scene)
            : base(scene)
        {
            Texture2D texture = HeartAttack.theGameInstance.Content.Load<Texture2D>("ping");
            m_Sprite = new Sprite(texture,
                new Vector2((HeartAttack.theGameInstance.GraphicsDevice.Viewport.Width) / 2,
                (HeartAttack.theGameInstance.GraphicsDevice.Viewport.Height) / 2));

            var lifeTime = 1;
            //m_Sprite.AddUpdater(new ScaleLerpUpdater(new Vector2(0, 0), new Vector2(5, 5), lifeTime * 1000));
            new Timer(scene.ClockManager, lifeTime, true, (s, e) => this.IsDead = true);
        }
コード例 #6
0
 public BulletManager(MainGameScene scene)
 {
     m_Bullets = new List<Bullet>();
     this.m_Scene = scene;
 }
コード例 #7
0
ファイル: Entity.cs プロジェクト: Davermouse/HeartAttack
 public Entity(MainGameScene scene)
 {
     this.Scene = scene;
 }
コード例 #8
0
ファイル: PingManager.cs プロジェクト: Davermouse/HeartAttack
        public PingManager(MainGameScene scene)
        {
            m_HeartBeat = HeartAttack.theGameInstance.Content.Load<SoundEffect>("heartBeat1");

            this.scene = scene;
        }
コード例 #9
0
ファイル: BugManager.cs プロジェクト: Davermouse/HeartAttack
 public BugManager(MainGameScene scene)
 {
     this.scene = scene;
 }