void LoadMap(string mapString)
        {
            ClearMap();

            var mapLoader = new MapLoader();

            mapLoader.loadMap(mapString);
            Blocks    = mapLoader.MapBlocks;
            GameLogic = YamlConfigParser.GameLogic;
            var mapBuilder = new MapBlockBuilder(Blocks, Prefabs, ref MapObject);

            mapBuilder.Build();
            MovePlayer(YamlConfigParser.Player.Start[0] - 1, YamlConfigParser.Player.Start[1] - 1, YamlConfigParser.Player.Rotation);


            var miniMapController = MiniMapController.getInstance();

            miniMapController.Rows    = mapLoader.Rows;
            miniMapController.Columns = mapLoader.Columns;

            foreach (var mapBlock in mapLoader.MapBlocks.Values)
            {
                miniMapController.Cells.Add(mapBlock.Location);
            }

            miniMapController.visit(startLocation);
        }
示例#2
0
        private void Update()
        {
            MiniMapController.getInstance().PlayerLocation = m_CurrentLocation;
            visitCurrentLocationOnMinimap();

            if (HeadCamera != null && TopCamera != null)
            {
                if (Input.GetButtonDown("MapOverview"))
                {
                    HeadCamera.enabled = !HeadCamera.enabled;
                    TopCamera.enabled  = !TopCamera.enabled;
                }
            }

            var action = GetAction();

            if (action != null)
            {
                action();
            }
        }
示例#3
0
        private void visitCurrentLocationOnMinimap()
        {
            var miniMapController = MiniMapController.getInstance();

            miniMapController.visit(m_CurrentLocation);
        }
示例#4
0
        Action GetAction()
        {
            if (Input.GetButtonDown("InputToggle"))
            {
                enableKeyboardInteraction = !enableKeyboardInteraction;
            }

            Action action;

            if ((action = PerformWalkOnAction()) != null)
            {
                m_WalkActionFired = true;
                return(action);
            }

            if (m_IsRotating)
            {
                return(Rotate);
            }
            if (m_IsMoving)
            {
                return(Move);
            }

            var vertical = GetFloatValueAction("Vertical");

            if (vertical > 0)
            {
                return(MoveForward);
            }
            if (vertical < 0)
            {
                return(MoveBackward);
            }

            var strafe = GetFloatValueAction("Strafe");

            if (strafe > 0)
            {
                return(StrafeRight);
            }
            if (strafe < 0)
            {
                return(StrafeLeft);
            }

            var horizontal = GetFloatValueAction("Horizontal");

            if (horizontal < 0)
            {
                return(RotateLeft);
            }
            if (horizontal > 0)
            {
                return(RotateRight);
            }

            if (GetBoolValueAction("Action"))
            {
                return(PerformAction);
            }

            if (Input.GetButtonDown("LargeMap"))
            {
                MiniMapController.getInstance().SwitchLarge();
            }

            if (_actionQueue.Count > 0)
            {
                return(_actionQueue.Dequeue());
            }

            return(null);
        }