Example #1
0
        public void Execute(ScenarioManager scenario, Command command)
        {
            //Debug.Log(command.tag);
            switch (command.tag)
            {
            case "cm": {
                scenario.ClearText();
            } break;

            case "name": {
                string name = command.param["name"];
                scenario.ChangeName(name);
            } break;

            case "char": {
                int    pos  = int.Parse(command.param["pos"]);
                string type = command.param["name"];
                int    diff = int.Parse(command.param["diff"]);
                scenario.Visible((CharacterVisualizer.Position)pos, type, diff);
            } break;

            case "unchar": {
                int pos = int.Parse(command.param["pos"]);
                scenario.Invisible((CharacterVisualizer.Position)pos);
            } break;

            case "reset": {
                scenario.InvisibleAll();
            } break;

            case "back": {
                int id = int.Parse(command.param["id"]);
                scenario.ChangeBackground(id);
            } break;

            case "dawn": {
                scenario.Dawn();
            } break;

            case "dark": {
                scenario.Darkness();
            } break;

            case "sound": {
                int id = int.Parse(command.param["id"]);
                scenario.Sound(id);
            } break;
            }
        }
        // Use this for initialization
        void Start()
        {
            scenario = FindObjectOfType <ScenarioManager>();
            //IsNovelMode = false;
            if (scenario != null)
            {
                if (scenario.overlay)
                {
                    scenario.IsEnabled = false;
                }
            }
            Config.Apply();
            timeElasped           = 0.0f;
            fadeManager.fadeState = fadeIn ? 0 : 1;
            var player = FindObjectOfType <PlayerController>();

            //if (next_pos != Vector2Int.zero || next_dir != Vector2Int.zero)
            if ((next_pos.x != 0 && next_pos.y != 0) || (next_dir.x != 0 && next_dir.y != 0))
            {
                var grid       = FindObjectOfType <Grid>();
                var player_pos = grid.CellToWorld(new Vector3Int(next_pos.x, next_pos.y, 0));
                player.gameObject.transform.position = player_pos;
                //Debug.Log($"{next_pos} {next_dir} {player.gameObject.transform.position}");
                player.Direction = next_dir;
                next_pos         = Vector2Int.zero;
                next_dir         = Vector2Int.zero;
            }

            /*if (init_pos.x != 0 && init_pos.y != 0)
             * {
             *      var grid = FindObjectOfType<Grid>();
             *      var player_pos = grid.CellToWorld(new Vector3Int(init_pos.x, init_pos.y, 0));
             *      player.gameObject.transform.position = player_pos;
             *      player.Direction = (init_pos.x < 0) ? new Vector2Int(1, 0) : new Vector2Int(-1, 0);
             *      init_pos = new Vector2Int(0, 0);
             * }*/
        }