Ejemplo n.º 1
0
    private void OnFreezeOver(string arg1, ActionParams arg2)
    {
        m_Scene.GetEventManager().RemoveListenerFromEvent(ApplicationConstants.EVENT_FREEZE_OVER, OnFreezeOver);
        m_Scene.GetEventManager().ListenToEvent(ApplicationConstants.EVENT_PLAYER_COLLECTED_FREEZE, OnCollectedFreeze);

        SetWorldSpeed(m_Scene.GetWorldSpeed());
    }
Ejemplo n.º 2
0
    public virtual void Init()
    {
        m_Scene = gameObject.GetComponentInParent(typeof(SubScene)) as SubScene;

        if (m_Scene == null)
        {
            throw new System.Exception("Object must be attached to a specific scene!");
        }

        float speed = m_Scene.GetWorldSpeed();

        SetWorldSpeed(speed);

        worldIndex = m_Scene.GetIndex();

        LocalPowerUpManager localPowerUpManager = m_Scene.GetLocalPowerUpManager();

        PowerUpManager.PowerUpEffect effect = m_Scene.GetLocalPowerUpManager().GetActivatedPowerUp();
        ActionParams actionParams           = localPowerUpManager.GetActionParams();

        if (effect.Equals(PowerUpManager.PowerUpEffect.Speed))
        {
            OnCollectedSpeed("", actionParams);
        }
        else if (effect.Equals(PowerUpManager.PowerUpEffect.Freeze))
        {
            //Nothing is supposed to be created during freeze but just in case
            OnCollectedFreeze("", actionParams);
        }

        //mPowerUpHandler = PowerUpHandlerBase.powerUpDefaultHandler;

        //Listen to events
        m_Scene.GetEventManager().ListenToEvent(ApplicationConstants.EVENT_PLAYER_DIE_BY_HIT, OnGameOver);
        m_Scene.GetEventManager().ListenToEvent(ApplicationConstants.EVENT_PLAYER_COLLECTED_SPEED, OnCollectedSpeed);
        m_Scene.GetEventManager().ListenToEvent(ApplicationConstants.EVENT_PLAYER_COLLECTED_FREEZE, OnCollectedFreeze);
    }