示例#1
0
        public Enemy(SpacePartitioner world, Sprite sprite, float hitboxRadius, float scale, float speed, float health, float armor, float damage, float layerDepth)
            : base(world)
        {
            Sprite       = sprite;
            HitboxRadius = hitboxRadius;
            Scale        = scale;
            Speed        = speed;
            Health       = health;
            Armor        = armor;
            Damage       = damage;
            LayerDepth   = layerDepth + ExtraDepth;

            AiController = new EnemyAiController(this);
            ExtraDepth  += 0.00001f;
        }
示例#2
0
        public EnemyManager()
        {
            float gridWidth  = 140;
            Point mapSize    = MapManager.LoadedMap.GroundTexture.Bounds.Size;
            Point totalGrids = new Point((int)Math.Ceiling(mapSize.X / gridWidth), (int)Math.Ceiling(mapSize.Y / gridWidth));
            Point gridSize   = new Point((int)Math.Ceiling(mapSize.X / (float)totalGrids.X), (int)Math.Ceiling(mapSize.Y / (float)totalGrids.Y));

            spacePartitioner = new SpacePartitioner(totalGrids, gridSize);

            font       = AssetManager.GetFont("BaseFont");
            layerDepth = SortingOrder.GetLayerDepth(0, SortingLayer.Ui);

            DebugWorldDivider = false;
            ControllerGroupId = new HashSet <int>();
            ViewGroupId       = new HashSet <int>();
            Enabled           = true;
        }
示例#3
0
 public SpaceUnit(SpacePartitioner spacePartitioner)
 {
     this.World      = spacePartitioner;
     OldCellPosition = null;
     hash            = currentHash++;
 }