예제 #1
0
        protected bool[,] DiscoverTile(float x, float y, Entity entityRef, int perception, bool[,] visionRef)
        {
            bool[,] vision = visionRef;

            float oX = entityRef.WorldPosition.x + 0.5f;
            float oY = entityRef.WorldPosition.y + 0.5f;

            int arrayX = vision.GetLength(0);
            int arrayY = vision.GetLength(1);

            for (int i = 0; i < perception; i++)
            {
                if (oX < 0.0f || oY < 0.0f || oX >= arrayX || oY >= arrayY)
                {
                    return(vision);
                }

                int posX = (int)oX;
                int posY = (int)oY;

                vision[posX, posY] = true;
                if (Walls.ContainsKey(new Vector2Int(posX, posY)))
                {
                    return(vision);
                }

                oX += x;
                oY += y;
            }

            return(vision);
        }
예제 #2
0
 public Texture2D GetWall(int num)
 {
     if (!Walls.ContainsKey(num))
     {
         string name = $"Images\\Wall_{num}";
         Walls[num] = LoadTexture(name);
     }
     return(Walls[num]);
 }
예제 #3
0
 public Texture2D GetWall(int num)
 {
     if (!Walls.ContainsKey(num))
     {
         string name = String.Format("Images\\Wall_{0}", num);
         Walls[num] = LoadTexture(name);
     }
     return(Walls[num]);
 }
예제 #4
0
        /// <summary>
        /// Adding Walls to the world,  They are never updated. Only added once.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="message"></param>
        public void AddWall(JObject obj, string message)
        {
            // Get the object
            int  id   = (int)obj.First;
            Wall wall = JsonConvert.DeserializeObject <Wall>(message);

            // Add if object does not exist yet.
            if (!Walls.ContainsKey(id))
            {
                Walls.Add(id, wall);
            }
        }
예제 #5
0
        public bool WallCheck()
        {
            bool    updated = false;
            Vector3 me      = Core.Me.Location;

            wallList.Clear();
            if (_walls == null)
            {
                return(false);
            }

            foreach (KeyValuePair <uint, List <Vector3> > id in _walls.Where(i =>
                                                                             i.Value[0].Distance2D(Core.Me.Location) < 5 && !Walls.ContainsKey(i.Key) &&
                                                                             !_activeWalls.Contains(i.Key)))
            {
                Vector3 wall1 = id.Value[1];
                wall1.Y -= 5;

                Vector3 wall2 = id.Value[2];
                wall2.Y -= 10;

                wallList.Add(new BoundingBox3 {
                    Min = wall1, Max = wall2
                });
                Walls.Add(id.Key, true);
                updated = true;
            }

            //Logger.Debug($"[walls] {string.Join(", ", _hit.Keys)}");

            return(updated);
        }
예제 #6
0
        private bool WallCheck()
        {
            var updated = false;
            var me      = Core.Me.Location;

            foreach (var id in _walls.Where(i => i.Value[0].Distance2D(Core.Me.Location) < 50 && !Walls.ContainsKey(i.Key) && !activeWalls.Contains(i.Key)))
            {
                var wall1 = id.Value[1];
                wall1.Y -= 2;

                wallList.Add(new BoundingBox3 {
                    Min = wall1, Max = id.Value[2]
                });
                Walls.Add(id.Key, true);
                updated = true;
            }

            //Logger.Info($"[walls] {string.Join(", ", _hit.Keys)}");

            return(updated);
        }