コード例 #1
0
    private void beginSceneTransition(LocalEventNotifier.Event e)
    {
        string nextSceneName = (e as BeginSceneTransitionEvent).NextSceneName;

        if (_musicDict.ContainsKey(nextSceneName) && _musicDict[nextSceneName] != this.AudioSource.clip)
        {
            this.VolumeFader.BeginFade(this.FadeOutDuration, 0.0f);
        }
    }
コード例 #2
0
    private void playerSpawned(LocalEventNotifier.Event e)
    {
        PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent;
        PlayerController   playerController   = playerSpawnedEvent.PlayerObject.GetComponent <PlayerController>();

        playerController.Slots = new List <ProgressData.SlotWrapper>(ProgressData.WeaponSlotsByPlayer[playerSpawnedEvent.PlayerIndex]);
        _playerControllers[playerSpawnedEvent.PlayerIndex] = playerController;
        playerController.SetInitialHealth(ProgressData.GetHealthForPlayer(playerSpawnedEvent.PlayerIndex));
    }
コード例 #3
0
ファイル: CouncilChair.cs プロジェクト: DrSkipper/Watchlist
    private void playerSpawned(LocalEventNotifier.Event e)
    {
        PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent;

        if (playerSpawnedEvent.PlayerIndex == this.PlayerIndex)
        {
            _targetPlayerTransform = playerSpawnedEvent.PlayerObject.transform;
        }
    }
コード例 #4
0
    private void pointsReceived(LocalEventNotifier.Event e)
    {
        SessionPlayer player = DynamicData.GetSessionPlayer(this.PlayerIndex);

        if (player.HasJoined && player.PlayerIndex == ((PlayerPointsReceivedEvent)e).PlayerIndex)
        {
            this.UpdateLength(ProgressData.GetHealthForPlayer(this.PlayerIndex), ProgressData.MAX_HEALTH);
        }
    }
コード例 #5
0
    private void playerScoreUpdated(LocalEventNotifier.Event e)
    {
        PlayerPointsReceivedEvent pointsEvent = e as PlayerPointsReceivedEvent;

        if (pointsEvent.PlayerIndex == this.PlayerIndex)
        {
            this.ScoreText.text = _prefix + ProgressData.GetPointsForPlayer(this.PlayerIndex);
        }
    }
コード例 #6
0
 private void playerDied(LocalEventNotifier.Event e)
 {
     if ((e as PlayerDiedEvent).PlayerIndex == this.PlayerIndex)
     {
         _rectTransform.position = new Vector3(-99999, -99999, _rectTransform.position.z);
         _player           = null;
         _playerController = null;
     }
 }
コード例 #7
0
ファイル: LoseCondition.cs プロジェクト: DrSkipper/Watchlist
    private void playerDied(LocalEventNotifier.Event e)
    {
        --_playerCount;

        if (_playerCount <= 0)
        {
            this.GameOver();
        }
    }
コード例 #8
0
    private void playerSpawned(LocalEventNotifier.Event e)
    {
        Transform playerTransform = (e as PlayerSpawnedEvent).PlayerObject.transform;

        this.Targets.Add(playerTransform);
        for (int i = 0; i < this.BossGroups.Count; ++i)
        {
            this.BossGroups[i].Targets.Add(playerTransform);
        }
    }
コード例 #9
0
    /**
     * Private
     */
    private void playerSpawned(LocalEventNotifier.Event playerSpawnedEvent)
    {
        PlayerSpawnedEvent spawnEvent = playerSpawnedEvent as PlayerSpawnedEvent;

        if (spawnEvent.PlayerIndex == this.PlayerIndex)
        {
            GlobalEvents.Notifier.RemoveListenersForOwnerAndEventName(this, PlayerPointsReceivedEvent.NAME);
            spawnEvent.PlayerObject.GetComponent <Damagable>().OnHealthChangeCallbacks.Add(healthUpdated);
        }
    }
コード例 #10
0
 private void execute(LocalEventNotifier.Event e)
 {
     if (this.Delay > 0)
     {
         _delayTimer.start();
     }
     else
     {
         onDelayComplete();
     }
 }
コード例 #11
0
    private void pointsReceived(LocalEventNotifier.Event e)
    {
        SessionPlayer player = DynamicData.GetSessionPlayer(this.PlayerIndex);

        if (player.HasJoined && player.PlayerIndex == ((PlayerPointsReceivedEvent)e).PlayerIndex)
        {
            for (int i = 0; i < this.Slots.Length; ++i)
            {
                this.Slots[i].UpdateWithSessionPlayer(player);
            }
        }
    }
