Exemplo n.º 1
0
        public void ChangeLevel(string callerScene, string targetScene)
        {
            try
            {
                if (string.IsNullOrEmpty(callerScene))
                {
                    throw new ArgumentException("", "callerScene");
                }
                if (string.IsNullOrEmpty(targetScene))
                {
                    throw new ArgumentException("", "targetScene");
                }

                var info = new ChangeLevelInfo()
                {
                    CallerScene = callerScene,
                    TargetScene = targetScene
                };

                _changeLevelSignal.Dispatch(info);
            }

            catch (ArgumentException e)
            {
                var param = e.ParamName;
                e = new ArgumentNullException(
                    string.Format("Couldn't change level: invalid value in {0}", param));
                Debug.LogErrorFormat(e.Message);
                throw;
            }
        }
Exemplo n.º 2
0
 private void HandleSingleplayerButtonClick()
 {
     ChangeLevelSignal.Dispatch(
         new ChangeLevelInfo
     {
         CallerScene = gameObject.scene.name,
         TargetScene = Constants.GameScene
     });
 }