상속: MonoBehaviour
예제 #1
0
        private void Run()
        {
            Save();

            bool proceed = true;

            if (s_levelData == null)
            {
                proceed = false;
                EditorUtility.DisplayDialog("Error", "No level data file configured.", "Ok");
            }

            if (proceed && s_defaultMaterials[0] == null)
            {
                proceed = false;
                EditorUtility.DisplayDialog("Error", "No solid material configured.", "Ok");
            }

            if (proceed)
            {
                Debug.ClearDeveloperConsole();
                TemplateMaterials.Reset();
                Wm3Loader loader = new Wm3Loader();
                loader.LoadWM3(s_levelData);
                Wm3Data      data    = loader.Data;
                LevelBuilder builder = new LevelBuilder();
                builder.Construct(data);
            }
        }
예제 #2
0
        public Act2()
        {
            var town = new LevelBuilder("Act 2 - Town");

            root  = town.Instantiate(new Vector2i(0, 0));
            entry = town.FindEntry();
        }
예제 #3
0
 void Start()
 {
     hasJumped = false;
     rb2d = GetComponent<Rigidbody2D>();
     Board = GameObject.FindGameObjectsWithTag("GameController");
     levelBuilder = Board[0].GetComponent<LevelBuilder>();
 }
예제 #4
0
 void Awake()
 {
     aud = GetComponent<AudioSource>();
     cam = Camera.main;
     levelWidth = cam.GetComponent<CameraController>().levelWidth;
     builder = GameObject.Find("Game Controller").GetComponent<LevelBuilder>();
 }
예제 #5
0
파일: Act1.cs 프로젝트: sausage88/Diablerie
        static LevelBuilder CreateDenOfEvil()
        {
            var builder = new LevelBuilder("Act 1 - Cave 1");
            var palette = new Maze.Palette();

            palette.special = new LevelPreset[][] {
                new LevelPreset[] {
                    LevelPreset.Find("Act 1 - Cave Prev W"),
                    LevelPreset.Find("Act 1 - Cave Prev E"),
                    LevelPreset.Find("Act 1 - Cave Prev S"),
                    LevelPreset.Find("Act 1 - Cave Prev N")
                },
                new LevelPreset[] {
                    LevelPreset.Find("Act 1 - Cave Den Of Evil W"),
                    LevelPreset.Find("Act 1 - Cave Den Of Evil E"),
                    LevelPreset.Find("Act 1 - Cave Den Of Evil S"),
                    LevelPreset.Find("Act 1 - Cave Den Of Evil N")
                }
            };
            palette.rooms = new LevelPreset[16];
            for (int i = 0; i < 15; ++i)
            {
                palette.rooms[i + 1] = LevelPreset.sheet[53 + i];
            }
            palette.themedRooms = new LevelPreset[16];
            for (int i = 0; i < 15; ++i)
            {
                palette.themedRooms[i + 1] = LevelPreset.sheet[68 + i];
            }
            Maze.Generate(builder, palette);
            return(builder);
        }
    public static void DirectionalButtons(IAction action, int sidesToRender = -1)
    {
        Transform transform = (action as MonoBehaviour).GetComponent <Transform>() as Transform;

        LevelBuilder levelBuilder = LevelBuilder.lastBuilder;

        if (levelBuilder != null)
        {
            if ((sidesToRender & 0x4) != 0)
            {
                LevelBuilderCommon.Default5ActionButton(transform.position + new Vector3(1.5f, 0, 0), action, -1, Direction.Right);
            }
            if ((sidesToRender & 0x2) != 0)
            {
                LevelBuilderCommon.Default5ActionButton(transform.position + new Vector3(-1.5f, 0, 0), action, -1, Direction.Left);
            }
            if ((sidesToRender & 0x1) != 0)
            {
                LevelBuilderCommon.Default5ActionButton(transform.position + new Vector3(0, 0, 1.5f), action, -1, Direction.Forward);
            }
            if ((sidesToRender & 0x8) != 0)
            {
                LevelBuilderCommon.Default5ActionButton(transform.position + new Vector3(0, 0, -1.5f), action, -1, Direction.Backward);
            }
        }
    }
