Пример #1
0
 public TankObject( Vector2 position, float rotation, Colors color, KeySet keys, float scale, int shotlimit, int shottime, int fencelimit, int fencetime, float speed, float bulletspeed, string teamString, bool teamShield, bool teamGhost, bool selfish )
 {
     Position = position;
     OP = position;
     angle = rotation;
     OR = MathHelper.ToRadians( rotation );
     TankColor = color;
     Keys = keys;
     IsInGame = true;
     IsOfficiallyOut = false;
     Score = 0;
     OS = scale;
     Scale = scale;
     ShotLimit = shotlimit;
     ShotTime = shottime;
     FenceLimit = fencelimit;
     FenceTime = fencetime;
     random = new Random();
     OSP = speed;
     Speed = OSP;
     BulletSpeed = bulletspeed;
     TeamString = teamString;
     TeamShield = teamShield;
     TeamGhost = teamGhost;
     Selfish = selfish;
 }
Пример #2
0
        public Laser(object father, ContentManager content, Colors color, Point start, Point end)
            : this(father, content, color, (int)start.X, (int)start.Y, 800, 20)
        {
            this.End = end;

            Angle = (float)Math.Asin((end.Y - start.Y) / this.Width);
            if (start.X > end.X) Angle = 180 - Angle;
        }
Пример #3
0
        public Button(ContentManager content, Colors borderbrush, int x, int y, int width, int height)
        {
            Border = content.Load<Texture2D>("Images/Laser/" + borderbrush.ToString());

            rec1 = new Rectangle(x, y, width, 6);
            rec2 = new Rectangle(x, y + height - 6, width, 6);
            rec3 = new Rectangle(x + 6, y + 3, height - 6, 6);
            rec4 = new Rectangle(x + width, y + 3, height - 6, 6);
            Rec = new Rectangle(x, y, width, height);
        }
Пример #4
0
 public Wall(Game game, Pointf position, Size size, Colors color)
     : base(game, position, size, new Velocity(), (int)color)
 {
     mBlocksOnCollision = true;
     isHorizontal = true;
     if (size.Height > size.Width)
     {
         isHorizontal = false;
     }
 }
Пример #5
0
        public Emitter(ContentManager content, Colors color, int x, int y, float angle)
            : base(x,y,60,60)
        {
            this.Foreground = content.Load<Texture2D>(@"Images/Emitter/" + color.ToString());
            this.Origin = new Vector2(Width / 2, Height / 2);

            //0向上/90向右/180向下/270向左
            this.Angle = angle;

            this.Laser = new Laser(this, content, color, this.X, this.Y - 10, angle - 90);
        }
Пример #6
0
 public Concealer( GameTime gameTime )
     : base(gameTime, 10000)
 {
     toSwitch = random.Next( 2 ) == 0;
     if ( Owner != null )
     {
         SwitchedTank = Owner;
         origColor = Owner.TankColor;
         origKeys = Owner.Keys;
     }
 }
Пример #7
0
 public Bubble(Colors color)
 {
     this.color = color;
     this.positionPixels = new Vector2(235, 382);
     popTimer = 0;
     popped = false;
     popping = false;
     popScale = 1;
     popAlpha = 1;
     fallTimer = 0;
     fallen = false;
     falling = false;
     sourceRectangle = getSourceRectangle();
     colorVector = getColorVector();
     worldPosition = new Vector3(-7, -11, 8);
     angularVelocity = 0;
     angle = 0;
     acceleration = new Vector2(0, 0);
 }