コード例 #12
0
 private void resume(LocalEventNotifier.Event e)
 {
     PauseController.PauseGroup group = (e as ResumeEvent).PauseGroup;
     if (_currentPausedLayers != 0 && isAffected(group) && (_currentPausedLayers & (uint)group) != 0)
     {
         _currentPausedLayers = _currentPausedLayers.Approach(0, (uint)group);
         if (_currentPausedLayers == 0)
         {
             resumePausables();
         }
     }
 }
コード例 #13
0
 private void okToBegin(LocalEventNotifier.Event e)
 {
     if (_readyToSpawn)
     {
         _readyToSpawn = false;
         begin();
     }
     else
     {
         _okToBegin = true;
     }
 }
コード例 #14
0
    private void menuSelection(LocalEventNotifier.Event e)
    {
        MenuElementSelectedEvent menuSelectionEvent = e as MenuElementSelectedEvent;

        if (menuSelectionEvent.Element == _menuElement)
        {
            if (this.SlotType != WeaponData.Slot.Empty)
            {
                if (ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost)
                {
                    ProgressData.SmartSlot[] smartSlots = ProgressData.GetSmartSlots(this.PlayerIndex);
                    bool ok = true;
                    for (int i = 0; i < smartSlots.Length; ++i)
                    {
                        if (smartSlots[i].SlotType == this.SlotType)
                        {
                            ok = smartSlots[i].Level < WeaponData.GetMaxSlotsByType()[this.SlotType] || smartSlots[i].Ammo < WeaponData.GetSlotDurationsByType()[this.SlotType];
                            break;
                        }
                    }
                    if (ok)
                    {
                        this.SelectionImage.color = _normalColor;
                        ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost);
                        ProgressData.PickupSlot(this.PlayerIndex, this.SlotType);
                        GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost));
                        updateDisplay();
                    }
                    else
                    {
                        this.SelectionImage.color = this.NotEnoughColor;
                    }
                }
                else
                {
                    this.SelectionImage.color = this.NotEnoughColor;
                }
            }
            else if (ProgressData.GetHealthForPlayer(this.PlayerIndex) < ProgressData.MAX_HEALTH && ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost)
            {
                this.SelectionImage.color = _normalColor;
                ProgressData.SetHealthForPlayer(this.PlayerIndex, ProgressData.GetHealthForPlayer(this.PlayerIndex) + 1);
                ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost);
                GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost));
                updateDisplay();
            }
            else
            {
                this.SelectionImage.color = this.NotEnoughColor;
            }
        }
    }
コード例 #15
0
    /**
     * Private
     */
    private void playerSpawned(LocalEventNotifier.Event playerSpawnedEvent)
    {
        PlayerSpawnedEvent spawnEvent = playerSpawnedEvent as PlayerSpawnedEvent;

        if (spawnEvent.PlayerIndex == this.PlayerIndex)
        {
            GlobalEvents.Notifier.RemoveListenersForOwnerAndEventName(this, PlayerPointsReceivedEvent.NAME);
            foreach (UISlot slot in this.Slots)
            {
                slot.SetPlayer(spawnEvent.PlayerObject);
            }
        }
    }
コード例 #16
0
    private void levelComplete(LocalEventNotifier.Event e)
    {
        for (int i = 0; i < _playerControllers.Length; ++i)
        {
            PlayerController           playerController = _playerControllers[i];
            ProgressData.SlotWrapper[] slots            = playerController != null?playerController.Slots.ToArray() : new ProgressData.SlotWrapper[0];

            ProgressData.UpdatePlayerSlots(i, slots);
            if (DynamicData.GetSessionPlayer(i).HasJoined)
            {
                ProgressData.SetHealthForPlayer(i, playerController != null ? playerController.GetComponent <Damagable>().Health : 0);
            }
        }
    }
コード例 #17
0
ファイル: Damager.cs プロジェクト: DrSkipper/Watchlist
    public void OnHit(LocalEventNotifier.Event localEvent)
    {
        GameObject hit = ((HitEvent)localEvent).Hit;

        if (((1 << hit.layer) & this.DamagableLayers) != 0 && !_alreadyHitThisUpdate.Contains(hit))
        {
            Damagable damagable = hit.GetComponent <Damagable>();
            if (damagable != null && !damagable.Invincible)
            {
                damagable.ReceiveDamage(this);
                this.ApplyDamage(damagable);
            }
        }
    }
コード例 #18
0
    private void playerSpawned(LocalEventNotifier.Event e)
    {
        PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent;

        if (playerSpawnedEvent.PlayerIndex == this.PlayerIndex)
        {
            SessionPlayer p = DynamicData.GetSessionPlayer(this.PlayerIndex);
            if (p.HasJoined && !ReInput.players.GetPlayer(p.RewiredId).controllers.hasMouse)
            {
                _player           = p;
                _playerController = playerSpawnedEvent.PlayerObject.GetComponent <PlayerController>();
                _playerController.SetUsingController();
            }
        }
    }