예제 #7
0
        private void bRunAgent_Click(object sender, EventArgs e)
        {
            //Thread t = new Thread(() =>
            //    {
            Game1 game = StaticData.EngineManager.Game1;

            PairCTP.Sort(PairCTPComparator);
            GenSimAgentWrapper agent = new GenSimAgentWrapper(this.PairCTP, 20, false);

            agent.ScatterComps();

            StaticData.EngineManager.Game1 = game;
            if (agent.WAgent.IsSuccess)
            {
                LevelBuilder.CreateRestedLevel(agent.WAgent.LevelStr, false);
                CTRLevelDesigner.SaveEngineState();
                StaticData.GameSessionMode = SessionMode.PlayingMode;
                LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                simulator.SimulateSameWindow(agent.WAgent.Actions);
            }
            else
            {
                MessageBox.Show("Max number of try is reached. Run the agent again.");
            }

            //});
            //t.Start();
        }
    private string level_name;                  // Custom level name
    // TODO: custom level names regex check for invalid chars

	void Awake ()
	{
		camera_script        = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
        level_builder_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<LevelBuilder>();
        grid_script          = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Grid>();
        levels_script        = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Levels>();
	}
예제 #9
0
 void Start()
 {
     canvas.SetActive(true);
     levelBuilder = GetComponent <LevelBuilder>();
     uiManager    = GetComponent <UIManager>();
     mc           = GetComponent <MenuController>();
 }
 private void DrawBrickChange(LevelBuilder script)
 {
     GUILayout.Space(15);
     GUILayout.Label("Switch Brick to");
     if (GUILayout.Button("Normal"))
     {
         script.SwitchBrickToType(BrickType.NORMAL);
     }
     if (GUILayout.Button("Bomb"))
     {
         script.SwitchBrickToType(BrickType.BOMB);
     }
     if (GUILayout.Button("Portal"))
     {
         script.SwitchBrickToType(BrickType.END);
     }
     if (GUILayout.Button("Unbreakable"))
     {
         script.SwitchBrickToType(BrickType.UNBREAKABLE);
     }
     if (GUILayout.Button("Boom Bot"))
     {
         script.SwitchBrickToType(BrickType.BOOM_BOT);
     }
     if (GUILayout.Button("Random Boom Bot"))
     {
         script.SwitchBrickToType(BrickType.RANDOM_BLOW);
     }
     if (GUILayout.Button("Path"))
     {
         script.SwitchBrickToType(BrickType.PATH);
     }
 }
