예제 #1
0
        public WinScreen(Game game, Library.Colors.ColorName player)
            : base(Library.WinScreens.Background, game)
        {
            WinType    = TypeOfWin.TeamVictory;
            SplashTime = TimeSpan.FromSeconds(5);
            switch (player)
            {
            case Synced.Content.Library.Colors.ColorName.Blue:
                GameComponents.Add(new Sprite(Library.WinScreens.BlueTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game));
                break;

            case Synced.Content.Library.Colors.ColorName.Green:
                GameComponents.Add(new Sprite(Library.WinScreens.GreenTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game));
                break;

            case Synced.Content.Library.Colors.ColorName.Red:
                GameComponents.Add(new Sprite(Library.WinScreens.RedTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game));
                break;

            case Synced.Content.Library.Colors.ColorName.Yellow:
                GameComponents.Add(new Sprite(Library.WinScreens.YellowTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game));
                break;

            default:
                break;
            }
        }
예제 #2
0
 void ScreenManager_GameEnded(Library.Colors.ColorName color, EventArgs e)
 {
     (Screens.Peek() as GameScreen).ResetGame();
     Pop();
     AddScreen(new WinScreen(Game, color));
     Screens.Peek().Activated();
 }
예제 #3
0
        public Unit(PlayerIndex playerIndex, Texture2D texture, Vector2 position, Color color, Game game, World world, Library.Colors.ColorName teamColor)
            : base(texture, position, DrawingHelper.DrawingLevel.Medium, game, world)
        {
            PlayerIndex = playerIndex;

            /* Setting up Farseer Physics */
            RigidBody                     = BodyFactory.CreateCircle(this.world, ConvertUnits.ToSimUnits(texture.Width / 2), 0, ConvertUnits.ToSimUnits(position));
            RigidBody.BodyType            = BodyType.Dynamic;
            RigidBody.CollisionCategories = Category.Cat1; /* UNIT Category & TEAM Category*/ // TODO: fix collisionCategory system.
            RigidBody.CollidesWith        = Category.All ^ Category.Cat1;
            RigidBody.Mass                = 10f;
            RigidBody.LinearDamping       = 5f;
            RigidBody.Restitution         = 0.1f;
            Origin = new Vector2(texture.Width / 2, texture.Height / 2);

            /* Setting up Unit */
            acceleration           = 40;
            Color                  = color;
            _trailParticleLifetime = 0.2f;
            _trail                 = new ParticleEngine(1, Library.Particle.trailTexture, position, color, Origin, 1.0f, 0.0f, _trailParticleLifetime, DrawingHelper.DrawingLevel.Low, game);
            _effectParticles       = new ParticleEngine(1, Library.Particle.plusSignTexture, position, color, Origin, 0.7f, 0.0f, 0.5f, DrawingHelper.DrawingLevel.High, game);
            _useEffectParticles    = false;
            _teamColor             = teamColor;
            SyncedGameCollection.ComponentCollection.Add(_trail);
            SyncedGameCollection.ComponentCollection.Add(_effectParticles);
            Tag      = TagCategories.UNIT;
            _texture = texture;
        }
예제 #4
0
        public override void Update(GameTime gameTime)
        {
            world.Step(Math.Min((float)gameTime.ElapsedGameTime.TotalSeconds, (1f / 30f)));

            // Have we won?
            Library.Colors.ColorName color = Library.Colors.ColorName.Blue;
            if (Winner(ref color))
            {
                GameEnded(color, new EventArgs());
            }

            base.Update(gameTime);
        }
예제 #5
0
 public bool Winner(ref Library.Colors.ColorName winner)
 {
     foreach (var ob in GameComponents)
     {
         if (ob is ScoreLabel)
         {
             if ((ob as ScoreLabel).Score >= GameScore)
             {
                 winner = (Library.Colors.ColorName)((int)((ob as ScoreLabel).PlayerIndex));
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #6
0
        public virtual Grabbable PickUp(Unit own, Library.Colors.ColorName teamColor) //TODO: only let it be stolen or picked up if some conditions are met.
        {
            if (_cooldownTimer > _cooldownInSeconds)
            {
                if (owner != null)
                {
                    // its a steal!
                    owner.SetItem(null);
                }

                owner                   = own;
                maxAcceleration         = 100;
                RigidBody.LinearDamping = 10f;
                Library.Audio.PlaySoundEffect(Library.Audio.SoundEffects.CrystalGrab);
                Color          = Library.Colors.getColor[Tuple.Create(teamColor, Library.Colors.ColorVariation.Other)];
                _cooldownTimer = 0;

                return(this);
            }
            return(null);
        }
예제 #7
0
        public Player(PlayerIndex playerIndex, Library.Character.Name character, Library.Colors.ColorName teamcolor, Game game, World world, Vector2 positionLeft, Vector2 positionRight)
            : base(game)
        {
            // TODO: fix hardcode positions.
            _playerIndex = playerIndex;

            Left  = new Unit(playerIndex, Library.Character.GameTexture[character], positionLeft, Library.Colors.getColor[Tuple.Create(teamcolor, Library.Colors.ColorVariation.Left)], game, world, teamcolor);      // TODO: fix hardcoded values for positions.
            Right = new Unit(playerIndex, Library.Character.GameTexture[character], positionRight, Library.Colors.getColor[Tuple.Create(teamcolor, Library.Colors.ColorVariation.Right)], game, world, teamcolor);

            _areTrailsActive      = false;
            _haveSwitched         = false;
            _world                = world;
            _barrier              = new Barrier(Library.Particle.barrierParticle, Left, Right, world, game, Library.Colors.getColor[Tuple.Create(teamcolor, Library.Colors.ColorVariation.Other)]);
            shape                 = (Library.Zone.Name)character;
            _teamColor            = teamcolor;
            _compactZones         = new List <CompactZone>();
            _zones                = new List <Zone>();
            _zoneCreationCooldown = 10.0f;
            _canCreateZone        = true;

            SyncedGameCollection.ComponentCollection.Add(Left);
            SyncedGameCollection.ComponentCollection.Add(Right);
            SyncedGameCollection.ComponentCollection.Add(_barrier);
        }