Esempio n. 1
0
 public static void OnRestartInvoke(object sender = null)
 {
     if (OnRestart != null)
     {
         OnRestart.Invoke(null, EventArgs.Empty);
     }
 }
Esempio n. 2
0
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                OnMove?.Invoke(Vector2Int.left);
            }
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                OnMove?.Invoke(Vector2Int.right);
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                OnMove?.Invoke(Vector2Int.up);
            }
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                OnMove?.Invoke(Vector2Int.down);
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                OnRestart?.Invoke();
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                OnEscape?.Invoke();
            }
        }
Esempio n. 3
0
    public async void Restart()
    {
        if (state != GameState.Play)
        {
            return;
        }

        state = GameState.Draw;

        Subscribe(_lineDrawer);
        _adService.ShowBanner(AdPosition.Top).Forget();

        Analytics.CustomEvent(
            Constants.LevelRestarted,
            new Dictionary <string, object>()
        {
            { "level", _level.SceneNumber },
            { "stars", _starCount.Value },
            { "passed", _level.passed }
        }
            );

        _endOfLevel.gameObject.SetActive(false);
        _starCount.Value = 0;
        OnRestart?.Invoke();

        if (_adService.HasNextAd())
        {
            await _adService.ShowVideo();
        }
    }
Esempio n. 4
0
 internal void RaiseOnRestart(string sender = null)
 {
     if (OnRestart != null)
     {
         OnRestart.BeginInvoke(sender, null, null);
     }
 }
Esempio n. 5
0
        public void ShowDefeat(OnRestart onRestart)
        {
            title.text = "Level uncompleted";
            descr.text = "You are loser";

            this.Show(onRestart);
        }
Esempio n. 6
0
        public void ShowVictory(OnRestart onRestart)
        {
            title.text = "Level completed";
            descr.text = "You are winner!";

            this.Show(onRestart);
        }
Esempio n. 7
0
        public void Restart()
        {
            DestroyEntitiesWithTag(EntityTag.Bullet);
            DestroyEntitiesWithTag(EntityTag.Enemy);
            OnRestart?.Invoke();

            ResumeGame();
        }
Esempio n. 8
0
        private void Restart()
        {
            Hide();

            if (onRestart != null)
            {
                onRestart();
                onRestart = null;
            }
        }
Esempio n. 9
0
 void Start()
 {
     OnTitanSpawned += EventManager_OnTitanSpawned;
     OnTitanKilled  += EventManager_OnTitanKilled;
     OnRestart      += EventManager_OnRestart;
     OnUpdate       += EventManager_OnUpdate;
     OnGameWon      += EventManager_OnGameWon;
     OnGameLost     += EventManager_OnGameLost;
     OnPlayerKilled += EventManager_OnPlayerKilled;
 }
Esempio n. 10
0
 public void Restart()
 {
     OnRestart?.Invoke();
     if (!hasPlayer)
     {
         return;
     }
     SetCameraDepth(-10);
     SetPlayerState(true);
 }
Esempio n. 11
0
 public void GameRestart()
 {
     GameStop();
     foreach (var component in components.ToArray())
     {
         component.GameRestart();
     }
     if (OnRestart != null)
     {
         OnRestart.Invoke();
     }
 }
        public void Restart()
        {
            OnRestart?.Invoke();
            Player.Instance.SetPosition(playerInitPosition);
            toolsCollected = 0;
            gameTime       = TimeToFinish.ToFloat();
            stGameTime     = new StandardTime();
            stGameTime.ConvertFrom(gameTime);

            ResumeGame();
            UpdateGameUI();
        }
Esempio n. 13
0
        private static void HandleStandardKey(ConsoleKeyInfo?keyInfo)
        {
            string key = keyInfo.Value.KeyChar.ToString();

            switch (key)
            {
            case " ":     // Refresh
                Console.Clear();
                break;

            case "|":
                ConsoleEx.WriteLineEnh("*Cancelling..*");
                _cts.Cancel();
                ShortDelay();
                Console.Clear();
                break;

            case "^":     // Restart (forget all state)
                if (ConsoleEx.PromptEnhForInputKeysUpper("Are you sure? Y/N ", "yn") == "Y")
                {
                    ConsoleEx.WriteLineEnh("*Restarting..* (if supported)"); ShortDelay();
                    OnRestart?.Invoke(); ShortDelay();
                    Console.Clear();
                }
                else
                {
                    ShortDelay(); Console.Clear();
                }
                break;

            case "q":     // Quit (lower)
                if (ConsoleEx.PromptEnhForInputKeysUpper("Are you sure? Y/N ", "yn") == "Y")
                {
                    ConsoleEx.WriteLineEnh("\n*Quitting..*"); ShortDelay();
                    OnQuit?.Invoke(); ShortDelay();
                    _running = false;
                }
                else
                {
                    ShortDelay(); Console.Clear();
                }
                break;

            case "Q":     // Quit (upper)
                ConsoleEx.WriteLineEnh("*Quitting..*"); ShortDelay();
                OnQuit?.Invoke(); ShortDelay();
                _running = false;
                break;

            default:
                break;
            }
        }
        void Awake()
        {
            m_RestartButton.onClick.AddListener(() =>
            {
                OnRestart?.Invoke();
            });

            m_MainMenu.onClick.AddListener(() =>
            {
                OnMainMenu?.Invoke();
            });
        }
