Exemple #1
0
    private void landedAttack(Damager damager, int damageDone, bool killingBlow)
    {
        int points = killingBlow ? ProgressData.POINTS_FOR_KILL : ProgressData.POINTS_FOR_HIT;

        ProgressData.ApplyPointsDeltaForPlayer(_allegianceInfo.MemberId, points);
        GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(_allegianceInfo.MemberId, points));
    }
Exemple #2
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;
            }
        }
    }