예제 #1
0
 /// <summary>
 /// how to activate this mode
 /// </summary>
 /// <param name="entity"></param>
 public void Activate(Entity entity)
 {
     if (entity is CaveBlueprint)
         this.cave = (CaveBlueprint)entity;
     else
         this.scene.DisposeCurrentModeHandler();
 }
예제 #2
0
파일: Cave.cs 프로젝트: XF9/Fenrir
        /// <summary>
        /// Creates a cave
        /// </summary>
        /// <param name="blueprint">the shape of the cave</param>
        /// <param name="offset"></param>
        public Cave(Caves.CaveBlueprint blueprint, Point offset)
        {
            this.blockers         = new List <Point>();
            this.caveBlocksToMine = new List <Point>();
            this.modelName        = blueprint.CaveModel;

            foreach (Point blocker in blueprint.Blockers)
            {
                this.blockers.Add(new Point(blocker.X + offset.X, blocker.Y + offset.Y));
            }

            foreach (Point cavePart in blueprint.CaveBlocks.Keys)
            {
                this.caveBlocksToMine.Add(new Point(cavePart.X + offset.X, cavePart.Y + offset.Y));
            }

            this.cavePosition = new Vector3(offset.X * FenrirGame.Instance.InGame.Scene.Properties.TileSize, offset.Y * FenrirGame.Instance.InGame.Scene.Properties.TileSize, -1);
        }
예제 #3
0
파일: Scene.cs 프로젝트: XF9/Fenrir
        /// <summary>
        /// prepares a new world
        /// </summary>
        public void InitializeWorld()
        {
            // initialize variables
            this.blocks = new Dictionary<Point, Block>[this.Properties.MaxBlockDepth];

            for (int i = 0; i < this.Properties.MaxBlockDepth; i++)
                this.blocks[i] = new Dictionary<Point, Block>();

            this.markers = new Dictionary<Point, Marker>();
            this.units = new List<Entities.Unit>();
            this.buildings = new List<Building>();
            this.caves = new List<Cave>();

            this.units.Add(new Entities.Unit(DataIdentifier.modelPlayerUnit, new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0, 4, -1), "Herbert"));
            this.units.Add(new Entities.Unit(DataIdentifier.modelPlayerUnit, new Vector3(0.5f, 0.5f, 0.5f), new Vector3(-2, 4, -1), "Torben"));

            this.buildings.Add(new Building(DataIdentifier.modelBuildingCampfire, new Vector3(2, 1, 1), new Vector3(-4, 4, -3)));

            this.mouseSurface = new Plane(Vector3.UnitZ, 0);

            // generate the world
            this.GenerateNewWorld();

            // generate cave models
            this.smallCave = new SmallCave();
            this.mediumCave = new MediumCave();
            this.largeCave = new LargeCave();

            this.unitHandler = new ControlModeHandler.UnitHandler(this);
            this.buildCaveHandler = new ControlModeHandler.BuildCaveHandler(this);
            this.buildTunnelHandler = new ControlModeHandler.BuildTunnelHandler(this);
            this.clearTunnelHandler = new ControlModeHandler.ClearTunnelHandler(this);
            this.currentModeHandler = null;
        }