示例#1
0
 public Vector2 GetDrawPos(TileCoord coord)
 {
     return(new Vector2((int)coordHandler.WorldToScreen(coord.ToVector2()).X + 1, (int)coordHandler.WorldToScreen(coord.ToVector2()).Y + 1));
 }
示例#2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            switch (animState)
            {
            case TowerAnimationState.Attack:
                attackAnimation.drawAnimation(spriteBatch, towerManager.GetDrawPos(coord), IsPreviewTower ? (towerManager.InvalidCoord(this.coord) ? new Color(Color.Red, 0.5f) : new Color(Color.White, 0.5f)) : Color.White);
                break;

            case TowerAnimationState.Idle:
                idleAnimation.drawAnimation(spriteBatch, towerManager.GetDrawPos(coord), IsPreviewTower ? (towerManager.InvalidCoord(this.coord) ? Color.Red : Color.White) : Color.White);
                break;

            default:
                break;
            }

            if (IsPreviewTower)
            {
                MonoGame.Extended.ShapeExtensions.DrawCircle(spriteBatch, new MonoGame.Extended.CircleF(new Point((int)entityManager.CoordHandler.WorldToScreen(coord.ToVector2()).X + 32, (int)entityManager.CoordHandler.WorldToScreen(coord.ToVector2()).Y + 32), (float)attackRadius * 2), 30, Color.White, 10);
            }

            if (towerManager.Game.DebugMode)
            {
                if (!this.IsPreviewTower)
                {
                    MonoGame.Extended.ShapeExtensions.DrawCircle(spriteBatch, new MonoGame.Extended.CircleF(new Point((int)entityManager.CoordHandler.WorldToScreen(coord.ToVector2()).X + 32, (int)entityManager.CoordHandler.WorldToScreen(coord.ToVector2()).Y + 32), (float)attackRadius * 2), 30, Color.Green * 0.4f, 10);
                }
            }
        }
示例#3
0
 public Rectangle GetDrawRectangle(TileCoord coord, TowerWidth width, TowerHeight height)
 {
     return(new Rectangle((int)coordHandler.WorldToScreen(coord.ToVector2()).X + 1, (int)coordHandler.WorldToScreen(coord.ToVector2()).Y + 1, coordHandler.ScaleToZoom((int)width), coordHandler.ScaleToZoom((int)height)));
 }
示例#4
0
    private void HandleShooting()
    {
        if (bulletTimerCurrent <= 0)
        {
            if (Input.GetButtonDown(FIRE_BUTTON))
            {
                bulletTimerCurrent = BulletTimer;

                Bullet.Spawn(transform.position + new Vector3(_c.offset.x + (Facing.X * BulletOffset), _c.offset.y + (Facing.Y * BulletOffset) + 0.2f, 0), Facing.ToVector2(), BulletLifetime, BulletSpeed);
                GameState.SpendFuel(BulletCost);
                Soundboard.Play(AUDIO_SHOOT);
            }
        }
        else
        {
            bulletTimerCurrent -= Time.deltaTime;
        }
    }