예제 #11
0
        public static void GenerateStatesFilesPlayabilityFromLevelsActionsFiles()
        {
            //            string path = "160LevelSameCompsPlayable.txt";
            string       path = "PhysicsEngine_EvolvePlayActions - BadRemoved.txt";
            StreamReader sr   = new StreamReader(path);
            string       line = String.Empty;

            while ((line = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(line.Split('\t')[12], false);

                StaticData.GameSessionMode          = SessionMode.PlayingMode;
                ActionsExecuterGenSim.ListOfActions = new ActionsGenerator(line.Split('\t')[13]).Actions;
                ActionsExecuterGenSim.IsSimulatingGamePlayability = true;
                ActionsExecuterGenSim.nextActionIndex             = 0;
                ActionsExecuterGenSim.isFinished        = false;
                ActionsExecuterGenSim.IsSaveStateToFile = true;
                ActionsExecuterGenSim.IsSaveImage       = true;
                // 1300: arbitrary choice above the 80 max actions
                var gameTime = new GameTime();
                for (int i = 0; i < 1300; i++)
                {
                    ActionsExecuterGenSim.ManipulateActions(gameTime);
                    StaticData.EngineManager.Update(gameTime);
                }
                FilesCounter++;
            }
            sr.Close();
        }
예제 #12
0
        /// <summary>
        /// Builds a new game using the ruby script
        /// </summary>
        /// <returns>The new Game</returns>
        public GameModel BuildModel()
        {
            // build game objects
            LevelBuilder levelBuilder = new LevelBuilder(this.configuration, this.playerHandler);
            ScriptEngine scriptEngine = IronRuby.Ruby.CreateEngine();
            ScriptScope scriptScope = scriptEngine.CreateScope();
            scriptScope.SetVariable("level", levelBuilder);
            scriptScope.SetVariable("physic", new RubyPhysic(GameAssets.G, GameAssets.N));
            try
            {
                ScriptSource source = scriptEngine.CreateScriptSourceFromFile(this.path);
                source.Compile();
                source.Execute(scriptScope);
            }
            catch (Exception e)
            {
                string errorMessage = "[" + this.path + "]\nError: " + e.Message;
                System.Windows.Forms.MessageBox.Show(errorMessage);
            }

            // build ShortLifespanObjectFactory
            ShortLifespanObjectFactory shortLifespanObjectFactory = new SimpleShortLifespanObjectFactory();

            // build game model
            World world = new World(levelBuilder.WorldObjects);
            Physics physics = new SimplePhysicsAlgorithm(this.collisionHandler, world, configuration);
            GameModel gameModel = new GameModel(shortLifespanObjectFactory, physics, levelBuilder.Players, world);
            return gameModel;
        }
예제 #13
0
 private void Start()
 {
     if (levelBuilder == null)
     {
         levelBuilder = Camera.main.GetComponent <LevelBuilder>();
     }
 }
예제 #14
0
 void Awake()
 {
     LevelBuilderInstance = this;
     lv            = new List <Level>();
     numberOflevel = LevelName.Length;
     loadLevel();
 }
예제 #15
0
 /// <summary>
 /// Click action, might start a level or move to the next one.
 /// </summary>
 public void TaskOnClick()
 {
     if (!inGame && start)
     {
         menu.alpha          = 0f;
         menu.blocksRaycasts = false;
         LevelBuilder builder   = generator.getBuilder();
         GameObject   tmpCamera = GameObject.FindGameObjectWithTag("Temporary");
         Destroy(tmpCamera);
         generator.LevelStart();
         inGame = true;
         start  = false;
         end    = false;
     }
     else if (!inGame && !start && end)
     {
         menu.alpha          = 0f;
         menu.blocksRaycasts = false;
         generator.NextLevel();
         inGame = true;
     }
     else if (!inGame && gameOver)
     {
         menu.alpha          = 0f;
         menu.blocksRaycasts = false;
         generator.DestroyLevel();
         generator.LevelStart();
         GameObject.FindGameObjectWithTag("Player").GetComponent <PookieController>().setCash(0);
         inGame = true;
         start  = false;
         end    = false;
     }
 }
예제 #16
0
        public static void TestPlayabilityFromLevelsFile(string path, bool isSaveImage)
        {
            //OpenFileDialog op = new OpenFileDialog();
            //op.Title = @"Choose levels file";
            String pathReader = path;
            //if (op.ShowDialog() == DialogResult.OK)
            //{
            //    pathReader = op.FileName;
            //}
            StreamReader sr           = new StreamReader(pathReader);
            StreamWriter sw           = new StreamWriter(@"ResultsPlayabilityCheck.txt", true);
            String       currentLevel = String.Empty;

            while ((currentLevel = sr.ReadLine()) != null)
            {
                LevelBuilder.CreateRestedLevel(currentLevel, true);
                RyseAgent agent = new RyseAgent(10);
                agent.IsSaveImage               = isSaveImage;
                agent.maxDepthArr               = 0;
                agent.prologTime                = 0;
                agent.nodesExplored             = 0;
                agent.bestClosestFrogCookieDist = Double.MaxValue;
                agent.bestPerformedActions      = new List <Action>();
                agent.Simulator = new PlayabilitySimulatorEngineProlog(agent.IsSaveImage);
                bool           playability      = false;
                List <Action>  performedActions = new List <Action>();
                List <Vector3> performedVel     = new List <Vector3>();

                DateTime   d1   = DateTime.Now;
                ActionNode node = new ActionNode(new VoidAction());
                agent.SimulatePlayability(node, StaticData.EngineManager, ref playability, 0, performedActions, performedVel, 0, PlayabilityCheckMode.NormalCheck);
                DateTime d2 = DateTime.Now;
                agent.totalTime = (int)((d2 - d1).TotalSeconds);

                // Write to file

                sw.WriteLine(playability
                             + "\t" + agent.prologTime / 1000
                             + "\t" + agent.totalTime
                             + "\t" + String.Format("{0:0.00}", agent.bestClosestFrogCookieDist)
                             + "\t" + agent.maxDepthArr
                             + "\t" + agent.nodesExplored
                             + "\t" + currentLevel
                             + "\t" + HelperModules.GenericHelperModule.GetActionsString(agent.bestPerformedActions)
                             );
                Console.WriteLine(playability);
                // write to db
                //DatabaseHandler.InsertToPlayabilityTestTable(1,
                //                                             playability,
                //                                             prologTime / 1000,
                //                                             totalTime,
                //                                             String.Format("{0:0.00}", bestClosestFrogCookieDist),
                //                                             maxDepthArr,
                //                                             nodesExplored,
                //                                             _strLevel,
                //                                             HelperModules.GenericHelperModule.GetActionsString(bestPerformedActions));
                sw.Flush();
            }
            sw.Close();
        }
        public void AttachingAMonstor_WillReduceItsHitPoints()
        {
            var state = MeleeWeapon.FormatState("Wooden Club", "Me1", 1, 12, -1, 1, 7.5, 0, 50);

            var testNum           = 1;
            var fakeRandomNumbers = GetGenerator(testNum);
            var registry          = new DispatchRegistry();
            var dispatcher        = new Dispatcher(registry);
            var fakeLogger        = new FakeLogger(_output);
            var mazeDescriptor    = FakeMazeDescriptorBuilder.Build(1, 1, 4, 2);

            var builder = new LevelBuilder(fakeRandomNumbers, mazeDescriptor, fakeLogger, dispatcher, registry);

            builder.Build(testNum);

            var me = ActorBuilder.Build <Me>(Coordinate.NotSet, registry, Me.FormatState(10, 10));

            dispatcher.EnqueueTeleport(me);
            var monster = ActorBuilder.Build <Monster>(Coordinate.NotSet, registry, Monster.FormatState(10, 10));

            dispatcher.EnqueueTeleport(monster);
            dispatcher.Dispatch();

            var weapon = new MeleeWeapon(fakeRandomNumbers, registry, dispatcher, state);

            dispatcher.EnqueueUse(weapon, Compass8Points.East);
            dispatcher.Dispatch();

            monster = (Monster)registry.GetDispatchee(monster.UniqueId);
            var expected = "HitPoints [7], ArmourClass [10]";
            var actual   = $"HitPoints [{monster.HitPoints}], ArmourClass [{monster.ArmourClass}]";

            Assert.Equal(expected, actual);
        }
예제 #18
0
 void Start()
 {
     ship      = GameObject.Find("Ship").GetComponent <Ship>();
     builder   = GameObject.Find("CubeContainer").GetComponent <LevelBuilder>();
     startText = GameObject.Find("StartText");
     ship.onCollision.AddListener(Restart);
 }
예제 #19
0
 private void bCheckPlayabilty_Click(object sender, EventArgs e)
 {
     try
     {
         RYSEGenManager.SimulatePlayabiltityFromDesigner();
         SaveEngineState();
         try
         {
             if (DesignEnhanceManager.PlayabilityActions != String.Empty)
             {
                 LevelBuilder.CreateRestedLevel(DesignEnhanceManager.GevaLevel, false);
                 //RYSEManager manager = new RYSEManager(10);
                 //manager.IsSaveImage = false;
                 StaticData.GameSessionMode = SessionMode.PlayingMode;
                 //EngineShotsManager.ShowXNAWindow();
                 LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);
                 simulator.SimulateSameWindow(new ActionsGenerator(DesignEnhanceManager.PlayabilityActions).Actions);
             }
         }
         catch (Exception)
         {
         }
     }
     catch (Exception)
     {
     }
 }