Пример #8
0
 public Bubble(Colors color, int x, int y, Texture2D tex)
 {
     this.texture = tex;
     this.color = color;
     this.gridPosition = new Vector2(x, y);
     this.positionPixels = this.gridToPixels(0);
     popTimer = 0;
     popped = false;
     popping = false;
     popScale = 1;
     popAlpha = 1;
     fallTimer = 0;
     fallen = false;
     falling = false;
     sourceRectangle = getSourceRectangle();
     colorVector = getColorVector();
     worldPosition = new Vector3(gridPosition.X * 2 - RAMP_SIZE + 5 + (gridPosition.Y % 2), -RAMP_SIZE + 1,
                                         gridPosition.Y * 1.94f - RAMP_SIZE * 1.5f /*,
                                         bubble.gridPosition.Y - RAMP_SIZE + 1 0.0f*/);
 }
Пример #9
0
        public void switchColorsForwards()
        {
            prevColor = currentColor;

            switch (currentColor)
            {
                case Colors.red:
                    currentColor = Colors.blue;
                    break;
                case Colors.blue:
                    currentColor = Colors.yellow;
                    break;
                case Colors.yellow:
                    currentColor = Colors.red;
                    break;
                default:
                    Console.WriteLine("OOPS");
                    break;
            }
        }
Пример #10
0
 public override void DoPickup( TankObject[] Tanks, HashSet<ProjectileObject> Projectiles, HashSet<FenceObject> Fences )
 {
     if ( SwitchedTank == null )
     {
         SwitchedTank = Owner;
         origColor = Owner.TankColor;
         origKeys = Owner.Keys;
     }
     if ( !didSwitch && Tanks.Count<TankObject>(x => x.IsInGame) > 1)
     {
         HashSet<TankObject> TankSet = new HashSet<TankObject>( Tanks );
         foreach ( TankObject tank in Tanks )
         {
             if ( !tank.IsInGame || tank == Owner )
             {
                 TankSet.Remove( tank );
             }
         }
         SwitchedTank = ( TankSet.ToArray<TankObject>() )[ random.Next( TankSet.Count ) ];
         if ( toSwitch )
         {
             Vector2 OwnerPos = Owner.Position;
             float OwnerRot = Owner.Rotation;
             float OwnerScale = Owner.Scale;
             Owner.Position = SwitchedTank.Position;
             Owner.Rotation = SwitchedTank.Rotation;
             Owner.Scale = SwitchedTank.Scale;
             SwitchedTank.Position = OwnerPos;
             SwitchedTank.Rotation = OwnerRot;
             SwitchedTank.Scale = OwnerScale;
         }
         didSwitch = true;
     }
     Owner.TankColor = SwitchedTank.TankColor;
     Owner.Keys = SwitchedTank.Keys;
 }
Пример #11
0
 public Switch(ContentManager content, Colors color, int x,int y)
     : base(x,y,60,60,color)
 {
     this.Foreground = content.Load<Texture2D>(@"Images/Switch/" + color.ToString() + "_off");
     this.Background = content.Load<Texture2D>(@"Images/Switch/" + color.ToString() + "_on");
 }
Пример #12
0
 public Sprite(int x ,int y, int width, int height, Colors color)
     : this(x,y,width,height)
 {
     m_color = color;
 }
Пример #13
0
 public Receiver(ContentManager content , Colors color, int x ,int y)
     : base(x,y,60,60,color)
 {
     this.Foreground = content.Load<Texture2D>(@"Images/Receiver/" + color.ToString());
     this.Background = content.Load<Texture2D>(@"Images/Receiver/selected_" + color.ToString());
 }
Пример #14
0
 public void SetColor(Colors color)
 {
     this.Color = color;
     this.Foreground = Content.Load<Texture2D>(@"Images/Laser/" + color);
     this.Background = Content.Load<Texture2D>(@"Images/Laser/selected_" + color);
 }
Пример #15
0
 public Laser(object father, ContentManager content, Colors color, int x, int y, float angle)
     : this(father, content, color,x,y,800,20)
 {
     Angle = angle;
 }
