Пример #1
0
 protected void OnDestroy()
 {
     GameOverEvent.UnregisterListener(GameOver);
     GameWonEvent.UnregisterListener(GameWon);
     GameStartEvent.UnregisterListener(GameStart);
     MenuEvent.UnregisterListener(Menu);
 }
Пример #2
0
 private void LogEvent(GameWonEvent e)
 {
     if (e.LoggingLevel <= LoggingLevel)
     {
         Debug.Log(e.Description);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     gameWonEvent = new GameWonEvent();
     unityEvents.Add(EventName.GameWonEvent, gameWonEvent);
     EventManager.AddInvoker(EventName.GameWonEvent, this);
     ramdonColorToBe();
 }
Пример #4
0
 public void InvokeGameWonEvent()
 {
     gameIsOver = true;
     if (GameWonEvent != null)
     {
         GameWonEvent.Invoke();
     }
 }
Пример #5
0
    /// <summary>
    /// Called when the player has defeated all the waves.
    /// </summary>
    private void EndAssault()
    {
        GameWonEvent e = new GameWonEvent
        {
            Description = "Player defeated all waves. Game won."
        };

        e.TriggerEvent();
    }
Пример #6
0
 public void RotateCell(int row, int col)
 {
     PlayingBoard.Cells[row, col] = Board.Rotate(PlayingBoard.Cells[row, col]);
     if (!_won && CheckForWin())
     {
         GameWonEvent?.Invoke(this, new GameWonEventArgs(DateTime.UtcNow - StartTime));
         _won = true;
     }
 }
Пример #7
0
    protected void Awake()
    {
        if (NEBound == null || SWBound == null)
        {
            Debug.LogError("Bounds not set!");
        }

        CameraLocked = true;

        // Register listeners
        GameStartEvent.RegisterListener(GameStart);
        GameWonEvent.RegisterListener(GameWon);
        GameOverEvent.RegisterListener(GameOver);
    }
Пример #8
0
    protected void Awake()
    {
        if (GridRef == null)
        {
            Debug.LogError($"{name}: no grid object assigned!");
        }

        if (ForbiddenMap == null)
        {
            Debug.LogError($"{name}: no forbidden map assigned!");
        }

        if (ForbiddenTile == null)
        {
            Debug.LogError($"{name}: no forbidden tile assigned!");
        }

        spriteRenderer = GetComponentInChildren <SpriteRenderer>();

        if (spriteRenderer == null)
        {
            Debug.LogError($"{name}: no graphic child game object!");
        }

        gm = FindObjectOfType <GameManager>();

        if (gm == null)
        {
            Debug.LogError($"{name}: no game manager found!");
        }

        defenderMenuButton = FindObjectOfType <DefenderMenuButton>();

        if (defenderMenuButton == null)
        {
            Debug.LogError($"{name}: no defender menu button found!");
        }

        cursor         = spriteRenderer.sprite;
        CursorDisabled = true;

        // Register listeners
        GameOverEvent.RegisterListener(GameOver);
        GameWonEvent.RegisterListener(GameWon);
        GameStartEvent.RegisterListener(GameStart);
        MenuEvent.RegisterListener(Menu);
    }
Пример #9
0
 protected void Awake()
 {
     PauseEvent.RegisterListener(LogEvent);
     MenuEvent.RegisterListener(LogEvent);
     TileSoldEvent.RegisterListener(LogEvent);
     TileDestroyedEvent.RegisterListener(LogEvent);
     TileDamageEvent.RegisterListener(LogEvent);
     TileUpdateEvent.RegisterListener(LogEvent);
     BaseDamageEvent.RegisterListener(LogEvent);
     BaseDamageUIEvent.RegisterListener(LogEvent);
     PurchaseMadeEvent.RegisterListener(LogEvent);
     PartsChangedUIEvent.RegisterListener(LogEvent);
     EnemyRecycledEvent.RegisterListener(LogEvent);
     GameStartEvent.RegisterListener(LogEvent);
     GameOverEvent.RegisterListener(LogEvent);
     GameWonEvent.RegisterListener(LogEvent);
     FastForwardEvent.RegisterListener(LogEvent);
 }
Пример #10
0
        public static void IsGameWon()
        {
            int clicked = 0, bombs = 0;

            for (int i = 0; i < Box.GetLength(0); i++)
            {
                for (int j = 0; j < Box.GetLength(1); j++)
                {
                    if (Box[i, j].IsClicked)
                    {
                        clicked++;
                    }
                    if (Box[i, j].HasBomb)
                    {
                        bombs++;
                    }
                }
            }
            if (clicked == (Box.Length - bombs))
            {
                RevealAllMines(true);
                GameWonEvent.Invoke();
            }
        }
 public void onEvent(GameWonEvent evt)
 {
 }
Пример #12
0
 public static void PublishGameWonEvent()
 {
     GameWonEvent?.Invoke();
 }
 public virtual void onEvent(GameWonEvent evt)
 {
 }
Пример #14
0
 private void OnGameWon(GameWonEvent obj)
 {
     _soundPlayer.PlayOneShot(_win);
 }
Пример #15
0
 private void GameWon(GameWonEvent e)
 {
     gameObject.SetActive(true);
 }
Пример #16
0
 private void GameWon(GameWonEvent e)
 {
     CursorDisabled = true;
 }
Пример #17
0
 protected void Awake()
 {
     // Register listeners
     GameWonEvent.RegisterListener(GameWon);
 }
Пример #18
0
 protected void OnDestroy()
 {
     GameWonEvent.UnregisterListener(GameWon);
 }
Пример #19
0
 private void Awake()
 {
     gameWonEvent = new GameWonEvent();
 }
Пример #20
0
 private void InitializeGameWonEvent()
 {
     gameWonEvent = new GameWonEvent();
     unityEvents.Add(EventName.GameWonEvent, gameWonEvent);
     EventManager.AddInvoker(EventName.GameWonEvent, this);
 }
Пример #21
0
 private void GameWon(GameWonEvent e)
 {
     CameraLocked = true;
 }
Пример #22
0
 public void OnGameWon(IEventSender sender, GameWonEvent ev)
 {
     DisplayWinPanel();
 }
Пример #23
0
 public override void onEvent(GameWonEvent evt)
 {
     mTime.Visibility      = ViewStates.Gone;
     mTimeImage.Visibility = ViewStates.Gone;
     PopupManager.showPopupWon(evt.GameState);
 }
Пример #24
0
        private void OnGameWon(GameWonEvent obj)
        {
            var text = Instantiate(_textPrefab, transform);

            text.Initialize($"Good Job! You didn't run out of space. Game will end in 10 seconds.", _movingTextTime);
        }