Exemplo n.º 1
0
 private void OnStateChanged(GameState gameState, GameState parentState)
 {
     if (AnalyzeModeOn)
     {
         if (parentState == null)
         {
             GameStates.Add(gameState);
         }
         else
         {
             parentState.AddChild(gameState);
         }
     }
 }
Exemplo n.º 2
0
        public Vetbol(PlayerIndex playerIndex)
        {
            this.Collidable   = true;
            index             = playerIndex;
            this.IsFlickering = true;
            this.flickerTime  = flickeringTime;
            this.ColorTimer   = changeColorTime;
            Position          = new Vector2(100, 100);

            this.captureParticles = new ParticleEngine(Controller.Content.Load <ParticleEffect>("captureParticle"));
            this.AddChild(this.captureParticles);

            this.dirtyParticles = new ParticleEngine(Controller.Content.Load <ParticleEffect>("dirtyParticle"));
            this.AddChild(this.dirtyParticles);

            this.deadParticles = new ParticleEngine(Controller.Content.Load <ParticleEffect>("deadParticles"));
            state.AddChild(this.deadParticles);

            image.LoadTexture(Controller.Content.Load <Texture2D>("images/slimeblobOther"), 48, 48);
            image.AddAnimation("IDLE", new int[1] {
                0
            }, 0);
            image.AddAnimation("CRAWLING", new int[2] {
                1, 2
            }, 0.5f);
            image.AddAnimation("JUMP", new int[1] {
                3
            }, 0);
            image.AddAnimation("ONWALL", new int[1] {
                4
            }, 0);
            image.AddAnimation("CAPTURING", new int[1] {
                5
            }, 0);
            image.AddAnimation("STUNNED", new int[3] {
                6, 7, 8
            }, 0.1f);

            image.Position = new Vector2(24, 14);
            if (index == PlayerIndex.One)
            {
                image.Color = Color.Yellow;//yellow
            }
            else if (index == PlayerIndex.Two)
            {
                image.Color = Color.CornflowerBlue;
            }
            else if (index == PlayerIndex.Three)
            {
                image.Color = Color.Lime;
            }
            else if (index == PlayerIndex.Four)
            {
                image.Color = Color.HotPink;
            }
            Width        = 32;
            Height       = 32;
            image.Origin = new Vector2(24, 24);
            AddChild(image);

            soundEffectWalk = Controller.Content.Load <SoundEffect>("sounds/walking");
            soundEffectLand = Controller.Content.Load <SoundEffect>("sounds/landing");
            soundEffectJump = Controller.Content.Load <SoundEffect>("sounds/jump");

            this.AddCollisionGroup("player");

            ParticleEffect effect = Controller.Content.Load <ParticleEffect>("spawnParticle");

            effect.EmitterData[0].ReleaseColor = this.image.Color;
            this.spawnParticle = new ParticleEngine(effect);
            state.AddChild(this.spawnParticle);

            /*Sprite bb = new Sprite();
             * bb = Sprite.CreateRectangle(new Vector2(Width, Height), Color.Aqua);
             * bb.Alpha = 0.5f;
             * AddChild(bb);*/
        }