Esempio n. 15
0
    public void Restart()
    {
        running = true;

        totalCarriages = carriagesParent.childCount;

        totalMeds         = startingTotalMeds;
        medsEffectiveness = startingMedsEffectiveness;
        UpdateTotalMedsMesh();

        totalPeople = startingCarriagePeople * totalCarriages;
        UpdateTotalPeopleMesh();

        secondsLeftToIncreaseMedsEffect = secondsToIncreaseMedsEffect;

        OnRestart?.Invoke();
    }
Esempio n. 16
0
 public static void AddToTimeline(LockstepInputs inputs)
 {
     if (inputs.TickId < 0)
     {
         Index = 0;
         lockstepInputs.Clear();
         OnRestart?.Invoke();
     }
     if (inputs.TickId != lockstepInputs.Count)
     {
         return;
     }
     lockstepInputs.Add(inputs);
     inputTrackDict.Add(inputs.TickId, new List <Dictionary <int, Dictionary <Type, List <IInput> > > >());
     if (inputs.UserInputs != null && inputs.UserInputs.Length > 0)
     {
         for (int i = 0; i < inputs.UserInputs.Length; i++)
         {
             var dict = new Dictionary <int, Dictionary <Type, List <IInput> > >();
             for (int j = 0; j < inputs.UserInputs[i].Length; j++)
             {
                 var userInputs = inputs.UserInputs[i][j];
                 dict.Add(userInputs.UserId, new Dictionary <Type, List <IInput> >());
                 if (userInputs.InputData != null)
                 {
                     for (int k = 0; k < userInputs.InputData.Length; k++)
                     {
                         var input = MessagePackUtility.Deserialize <IInput>(userInputs.InputData[k]);
                         var type  = input.GetType();
                         if (!dict[userInputs.UserId].ContainsKey(type))
                         {
                             dict[userInputs.UserId].Add(type, new List <IInput>());
                         }
                         dict[userInputs.UserId][type].Add(input);
                     }
                 }
             }
             inputTrackDict[inputs.TickId].Add(dict);
         }
     }
 }
Esempio n. 17
0
    public static void Restart()
    {
        Eitrum.Engine.Core.Timer.Stop(endGameRestartRoutine);
        Parent.DestroyAllChildren();
        roundTimer = GameSettings.RoundDuration;
        SpawnPlayers();
        OnRestart?.Invoke();
        int counter = 3;

        Eitrum.Engine.Core.Timer.Repeat(1f, counter, () => {
            counter -= 1;
            OnCountDown.Invoke(counter);
            if (counter == 0)
            {
                OnRoundStart?.Invoke();
                for (int iPlayer = 0, nPlayer = players.Count; iPlayer < nPlayer; ++iPlayer)
                {
                    players[iPlayer].canMove        = true;
                    players[iPlayer].rb.isKinematic = false;
                }
            }
        });
    }
Esempio n. 18
0
 private void Show(OnRestart onRestart)
 {
     this.onRestart = onRestart;
     overlay.SetActive(true);
 }
Esempio n. 19
0
 private void Restart()
 {
     OnRestart?.Invoke();
 }
Esempio n. 20
0
 public void PressRestart()
 {
     Hide();
     OnRestart?.Invoke();
 }
Esempio n. 21
0
 public static void Restart() => OnRestart?.Invoke();
Esempio n. 22
0
 void restart()
 {
     OnRestart?.Invoke();
     pepsi = false;
 }
Esempio n. 23
0
 public void InvokeRestart()
 {
     OnRestart?.Invoke();
 }
Esempio n. 24
0
 private void Restart()
 {
     OnRestart?.Invoke(currentLevel);
 }