Example #1
0
        public UpdatesPlayerStatistics(UpdatesPlayerStatisticsInfo info, Actor self)
        {
            this.info = info;
            var valuedInfo = self.Info.TraitInfoOrDefault <ValuedInfo>();

            cost        = valuedInfo != null ? valuedInfo.Cost : 0;
            playerStats = self.Owner.PlayerActor.Trait <PlayerStatistics>();
            actorName   = info.OverrideActor ?? self.Info.Name;
        }
Example #2
0
 public UpdatesPlayerStatistics(UpdatesPlayerStatisticsInfo info, Actor self)
 {
     this.info = info;
     if (self.Info.HasTraitInfo <ValuedInfo>())
     {
         cost = self.Info.TraitInfo <ValuedInfo>().Cost;
     }
     playerStats = self.Owner.PlayerActor.Trait <PlayerStatistics>();
 }
Example #3
0
        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            var newOwnerStats = newOwner.PlayerActor.Trait <PlayerStatistics>();

            if (includedInArmyValue)
            {
                playerStats.ArmyValue   -= cost;
                newOwnerStats.ArmyValue += cost;
            }

            playerStats = newOwnerStats;
        }
Example #4
0
        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            var newOwnerStats = newOwner.PlayerActor.Trait <PlayerStatistics>();

            if (includedInArmyValue)
            {
                playerStats.ArmyValue   -= cost;
                newOwnerStats.ArmyValue += cost;
                playerStats.Units[actorName].Count--;
                newOwnerStats.Units[actorName].Count++;
            }

            if (includedInAssetsValue)
            {
                playerStats.AssetsValue   -= cost;
                newOwnerStats.AssetsValue += cost;
            }

            playerStats = newOwnerStats;
        }