コード例 #1
0
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize ()
		{
			base.Initialize ();

			this.graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
			this.graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
			this.graphics.IsFullScreen = false;

			this.graphics.ApplyChanges ();
			this.IsMouseVisible = true;

			this.status = new Status ();
			this.world = new World (this);
			this.ui = new UI (this);

            this.start = new Rectangle(Window.ClientBounds.Width - 300, Window.ClientBounds.Height - 102, 280, 82);
            this.tutorial = new Rectangle(10, Window.ClientBounds.Height - 102, 280, 82);

            int res1rx = (int)(Window.ClientBounds.Right - font.MeasureString(res1).X - 25);
            int res1ry = (int)(Window.ClientBounds.Top + 25);
            int res1w = (int)(font.MeasureString(res1).X);
            int res1h = (int)(font.MeasureString(res1).Y);
            this.res1R = new Rectangle(res1rx, res1ry, res1w, res1h);
            this.res2R = new Rectangle(res1rx, res1ry + res1h, res1w, res1h);
            this.res3R = new Rectangle(res1rx, res1ry + res1h * 2, res1w, res1h);

		}
コード例 #2
0
ファイル: Tower.cs プロジェクト: kinaesthesia/KLinuxDefense
        public Tower(World world, Rectangle towerBase)
        {
            this.world = world;
            this.towerBase = towerBase;

            this.center = new Vector2 (towerBase.Width / 2 + towerBase.X, towerBase.Height / 2 + towerBase.Y);
        }
コード例 #3
0
ファイル: Base.cs プロジェクト: kinaesthesia/KLinuxDefense
        public Base(World world, Rectangle area)
        {
            this.world = world;
            this.area = area;

            this.currentHealth = 20;
            this.maxHealth = 20;
        }
コード例 #4
0
ファイル: Base.cs プロジェクト: kinaesthesia/KLinuxDefense
        public Base(World world, Crossroad lc)
        {
            this.world = world;
            this.area = lc.Area;

            this.currentHealth = 20;
            this.maxHealth = 20;

            last = lc;
        }
コード例 #5
0
 public Projectile(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
 {
     this.world = world;
     this.targetFocused = target;
     this.position = position;
     this.damage = dmg;
     this.currentSpeed = speed;
     this.imprecision = imprecision;
     //            this.texProjectile = world.texArrow;
 }
コード例 #6
0
ファイル: Arrow.cs プロジェクト: kinaesthesia/KLinuxDefense
        public Arrow(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.TexArrow;
            hitAnimation = KLinuxDefense.AnimationType.RED_PUFF;
            missAnimation = KLinuxDefense.AnimationType.DIRT_PUFF;

            SetupProjectileSize();
            CalculateMovement();
        }
コード例 #7
0
ファイル: Bullet.cs プロジェクト: kinaesthesia/KLinuxDefense
        public Bullet(World world, Vector2 position, Unit target, int dmg, float speed, int imprecision)
            : base(world, position, target, dmg, speed, imprecision)
        {
            texProjectile = world.TexBullet;
            missAnimation = KLinuxDefense.AnimationType.DIRT_PUFF;
            hitAnimation = KLinuxDefense.AnimationType.RED_PUFF;

            additive = true;
            scale = 0.4f;
            dType = KLinuxDefense.DamageType.PIERCE;

            color = new Color(255, 150, 150, 255);

            CalculateMovement();
            SetupProjectileSize();
        }
コード例 #8
0
        public RifleTower(World world, Rectangle towerBase)
            : base(world, towerBase)
        {
            textureMM = world.TexMMrifle;
            fireSound = "rifle";
            name = "rifle tower";
            texture = world.TexTowerRifle;

            firingRate = 700.0f;
            currentDamage = 30;
            currentRange = 225;
            imprecision = 1;
            projectileSpeed = 18;
            mmColor = Color.Green;

            defaultRange = currentRange;
            defaultFiringRate = firingRate;
            defaultDamage = currentDamage;
            baseDamage = defaultDamage;

            cost = 10;

            SetDrawRectangle();
        }
コード例 #9
0
		public void Restart ()
		{
			this.status = new Status ();
			this.world = new World (this);
			this.ui = new UI (this);
		}