コード例 #19
0
    public void OnHit(LocalEventNotifier.Event localEvent)
    {
        if (this.Invincible)
            return;

        GameObject hit = ((HitEvent)localEvent).Hit;
        if (((1 << hit.layer) & this.DamagerLayers) != 0 && !_alreadyHitThisUpdate.Contains(hit))
        {
            Damager damager = hit.GetComponent<Damager>();
            if (damager != null)
            {
                damager.ApplyDamage(this);
                this.ReceiveDamage(damager);
            }
        }
    }
コード例 #20
0
    public void OnInvincibilityToggle(LocalEventNotifier.Event localEvent)
    {
        _activated = ((InvincibilityToggleEvent)localEvent).ToggledOn;

        if (_activated)
        {
            _normalColor = this.spriteRenderer.color;
            flashOn();
        }
        else
        {
            _blinking = false;
            this.spriteRenderer.color = _normalColor;
            _blinkTimer = 0.0f;
        }
    }
コード例 #21
0
    void choiceMade(LocalEventNotifier.Event e)
    {
        MenuElementSelectedEvent selectionEvent = e as MenuElementSelectedEvent;

        if (selectionEvent.Action.ToLower() == "choice_a")
        {
            PersistentData.RegisterAcceptedMaster();
            PersistentData.RecordHighScore();
            PersistentData.SaveToDisk();
        }
        else if (selectionEvent.Action.ToLower() == "choice_b")
        {
            GlobalEvents.Notifier.SendEvent(new PlayMusicEvent());
            PersistentData.RegisterRefusedMaster();
            PersistentData.SaveToDisk();
        }
    }
コード例 #22
0
    private void handleAction(Menu.Action action, int dir = 1)
    {
        switch (action.Type)
        {
        default:
        case Menu.ActionType.None:
            break;

        case Menu.ActionType.OpenMenu:
            _pastMenuStack.Add(_currentMenu.Name);
            configureForState(action.Param);
            break;

        case Menu.ActionType.SceneTransition:
            this.Hide();
            _actionTimer   = new Timer(this.SceneTransitionDelay, false, true, onDelayedAction);
            _timerParam    = action.Param;
            _changingScene = true;

            LocalEventNotifier.Event e = new LocalEventNotifier.Event();
            e.Name = this.EndSceneEvent;
            GlobalEvents.Notifier.SendEvent(e);
            break;

        case Menu.ActionType.CloseMenuWithEvent:
            this.Hide();
            _actionTimer = new Timer(this.EventSendDelay, false, true, onDelayedAction);
            _timerParam  = action.Param;
            break;

        case Menu.ActionType.ChangeValue:
            OptionsValues.ChangeValue(action.Param, dir);
            refreshState();
            break;

        case Menu.ActionType.Reload:
            for (int i = 0; i < _pastMenuStack.Count; ++i)
            {
                menuByStateName(_pastMenuStack[i]).Reload();
            }
            _currentMenu.Reload();
            refreshState();
            break;
        }
    }
コード例 #23
0
    private void choiceMade(LocalEventNotifier.Event eventObject)
    {
        MenuElementSelectedEvent selectionEvent = eventObject as MenuElementSelectedEvent;

        if (selectionEvent.Action.ToLower() == "choice_a")
        {
            this.PageHandler.AddPage(this.Choices[_choiceIndex].ResultTextA);
            _destination = this.Choices[_choiceIndex].DestinationA;
            ++_choiceIndex;
            this.ChoiceMenu.SetActive(false);
            this.PageHandler.IncrementPage();
        }
        else if (selectionEvent.Action.ToLower() == "choice_b")
        {
            this.PageHandler.AddPage(this.Choices[_choiceIndex].ResultTextB);
            _destination = this.Choices[_choiceIndex].DestinationB;
            ++_choiceIndex;
            this.ChoiceMenu.SetActive(false);
            this.PageHandler.IncrementPage();
        }
    }
コード例 #24
0
 public void OnCollide(LocalEventNotifier.Event localEvent)
 {
     foreach (GameObject hit in ((CollisionEvent)localEvent).Hits)
     {
         if (((1 << hit.layer) & this.PickupLayer) != 0)
         {
             WeaponPickup pickup = hit.GetComponent <WeaponPickup>();
             if (pickup != null)
             {
                 if (pickup.PickupContents.Type == WeaponPickup.PickupType.WeaponSlot)
                 {
                     WeaponData.Slot          slotType   = (WeaponData.Slot)pickup.PickupContents.Parameter;
                     ProgressData.SmartSlot[] smartSlots = ProgressData.SmartSlotsFromWrappers(this.Slots.ToArray());
                     bool ok = true;
                     for (int i = 0; i < smartSlots.Length; ++i)
                     {
                         if (smartSlots[i].SlotType == slotType)
                         {
                             ok = smartSlots[i].Level < WeaponData.GetMaxSlotsByType()[slotType] || smartSlots[i].Ammo < WeaponData.GetSlotDurationsByType()[slotType];
                             break;
                         }
                     }
                     if (ok)
                     {
                         pickupWeaponSlot(slotType);
                         Destroy(hit);
                     }
                 }
                 else
                 {
                     if (_damagable.Health < ProgressData.MAX_HEALTH)
                     {
                         _damagable.Heal(pickup.PickupContents.Parameter);
                         Destroy(hit);
                     }
                 }
             }
         }
     }
 }