예제 #20
0
        public void Move_Me_CanMoveIntoEmptySpace()
        {
            var testNum    = 1;
            var registry   = new DispatchRegistry();
            var dispatcher = new Dispatcher(registry);

            var fakeRandomNumbers = GetGenerator(testNum);
            var fakeLogger        = new FakeLogger(_output);
            var mazeDescriptor    = FakeMazeDescriptorBuilder.Build(1, 1, 4, 2);

            var builder = new LevelBuilder(fakeRandomNumbers, mazeDescriptor, fakeLogger, dispatcher, registry);

            builder.Build(GetLevel(testNum));
            var me = ActorBuilder.Build <Me>(Coordinate.NotSet, registry, Me.FormatState(10, 10));

            dispatcher.EnqueueTeleport(me);
            dispatcher.Dispatch();

            // t+1
            dispatcher.EnqueueMove(me, Compass8Points.South);
            dispatcher.Dispatch();

            var expected = GetExpectation(testNum);
            var actual   = registry.GetDispatchee("Maze1").ToString();

            _output.WriteLine(expected);
            _output.WriteLine('='.ToPaddedString(10));
            _output.WriteLine(actual);

            Assert.Equal(expected, actual);
        }
예제 #21
0
        public List <Level> Load()
        {
            var loader     = new XmlScopeReader(new ResourceScopeReader());
            var levelsInfo = loader.LoadAll <LevelInfo>(Strings.LEVELS_PATH);

            return(levelsInfo.Select(lvl => LevelBuilder.Restore(lvl)).ToList());
        }
