Microsoft.Xna.Framework.Rectangle.Equals C# (CSharp) Method

Equals() public method

public Equals ( Rectangle other ) : bool
other Rectangle
return bool
		public bool Equals (Rectangle other)
		{
			return this.X == other.X && this.Y == other.Y && this.Width == other.Width && this.Height == other.Height;
		}

Same methods

Rectangle::Equals ( object obj ) : bool

Usage Example

Beispiel #1
0
        //Contructs a tower. Throws exceptions for invalid ranges of values (18 lines)
        public Tower(String name, int health, int damage, int cost, int range, Rectangle location)
        {
            if (location.Equals(new Rectangle()))
                throw new ArgumentNullException();
            if (range <= 0)
                throw new ArgumentOutOfRangeException();
            if (damage < 0)
                throw new ArgumentOutOfRangeException();
            if (health <= 0)
                throw new ArgumentOutOfRangeException();
            if (cost < 0)
                throw new ArgumentOutOfRangeException();

            this.name = name;
            this.location = location;
            this.health = health;
            this.attackDamage = damage;
            this.cost = cost;
            this.range = range;
            this.updateCounter = 0;
            this.nearbyEnemies = new List<Enemy>();

            this.color = Color.White;
            switch (name)
            {
                case "path":
                    this.color = Color.Black;
                    break;
                case "slow":
                    this.color = Color.Blue;
                    break;
                case "dot":
                    this.color = Color.Red;
                    break;
                case "sniper":
                    this.color = Color.Green;
                    break;

            }

            if (color == Color.White)
                name = "basic";
        }
All Usage Examples Of Microsoft.Xna.Framework.Rectangle::Equals