示例#1
0
        public CameraDebuger(Game game, Camera2D camera, Range boardRange)
            : base(game)
        {
            this.camera = camera;
            this.boardRange = boardRange;

            ID = Guid.NewGuid().ToString();

            this.log = new LoggerInstance(typeof(CameraDebuger), ID);
        }
示例#2
0
 public bool Intersects(Range range)
 {
     throw new NotImplementedException();
 }
示例#3
0
 public bool Contains(Range range)
 {
     return range.UpperLeft >= upperLeft &&
            range.LowerRight <= lowerRight;
 }
示例#4
0
文件: Map.cs 项目: AleksandarDev/LD26
        protected override void LoadContent()
        {
            base.LoadContent();

            this.mapRange = new Range(Map.MapSize, Map.MapSize);
            Random random = new Random();
            this.protectBlock = new Position(random.Next(Map.MapSize - 20) + 10,
                random.Next(Map.MapSize - 20) + 10);

            this.Game.camera.Position =
                new Vector2(
                    this.protectBlock.X * Map.MapSize -
                    (this.GraphicsDevice.Viewport.Width / 2f + Map.MapGridSizeOver2) /
                    this.Game.camera.Zoom
                    ,
                    this.protectBlock.Y * Map.MapSize -
                    (this.GraphicsDevice.Viewport.Height / 2f + Map.MapGridSizeOver2) /
                    this.Game.camera.Zoom);

            this.EnemiesPassed = new List<Enemy>();
            this.enemiesTree = new Node<Enemy>(null, this.mapRange, 1, 10);
            this.enemiesTree.Initialize();
            this.enemySpawns = new List<Position>();

            this.checkForCollision = new List<Position>();
            this.towersTree = new Node<StaticTower>(null, this.mapRange, 1, 1);
            this.towersTree.Initialize();

            this.GrassTexture = this.Game.Content.Load<Texture2D>("Textures/Grass");
        }
示例#5
0
        private void GenerateContent()
        {
            this.log.WriteInformation("Generating content...");

            // Kreira pozadinu za graf
            Color blackTrans = Color.Black;
            blackTrans.A = 150;

            Range backgroundRange = new Range(GraphWidth, GraphHeight);
            backgroundQuad = new Rectangle(position + backgroundRange.UpperLeft,
                                                               position + backgroundRange.LowerRight, blackTrans);

            // Ucitava linije
            if (graphLines == null) graphLines = new TimeLine[GraphWidth];
            for (int index = 0; index < GraphWidth; index++) {
                if (graphLines[index] == null) {
                    graphLines[index] = new TimeLine {
                        PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        PointB = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        ColorA = Color.DarkGreen,
                        ColorB = Color.Green,
                    };
                }
                else {
                    graphLines[index].PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z);
                    graphLines[index].PointB = new Vector3(graphLines[index].PointA.X,
                                                           graphLines[index].PointA.Y - graphLines[index].Height, position.Z);
                }
            }
            this.log.WriteInformation("{0} TimeLines generated!", this.graphLines.Length);

            this.log.WriteInformation("Content generated!");
        }