Пример #1
0
        private void Start()
        {
            //Load game data
            PlayerData pdata = PlayerData.Get();

            if (!string.IsNullOrEmpty(pdata.current_scene))
            {
                if (!string.IsNullOrEmpty(pdata.current_checkpoint))
                {
                    //Go to checkpoint
                    Checkpoint checkpoint = Checkpoint.Get(pdata.current_checkpoint);
                    if (checkpoint)
                    {
                        MoveCharacterTo(checkpoint.transform.position);
                    }
                }
                else
                {
                    //Go to entry
                    LevelExit exit = LevelExit.Get(pdata.current_entry_index);
                    if (exit != null)
                    {
                        MoveCharacterTo(exit.transform.position + new Vector3(exit.entrance_offset.x, exit.entrance_offset.y));
                    }
                }
            }

            //Pause game
            if (PauseMenu.Get())
            {
                PauseMenu.Get().onShow += () => { Pause(); };
                PauseMenu.Get().onHide += () => { Unpause(); };
            }

            //Camera init
            FollowCamera cam = FollowCamera.Get();

            if (cam != null && cam.target != null)
            {
                cam.MoveTo(cam.target.transform.position);
            }
        }
Пример #2
0
 protected override void Awake()
 {
     base.Awake();
     _instance = this;
 }