예제 #22
0
    static Vector2i CreateAct5()
    {
        var town = new LevelBuilder("Act 5 - Town");

        town.Instantiate(new Vector2i(0, 0));
        return(town.FindEntry());
    }
예제 #23
0
        /// <summary>
        /// Builds a rectangular room of the specified dimensions.
        /// </summary>
        /// <param name="builder">The level builder.</param>
        /// <param name="upperLeft">The absolute position of the upper left point of the room.</param>
        /// <param name="size">The width and height of the room.</param>
        /// <returns>The unique identifier of the room.</returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// size - The X size of a constructed room must be greater than zero.
        /// or
        /// size - The Y size of a constructed room must be greater than zero.
        /// </exception>
        /// <exception cref="System.ArgumentOutOfRangeException">size - The X and Y sizes of a constructed room must each be greater than zero.</exception>
        public Guid AddRectangularRoom(LevelBuilder builder, Pos2D upperLeft, Pos2D size)
        {
            // Validate
            if (size.X <= 0 || size.Y <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(size),
                                                      "The X and Y sizes of a constructed room must be greater than zero.");
            }

            var roomGuid = Guid.NewGuid();

            // Loop through the bounds and add the requested room
            for (var x = upperLeft.X; x <= upperLeft.X + size.X - 1; x++)
            {
                for (var y = upperLeft.Y; y <= upperLeft.Y + size.Y - 1; y++)
                {
                    var isOnEdge = x == upperLeft.X ||
                                   x == upperLeft.X + size.X - 1 ||
                                   y == upperLeft.Y ||
                                   y == upperLeft.Y + size.Y - 1;

                    char terrain = isOnEdge ? '#' : '.';

                    var cell = builder.BuildCell(terrain, new Pos2D(x, y));
                    builder.AddCell(cell, roomGuid);
                }
            }

            return(roomGuid);
        }