コード例 #25
0
ファイル: Bullet.cs プロジェクト: DrSkipper/Watchlist
    public void OnCollide(LocalEventNotifier.Event localEvent)
    {
        CollisionEvent collision = localEvent as CollisionEvent;

        bool bounced = false;

        foreach (GameObject hit in collision.Hits)
        {
            LayerMask hitLayerMask = (1 << hit.layer);
            if (_bouncesRemaining > 0 && (hitLayerMask & this.BounceLayerMask) != 0)
            {
                if (!bounced)
                {
                    bounce(hit, collision.VelocityAtHit, collision.VelocityApplied);
                }
            }
            else if ((hitLayerMask & this.HaltMovementMask) != 0)
            {
                scheduleDestruction(this.transform.position);
            }
        }
    }
コード例 #26
0
    public void OnCollide(LocalEventNotifier.Event localEvent)
    {
        CollisionEvent collision = localEvent as CollisionEvent;

        foreach (GameObject hit in collision.Hits)
        {
            if (this.CollisionWeaponType != null && this.CollisionWeaponType.SpecialEffect == WeaponType.SPECIAL_EXPLOSION && ((1 << hit.layer) & this.GetComponent <Damager>().DamagableLayers) != 0)
            {
                // Explode on impact
                Damagable damagable = this.GetComponent <Damagable>();
                while (damagable.Health > 0)
                {
                    damagable.ReceiveDamage(this.GetComponent <Damager>());
                }
            }
            else if (((1 << hit.layer) & this.BounceLayerMask) != 0)
            {
                _actor.Bounce(hit, collision.VelocityAtHit, collision.VelocityApplied, this.BounceLayerMask, 0.0f);
                break;
            }
        }
    }
コード例 #27
0
ファイル: LaserRenderer.cs プロジェクト: DrSkipper/Watchlist
    public void OnLaserCast(LocalEventNotifier.Event localEvent)
    {
        LaserCastEvent castEvent = (LaserCastEvent)localEvent;

        CollisionManager.RaycastResult raycast = castEvent.RaycastResult;

        IntegerVector distance = raycast.FarthestPointReached - castEvent.Origin;

        if (distance.X == 0 && distance.Y == 0)
        {
            return;
        }

        GameObject lineObject = ObjectPools.GetPooledObject(this.LineObjectKey);

        _lineObjects.Add(lineObject);
        //lineObject.transform.parent = this.transform;
        lineObject.transform.position = new Vector3(castEvent.Origin.X, castEvent.Origin.Y, this.transform.position.z);

        lineObject.GetComponent <LineRenderer>().SetPosition(1, new Vector3(raycast.FarthestPointReached.X - castEvent.Origin.X, raycast.FarthestPointReached.Y - castEvent.Origin.Y, 0));
        lineObject.GetComponent <AllegianceColorizer>().UpdateVisual(castEvent.AllegianceInfo);
    }
コード例 #28
0
    private void onDelayedAction()
    {
        _actionTimer = null;

        if (_changingScene)
        {
            if (_timerParam.IsEmpty())
            {
                Application.Quit();
            }
            else
            {
                SceneManager.LoadScene(_timerParam, LoadSceneMode.Single);
            }
        }
        else
        {
            LocalEventNotifier.Event e = new LocalEventNotifier.Event();
            e.Name = _timerParam;
            GlobalEvents.Notifier.SendEvent(e);
            _timerParam = null;
        }
    }
コード例 #29
0
    private void pause(LocalEventNotifier.Event e)
    {
        PauseController.PauseGroup group = (e as PauseEvent).PauseGroup;
        if (isAffected(group) && (_currentPausedLayers & (uint)group) != (uint)group)
        {
            bool prevPaused = _currentPausedLayers != 0;
            _currentPausedLayers += (uint)group;

            if (!prevPaused)
            {
                for (int i = 0; i < _pausables.Count;)
                {
                    if (_pausables[i].Pause())
                    {
                        ++i;
                    }
                    else
                    {
                        _pausables.RemoveAt(i);
                    }
                }
            }
        }
    }
コード例 #30
0
 private void gameplayBegin(LocalEventNotifier.Event e)
 {
     _timedCallbacks.AddCallback(this, begin, this.InitialDelay);
 }