Exemplo n.º 1
0
 private void OnResume(bool pause)
 {
     if (!pause)
     {
         CustomEventSystem.TryInvoke("OnGameResume");
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        wait -= Time.deltaTime;
        if (wait > 0.0f)
        {
            return;
        }

        if (inputPad.IsTrigger(InputType.Button.KeyLeft) || inputPad.IsTrigger(InputType.Button.KeyRight))
        {
            index++;
            if (index > buttons.Length - 1)
            {
                index = 0;
            }
            CustomEventSystem.Instance().Enter(buttons[index].gameObject);
        }
        else if (inputPad.IsTrigger(InputType.Button.Right))
        {
            CustomEventSystem.Instance().Click();
        }
        else if (inputPad.IsTrigger(InputType.Button.Down))
        {
            buttons[0].OnClick?.Invoke();
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
 void Awake()
 {
     EventSystem = GameObject.FindObjectOfType <CustomEventSystem>();
     GameModel   = GetComponent <GameModel>();
     GameView    = GetComponent <GameView>();
     InitializeEvents();
 }
Exemplo n.º 4
0
 private void OnPause(bool pause)
 {
     if (pause)
     {
         CustomEventSystem.TryInvoke("OnGamePause");
     }
 }
Exemplo n.º 5
0
    protected override void Start()
    {
        base.Start();

        currentEventSystem = CustomEventSystem.Instance;
        pointerEventData   = new PointerEventData(currentEventSystem);
    }
Exemplo n.º 6
0
    public GameEndHandler()
    {
        TriggerType = CustomTriggerType.OnGameEnd;

        Events.GameLoseAnimationEnd.AddListener(() => CustomEventSystem.TryInvoke("OnGameEnd"));
        Events.GameWon.AddListener(() => CustomEventSystem.TryInvoke("OnGameEnd"));
    }
Exemplo n.º 7
0
 void Awake()
 {
     EventSystem = GameObject.FindObjectOfType <CustomEventSystem>();
     InitializeEvents();
     HUDOverlay.gameObject.SetActive(true);
     GameTimer.gameObject.SetActive(false);
     HUDAnimator = GameObject.Find("HUD").GetComponent <Animator>();
 }
Exemplo n.º 8
0
 private void Awake()
 {
     CustomEventSystem.AddEvent("OnGameLose", new GameLoseHandler());
     CustomEventSystem.AddEvent("OnGameWon", new GameWonHandler());
     CustomEventSystem.AddEvent("OnInit", new InitHandler());
     CustomEventSystem.AddEvent("OnGameEnd", new GameEndHandler());
     CustomEventSystem.AddEvent("OnGamePause", new GamePauseHandler());
     CustomEventSystem.AddEvent("OnGameResume", new GameResumeHandler());
 }
Exemplo n.º 9
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Enemy enemy = (Enemy)other.GetComponent <Enemy>();

        if (enemy != null)
        {
            Destroy(enemy.gameObject);
            CustomEventSystem.TakeDamageAction(1f);
        }
    }
Exemplo n.º 10
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag(TagContainer.PLAYER_TAG))
        {
            CustomEventSystem.PickedPowerUpAction(powerup);

            powerup.Activator.DoEffet();
            SoundManager.PlaySound(powerup.pickupSound, 2f);
            Destroy(gameObject);
        }
    }
Exemplo n.º 11
0
 /// <summary>
 /// Constructor
 /// </summary>
 private CustomEventSystem()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     _eventList              = new Dictionary <string, List <EventListener> >();
     _eventListenerCount     = 0;
     _cachedAddedListeners   = new List <EventListener>();
     _cachedRemovedListeners = new List <EventListener>();
 }
Exemplo n.º 12
0
 private void Awake()
 {
     //TODO: Can't use dynamic
     //Every scene has this class...
     //TODO: Find way to make this DontDestroyOnLoad
     //PROBLEM: Cannot send the right Gameplay Tilemap.
     if (Instance == null)
     {
         Instance = this;
     }
     CustomEventSystem.LevelChangedAction(gameplayTilemap);
 }
Exemplo n.º 13
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag(TagContainer.Player_Tag))
     {
         if (powerUp is Shootable)
         {
             BulletActivator.SetBullet((Shootable)powerUp);
         }
         CustomEventSystem.PickedUpPowerUpAction(powerUp);
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 14
0
    void Start()
    {
        for (short i = 0; i < GameInfo.playersNo; i++)
        {
            players[i].playerIndex        = i;
            players[i].playerColor        = GameInfo.playersColors[i];
            players[i].transform.position = boardTiles[0].PlayersLocations[i];
        }

        currentPlayer = players[0];
        DiceManager.resetDices();
        // Register the function player arrived in the eventSystem, for playerArrived.
        CustomEventSystem.RegisterListener(EVENT_TYPE.PLAYER_ARRIVED, OnPlayerArrived);
        // Register the function give income in the eventSystem.
        CustomEventSystem.RegisterListener(EVENT_TYPE.GIVE_INCOME, givePlayerIncome);

        removeInitialGUI();
        GUImanager.setJobSelectionStatus(true);
    }
Exemplo n.º 15
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        //現在選択しているものを選択解除呼び出し
        var cgo = CustomEventSystem.Instance().CurrentSelected;

        if (cgo != null)
        {
            var handler = cgo.GetComponent <ButtonBase>();
            if (handler != null)
            {
                handler.Exit();
            }
        }

        //選択呼び出し
        Enter();
        //選択オブジェクトを上書き
        CustomEventSystem.Instance().CurrentSelected = gameObject;
    }