예제 #24
0
    public void SaveLevel()
    {
        saveLevelButtons.interactable = false;

        List <GameObject> gameElements = new List <GameObject>();

        for (int i = 0; i < mainElementsEditor.childCount; ++i)
        {
            gameElements.Add(mainElementsEditor.GetChild(i).gameObject);
        }

        Level lvl = LevelBuilder.BuildLevel(PuzzleEditorController.instance.levelSize, gameElements, PuzzleEditorController.instance.baseTM, PuzzleEditorController.instance.collidable);

        if (levelLoaded.name == levelName.text)
        {
            lvl.id = levelLoaded.id;
        }
        lvl.name        = levelName.text;
        lvl.description = levelDescription.text;
        lvl.creatorName = username;

        levelLoaded = lvl;

        LevelBuilder.SaveLevel(lvl);
    }
예제 #25
0
 // Start is called before the first frame update
 void Start()
 {
     lb = GetComponent <LevelBuilder>();
     v3CameraStartPos = goCamera.transform.position;
     qCameraStartRot  = goCamera.transform.rotation;
     Init();
 }
예제 #26
0
    private void OnValidate()
    {
        LevelBuilder lb = (LevelBuilder)target;

        lb.level.Name       = levelName;
        lb.level.Board.name = boardName;
    }
        public void WhenBuiltDispatcher_ShouldHaveMeInMaze(int testNum, int blocksPerTile)
        {
            var registry   = new DispatchRegistry();
            var dispatcher = new Dispatcher(registry);

            var fakeRandomNumbers = GetGenerator(testNum);
            var fakeLogger        = new FakeLogger(_output);
            var mazeDescriptor    = FakeMazeDescriptorBuilder.Build(1, 1, 4, blocksPerTile);

            var builder = new LevelBuilder(fakeRandomNumbers, mazeDescriptor, fakeLogger, dispatcher, registry);

            builder.Build(testNum);
            var me = new Me(Coordinate.NotSet, registry, Me.FormatState(10, 10));

            dispatcher.EnqueueTeleport(me);
            dispatcher.Dispatch();

            var maze   = registry.GetDispatchee("Maze1");
            var actual = maze.ToString();

            var expected = GetExpectation(testNum);

            _output.WriteLine(expected);
            _output.WriteLine('='.ToPaddedString(10));
            _output.WriteLine(actual);

            Assert.Equal(expected, actual);
        }
예제 #28
0
파일: Maze.cs 프로젝트: whatsalem/Diablerie
 public static void Generate(LevelBuilder builder, Palette palette)
 {
     Clear();
     GenerateRooms(builder.info.maze.rooms[0]);
     GenerateSpecialRooms(palette);
     Build(builder, palette);
 }
예제 #29
0
 // Update is called once per frame
 void Update()
 {
     LevelBuilder.lastBuilder = this;
     this.CheckForLevel();
     this.CheckForRoot();
     this.CheckForSelection(Selection.activeGameObject);
     SceneView.RepaintAll();
 }
예제 #30
0
        public void Setup()
        {
            GameObject levelBuilderGO = MonoBehaviour.Instantiate(Resources.Load("LevelBuilderTest") as GameObject);

            levelBuilder = levelBuilderGO.GetComponent <LevelBuilder>();
            enemies      = levelBuilder.BuildLevel(ScriptableObject.CreateInstance <LevelConfig>());
            levelBuilder.Player.SetData(ScriptableObject.CreateInstance <PlayerConfig>());
        }
