コード例 #1
0
ファイル: TankObject.cs プロジェクト: nitzanbueno/TanksDrop
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
        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
ファイル: Button.cs プロジェクト: rugbbyli/Reflector
        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
ファイル: Wall.cs プロジェクト: chrisdaher/Electrolyte
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
        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
ファイル: Concealer.cs プロジェクト: nitzanbueno/TanksDrop
 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
ファイル: Bubble.cs プロジェクト: pmoda/PuzzleBobble3D
 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
ファイル: Bubble.cs プロジェクト: pmoda/PuzzleBobble3D
 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
ファイル: Player.cs プロジェクト: baskinbrent/RBYGame
        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
ファイル: Concealer.cs プロジェクト: nitzanbueno/TanksDrop
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 public Sprite(int x ,int y, int width, int height, Colors color)
     : this(x,y,width,height)
 {
     m_color = color;
 }
コード例 #13
0
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: TanksDrop.cs プロジェクト: nitzanbueno/TanksDropTwo
 /// <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
ファイル: Player.cs プロジェクト: yourowndeath/Sourcery
 /// <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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Button.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: TanksDrop.cs プロジェクト: nitzanbueno/TanksDrop
 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
ファイル: Sprite.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Button.cs プロジェクト: rugbbyli/Reflector
 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
ファイル: Agent.cs プロジェクト: nicktyson/sugarscape
 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
ファイル: Tank.cs プロジェクト: nitzanbueno/TanksDropTwo
 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 );
 }