Exemplo n.º 16
0
    /*
     * Function transforms tile index to a position, and then calls
     * the function to move the player from current to the next one
     */
    private bool TraverseUpToTile(short currentTileIndex, short targetTileIndex)
    {
        Vector3 currentPosition = boardTiles[currentTileIndex].PlayersLocations[playerIndex];
        Vector3 TargetPosition  = boardTiles[targetTileIndex].PlayersLocations[playerIndex];

        if (OneTileMove(currentPosition, TargetPosition))
        {
            if (giveIncome)
            {
                if ((currentTileIndex == boardTiles.Length - 1) && (targetTileIndex == 0))
                {
                    CustomEventSystem.fireEvent(EVENT_TYPE.GIVE_INCOME, new EventInfo(playerIndex));
                }
            }
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 17
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        IDamagable component = other.GetComponent <IDamagable>();

        if (component != null)
        {
            Destroy(other.gameObject);
            component.ApplyDamage();
        }

        if (other.CompareTag(TagContainer.BOMB_TAG))
        {
            Bomb tmp = other.gameObject.GetComponent <Bomb>();
            tmp.ApplyDamage();
        }

        if (other.CompareTag(TagContainer.PORTAL_TAG))
        {
            CustomEventSystem.PortalExplosionAction(transform.position);
        }
    }
Exemplo n.º 18
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag(TagContainer.PLAYER_TAG))
        {
            if (canChangeScene)
            {
                if (SceneManager.GetActiveScene().name == LAST_LEVEL)
                {
                    Debug.Log("Game Ended");
                    CustomEventSystem.GameEndedAction();
                    GameManager.Instance.TimerIndex = 0;

                    return;
                }

                GameManager.Instance.TimerIndex++;
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
                //TODO: Change this buildIndex to scene name.
            }
        }
    }
Exemplo n.º 19
0
    // Update is called once per frame
    void Update()
    {
        wait -= Time.deltaTime;
        if (wait > 0.0f)
        {
            return;
        }

        {
            if (inputPad.IsTrigger(InputType.Button.Right))
            {
                CustomEventSystem.Instance().Click();
                button.OnClick?.Invoke();
                Destroy(gameObject);
            }
            else if (inputPad.IsTrigger(InputType.Button.Down))
            {
                button.OnClick?.Invoke();
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 20
0
 /*
  * Called when the destination tile is reached.
  */
 private void arrivalProcedure()
 {
     playerComponent.setCurrentTile(boardTiles[currentTileIndex]);
     CustomEventSystem.fireEvent(EVENT_TYPE.PLAYER_ARRIVED);
     // send alert event
 }
Exemplo n.º 21
0
 private void Awake()
 {
     eventSystem = GameObject.FindObjectOfType <CustomEventSystem>();
 }
Exemplo n.º 22
0
 public void ApplyScore(int amount)
 {
     CustomEventSystem.ScoreCountAction(amount);
 }
Exemplo n.º 23
0
 protected override void Awake()
 {
     base.Awake();
     singleton = this;
     Input.imeCompositionMode = IMECompositionMode.Off;
 }
Exemplo n.º 24
0
 public void GiveScore(int amount)
 {
     gameManager.Score += amount;
     CustomEventSystem.UpdateGameInfoAction();
 }
Exemplo n.º 25
0
 public void ApplyDamage()
 {
     CustomEventSystem.PlayerDeadAction();
 }
Exemplo n.º 26
0
 public void Awake()
 {
     current = this;
 }
Exemplo n.º 27
0
 void Awake()
 {
     EventSystem = GameObject.FindObjectOfType <CustomEventSystem>();
     InitializeEvents();
 }
Exemplo n.º 28
0
 private void Awake()
 {
     Instance = this;
 }
Exemplo n.º 29
0
 // Start is called before the first frame update
 void Start()
 {
     inputManager = InputManager.Instance();
     inputPad     = inputManager.CreateInputPad();
     CustomEventSystem.Instance().Enter(buttons[0].gameObject);
 }
Exemplo n.º 30
0
    public InitHandler()
    {
        TriggerType = CustomTriggerType.OnInit;

        Events.OnInit.AddListener(() => CustomEventSystem.TryInvoke("OnInit"));
    }