예제 #31
0
        private static void SimulateOnWindow(GenSimAgent agent)
        {
            LevelBuilder.CreateRestedLevel(agent.LevelStr, false);
            StaticData.GameSessionMode = SessionMode.PlayingMode;
            LivePlayabilitySimulator simulator = new LivePlayabilitySimulator(StaticData.EngineManager);

            simulator.SimulateNewWindow(agent.Actions, false, false);
        }
예제 #32
0
    // TRACKS + PROBES

    public static void BuildProbes(string track)
    {
        LevelBuilder builder = new LevelBuilder(track);

        LevelBuilder.BuildStages buildStages = new LevelBuilder.BuildStages();
        buildStages.BakeLightProbes = true;
        builder.BuildByName(buildStages);
    }
예제 #33
0
 public static void AddLevelBuiltInvoker(LevelBuilder invoker)
 {
     LevelBuiltInvokers.Add(invoker);
     foreach (var levelBuiltListener in LevelBuiltListeners)
     {
         invoker.AddLevelBuiltListener(levelBuiltListener);
     }
 }
예제 #34
0
 public void ConstructComplexLevel(LevelBuilder builder)
 {
     builder.BuildFloor();
     for (int i = 0; i < 10; i++)
     {
         builder.BuildNPC();
     }
 }
예제 #35
0
 void Awake()
 {
     options = GlobalOptions.Instance;
     LevelBuilder = GameObject.Find("LevelBuilder").GetComponent<LevelBuilder>();
     brickBuilder = GameObject.Find("LevelBuilder").GetComponent<BrickBuilder>();
     if (brickBuilder != null) {
         totalPoints = brickBuilder.totalPoints;
     }
     //numberOfTeams = GameObject.Find("LevelBuilder").GetComponent<LevelBuilder>().numberOfTeams;
 }
예제 #36
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != null)
            Destroy (gameObject);

        DontDestroyOnLoad (gameObject);
        levelScript = GetComponent<LevelBuilder> ();
        InitGame ();
    }
        public override void Initialize()
        {
            //Let's grab a reference to the other services that we'll need!
            gameObjectManager = GameServiceManager.GetService<IGameObjectManager>();
            physicsManager = GameServiceManager.GetService<IPhysicsManager>();
            renderer = GameServiceManager.GetService<IRenderer>();

            levelBuilder = new LevelBuilder();
            levelBuilder.Initialize();

            GameOver = false;
        }
예제 #38
0
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            soundManager = new Sounds();
            levelBuilder = new LevelBuilder();
            textures = new Textures();

            soundManager.LoadSounds(content);
            textures.LoadTextures(content);

            hud = new HeadsUpDisplay(400, ScreenManager.Font);
            marimo = new Marimo(new Vector2(32, 192), ScreenManager.GetInput());
            world = new World(levelBuilder, marimo);

            font = content.Load<SpriteFont>("myFont");

            LevelBuilder.LoadLevelFile(Player.World + "-" + Player.Level);

            base.LoadContent();

            Sounds.Play(Sounds.Music.overworld);
        }
예제 #39
0
 private void convertOldHTFsToIPhoneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LevelBuilder lb = new LevelBuilder();
     //lb.ConvertHTFsToiPhone(levelPanel1.SelectedLevel);
 }
예제 #40
0
 void Awake()
 {
     levelBuilder = GameObject.Find("Bricks").GetComponent<LevelBuilder>() as LevelBuilder;
 }
예제 #41
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
     levelBuilder = new LevelBuilder();
     buffer = 0;
     base.Initialize();
 }
예제 #42
0
 // Use this for initialization
 void Start()
 {
     levelBuilder = GameObject.Find("LevelBuilder").GetComponent<LevelBuilder>();
 }
