Esempio n. 1
0
    protected void Awake()
    {
        gameObject.SetActive(false);

        // Set up listeners
        GameOverEvent.RegisterListener(GameOver);
    }
Esempio n. 2
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        WinEvent.RegisterListener(ShowWin);
        GameOverEvent.RegisterListener(ShowGameOver);
        menu     = GetNode <VBoxContainer>("Menu");
        win      = GetNode <VBoxContainer>("Win");
        gameOver = GetNode <VBoxContainer>("GameOver");

        ShowMenu();
    }
Esempio n. 3
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);
    }
Esempio n. 4
0
    protected void Awake()
    {
        button = GetComponent <Button>();

        if (button == null)
        {
            Debug.LogError($"{name}: unable to find button component!");
        }

        // Register listeners
        GameStartEvent.RegisterListener(GameStart);
        GameOverEvent.RegisterListener(GameOver);
        MenuEvent.RegisterListener(Menu);
    }
Esempio n. 5
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);
    }
Esempio n. 6
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);
 }
    protected void Awake()
    {
        defenderMenu = FindObjectOfType <DefenderMenu>();

        if (defenderMenu == null)
        {
            Debug.LogError($"{name}: cannot find defender menu!");
        }

        if (OpenMenu == null || CloseMenu == null)
        {
            Debug.LogError($"{name}: does not have sprites assigned!");
        }

        rect = GetComponent <RectTransform>();

        if (rect == null)
        {
            Debug.LogError($"{name}: cannot find its rect transform!");
        }

        image = GetComponent <Image>();

        if (image == null)
        {
            Debug.LogError($"{name}: cannot find image!");
        }

        button = GetComponent <Button>();

        if (button == null)
        {
            Debug.LogError($"{name}: cannot find button!");
        }

        button.onClick.AddListener(ToggleMenu);

        Disabled = true;

        // Register event listeners
        GameOverEvent.RegisterListener(GameOver);
        MenuEvent.RegisterListener(Menu);
        GameStartEvent.RegisterListener(GameStart);
    }