Пример #16
0
 /// <summary>
 /// Loads the Colors in the settings.ini with the given setting.
 /// </summary>
 /// <param name="setting">The setting to load the Colors from/</param>
 /// <param name="defaultSetting">The default value in case of failure.</param>
 /// <returns>The loaded color.</returns>
 private Colors LoadSetting( string setting, Colors defaultSetting )
 {
     string color = LoadSetting( setting );
     Colors set;
     try
     {
         set = (Colors)Enum.Parse( typeof( Colors ), color );
     }
     catch ( Exception ) { set = defaultSetting; }
     Settings.Add( setting, Tuple.Create<Type, object>( set.GetType(), set ) );
     return set;
 }
Пример #17
0
 /// <summary>Загружает цвет игрока</summary>
 /// <param name="color">Цвет.</param>
 private void LoadColor(Colors color)
 {
     switch (color)
       {
     case Colors.Blue: { _Color = Color.Blue; break; }
     case Colors.Green: { _Color = Color.Green; break; }
     case Colors.Red: { _Color = Color.Red; break; }
     case Colors.Yellow: { _Color = Color.Yellow; break; }
       }
 }
Пример #18
0
 public Wall(ContentManager content, Colors color, int x,int y)
     : base(x,y,60,60,color)
 {
     Foreground = content.Load<Texture2D>(@"Images/Wall/" + color.ToString());
     sourceRectangle = new Rectangle(5, 5, 60, 60);
 }
Пример #19
0
 public Button(ContentManager content, Colors borderbrush, string image, int x, int y, int width, int height)
     : this(content, borderbrush, x, y, width, height)
 {
     Foreground = content.Load<Texture2D>(image);
 }
Пример #20
0
 private Colors LoadSetting( string setting, Colors defaultSetting )
 {
     string color = LoadSetting( setting );
     try
     {
         return ( Colors )Enum.Parse( typeof( Colors ), color );
     }
     catch ( Exception ) { return defaultSetting; }
 }
Пример #21
0
 private Laser(object father, ContentManager content, Colors color, int x, int y, int width, int height)
     : base(x,y,width,height,color)
 {
     this.Content = content;
     this.Foreground = content.Load<Texture2D>(@"Images/Laser/" + color);
     this.Background = content.Load<Texture2D>(@"Images/Laser/selected_" + color);
     this.Father = father;
     this.Depth = 0.6f;
     Origin = new Vector2(0, 20);
     this.Y -= 10;
     foreOrigin = new Vector2(0, 10);
     foreRectangle = new Rectangle(this.X,this.Y,this.Width,10);
 }
Пример #22
0
 public WorldButton(ContentManager content, Colors borderBrush, int world, int x, int y, int width, int height)
     : base(content, borderBrush, "Images/Level/w" + world, x, y, width, height)
 {
 }
Пример #23
0
 public void calculateColor()
 {
     int zeros = 0;
     int ones = 0;
     foreach (byte tag in culture) {
         if (tag == 0) {
             zeros++;
         } else if (tag == 1) {
             ones++;
         }
     }
     if (zeros > ones) {
         color = Colors.RED;
     } else {
         color = Colors.BLUE;
     }
 }
Пример #24
0
 public Tank( string name, Vector2 startPosition, float startAngle, KeySet keys, Colors color, float speed, Projectile originalProjectile, int BulletLimit, int FenceLimit, int FenceTime, float Scale, bool AI, PlayerIndex index )
 {
     this.Name = name;
     this.Speed = speed;
     this.originalSpeed = speed;
     this.originalPosition = startPosition;
     this.originalAngle = startAngle;
     this.Keys = keys;
     this.OriginalKeys = keys;
     this.TankColor = color;
     this.OriginalColor = color;
     this.Origin = new Vector2( 16, 16 );
     this.originalProjectile = originalProjectile;
     this.ProjectileLimit = BulletLimit;
     this.FenceLimit = FenceLimit;
     this.originalScale = Scale;
     this.Scale = Scale;
     this.FenceLifeTime = FenceTime;
     this.TurnSpeed = 5;
     this.AI = AI;
     this.r = new Random( 10 );
     this.index = index;
     Reset( false );
 }