예제 #43
0
 void Awake()
 {
     if (!created) {
         Debug.Log ("Create new levelbuilder" + " " + this.gameObject.GetInstanceID());
         Screen.sleepTimeout = SleepTimeout.NeverSleep;
         DontDestroyOnLoad(this.gameObject);
         LevelBuilder.instance = this;
         gameStartedAt = Time.time;
         created = true;
     }
     else {
         Debug.Log("Bad level builder, bad!" + " " + this.gameObject.GetInstanceID());
         DestroyImmediate(this.gameObject);
     }
 }
예제 #44
0
 void Awake()
 {
     Messenger.AddListener(typeof(PickupCollectedMessage),HandlePickupCollectedMessage);
     Messenger.AddListener(typeof(PlayerDistanceMessage),HandlePlayerDistanceMessage);
     mInstance = this;
 }
예제 #45
0
    // Use this for initialization
    void Awake()
    {
        Score = GameObject.Find("SCORE").GetComponent<Score>();
        Descriptions Descriptions = new Descriptions();
        StoryTasks = Descriptions.GetStoryTasks();
        StoryPhases = Descriptions.GetPhaseTitles();
        RandomGuyJokes = Descriptions.GetRandomGuyJokes();
        LevelOverScreen = LevelOverPopup.GetComponent<LevelOverScreen>();
        Inventory = new Inventory ();

        // TESTING ONLY
        Inventory.AddToInventory("knife");
        Inventory.AddToInventory("detergent");

        LevelBuilder = GameObject.Find("Camera").GetComponent<LevelBuilder>();
        ObjectiveScreen = GameObject.Find("Camera").GetComponent<ObjectiveScreen>();
        TaskTracker = GameObject.Find ("Camera").GetComponent<TaskTracker>();

        // TESTING ONLY
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
        //GetRandomJokeBasedOn(Enums.Prisoner.Fatty);
        //GetRandomJokeBasedOn(Enums.Prisoner.Midget);
        //GetRandomJokeBasedOn(Enums.Prisoner.Skinny);
    }
예제 #46
0
    private void InitLevelBuilder()
    {
        int LevelSize = LevelMapDirector.GetLevelSize();

        Builder = new LevelBuilder ();
        Builder.SetLevelSize (LevelSize);
        Builder.BuildLevelGrid ();
        Builder.BuildLevelBorder ();

        GameObject WeaponFactoryObject = GameObject.Find("WeaponManager");
        WeaponDirector = WeaponFactoryObject.GetComponent<WeaponsManager>();
    }
예제 #47
0
파일: LevelBuilder.cs 프로젝트: Gkxd/Jenga
    void Start()
    {
        blockHeight = blockPrefab.transform.localScale.y;
        blockWidth = blockPrefab.transform.localScale.x;

        StateSystem.SetBlockDimensions(blockWidth, blockHeight);

        buildLevel();
        instance = this;
    }
예제 #48
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            if (world == null)
            {
                world = new World(new Vector2(0, 9.82f));
            }
            else
            {
                world.Clear();
            }

            this.IsMouseVisible = true;

            lvlBuilder = new LevelBuilder(Content, world);
            lvlBuilder.readLevel("level1.txt");

            backgroundTexture = Content.Load<Texture2D>("cornflowerback");

            objectList = lvlBuilder.getLevelObjects();

            //FarseerPhysics.Collision
            font = Content.Load<SpriteFont>("font");

            debugView = new DebugViewXNA(world);
            debugView.LoadContent(this.GraphicsDevice, this.Content);
            debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Shape);
            debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PolygonPoints);
            //debugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel);
            debugView.AppendFlags(FarseerPhysics.DebugViewFlags.CenterOfMass);
            // TODO: use this.Content to load your game content here
        }
    private LevelBuilder level_builder_script;  // Reference to level builder
	
	void Awake ()
	{
		GM = GameManager.instance;
        level_builder_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<LevelBuilder>();
        DontDestroyOnLoad(this); // to allow the scene to change
	}
예제 #50
0
 private void selectedLevelToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LevelBuilder lb = new LevelBuilder();
     lb.Build(levelPanel1.SelectedLevel);
 }