コード例 #1
0
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();

            // Set initial disabled state
            Tick(self);
        }
コード例 #2
0
 protected virtual void Created(Actor self)
 {
     repairableInfo   = self.Info.TraitInfoOrDefault <RepairableInfo>();
     rearmableInfo    = self.Info.TraitInfoOrDefault <RearmableInfo>();
     conditionManager = self.TraitOrDefault <ConditionManager>();
     speedModifiers   = self.TraitsImplementing <ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier());
     cachedPosition   = self.CenterPosition;
 }
コード例 #3
0
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
     if (initialExperience > 0)
     {
         GiveExperience(initialExperience, info.SuppressLevelupAnimation);
     }
 }
コード例 #4
0
        protected override void Created(Actor self)
        {
            base.Created(self);

            conditionManager = self.TraitOrDefault <ConditionManager>();

            Update(self);
        }
コード例 #5
0
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();
            UpdateCondition(self);

            // HACK: Temporarily needed until Rearm activity is gone for good
            RemainingTicks = Info.ReloadDelay;
        }
コード例 #6
0
        protected override void Created(Actor self)
        {
            conditionManager = self.Trait <ConditionManager>();
            mobile           = self.TraitOrDefault <Mobile>();
            delayPickups     = self.TraitsImplementing <IDelayCarryallPickup>().ToArray();

            base.Created(self);
        }
コード例 #7
0
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
     if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
     {
         conditionToken = conditionManager.GrantCondition(self, info.Condition);
     }
 }
コード例 #8
0
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();

            if (!string.IsNullOrEmpty(initialPlug))
            {
                EnablePlug(self, initialPlug);
            }
        }
コード例 #9
0
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();
            AutoReloads      = self.TraitsImplementing <ReloadAmmoPool>().Any(r => r.Info.AmmoPool == Info.Name && r.Info.RequiresCondition == null);

            UpdateCondition(self);

            // HACK: Temporarily needed until Rearm activity is gone for good
            RemainingTicks = Info.ReloadDelay;
        }
コード例 #10
0
        void INotifyCreated.Created(Actor self)
        {
            // Special case handling is required for the Player actor.
            // Created is called before Player.PlayerActor is assigned,
            // so we must query other player traits from self, knowing that
            // it refers to the same actor as self.Owner.PlayerActor
            var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor;

            globalManager    = playerActor.Trait <GrantConditionOnPrerequisiteManager>();
            conditionManager = self.TraitOrDefault <ConditionManager>();
        }
        void INotifyCreated.Created(Actor self)
        {
            // AutoTargetPriority and their Priorities are fixed - so we can safely cache them with ToArray.
            // IsTraitEnabled can change over time, and so must appear after the ToArray so it gets re-evaluated each time.
            activeTargetPriorities =
                self.TraitsImplementing <AutoTargetPriority>()
                .OrderByDescending(ati => ati.Info.Priority).ToArray()
                .Where(Exts.IsTraitEnabled).Select(atp => atp.Info);

            conditionManager = self.TraitOrDefault <ConditionManager>();
            ApplyStanceCondition(self);
        }
コード例 #12
0
ファイル: Cloak.cs プロジェクト: Orikuilov/Engine
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();

            if (Cloaked)
            {
                wasCloaked = true;
                if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition))
                {
                    cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition);
                }
            }
        }
コード例 #13
0
        void INotifyCreated.Created(Actor self)
        {
            notifyHarvesterAction = self.TraitsImplementing <INotifyHarvesterAction>().ToArray();
            resourceMultipliers   = self.TraitsImplementing <HarvesterResourceMultiplier>().ToArray();
            conditionManager      = self.TraitOrDefault <ConditionManager>();
            UpdateCondition(self);

            // Note: This is queued in a FrameEndTask because otherwise the activity is dropped/overridden while moving out of a factory.
            if (Info.SearchOnCreation)
            {
                self.World.AddFrameEndTask(w => self.QueueActivity(new FindAndDeliverResources(self)));
            }
        }
コード例 #14
0
ファイル: Armament.cs プロジェクト: reaperrr/OpenRA
        protected override void Created(Actor self)
        {
            turret = self.TraitsImplementing <Turreted>().FirstOrDefault(t => t.Name == Info.Turret);
            coords = self.Trait <BodyOrientation>();
            notifyBurstComplete = self.TraitsImplementing <INotifyBurstComplete>().ToArray();
            notifyAttacks       = self.TraitsImplementing <INotifyAttack>().ToArray();
            conditionManager    = self.TraitOrDefault <ConditionManager>();

            rangeModifiers      = self.TraitsImplementing <IRangeModifier>().ToArray().Select(m => m.GetRangeModifier());
            reloadModifiers     = self.TraitsImplementing <IReloadModifier>().ToArray().Select(m => m.GetReloadModifier());
            damageModifiers     = self.TraitsImplementing <IFirepowerModifier>().ToArray().Select(m => m.GetFirepowerModifier());
            inaccuracyModifiers = self.TraitsImplementing <IInaccuracyModifier>().ToArray().Select(m => m.GetInaccuracyModifier());

            base.Created(self);
        }
コード例 #15
0
 void INotifyCreated.Created(Actor self)
 {
     // Special case handling is required for the Player actor.
     // Created is called before Player.IsBot is set, so we
     // must use a different method to enable this trait if
     // it's defined on the PlayerActor.
     self.World.AddFrameEndTask(w =>
     {
         conditionManager = self.TraitOrDefault <ConditionManager>();
         if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType))
         {
             conditionToken = conditionManager.GrantCondition(self, info.Condition);
         }
     });
 }
コード例 #16
0
        void INotifyCreated.Created(Actor self)
        {
            var valued             = self.Info.TraitInfoOrDefault <ValuedInfo>();
            var requiredExperience = info.ExperienceModifier < 0 ? (valued != null ? valued.Cost : 1) : info.ExperienceModifier;

            foreach (var kv in info.Conditions)
            {
                nextLevel.Add(Pair.New(kv.Key * requiredExperience, kv.Value));
            }

            conditionManager = self.TraitOrDefault <ConditionManager>();
            if (initialExperience > 0)
            {
                GiveExperience(initialExperience, info.SuppressLevelupAnimation);
            }
        }
コード例 #17
0
        void INotifyCreated.Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();
            move             = self.TraitOrDefault <IMove>();
            progressWatchers = self.TraitsImplementing <ICaptureProgressWatcher>().ToArray();

            enabledCapturable = self.TraitsImplementing <Capturable>()
                                .ToArray()
                                .Where(Exts.IsTraitEnabled);

            enabledCaptures = self.TraitsImplementing <Captures>()
                              .ToArray()
                              .Where(Exts.IsTraitEnabled);

            RefreshCaptures(self);
            RefreshCapturable(self);
        }
コード例 #18
0
        protected override void Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();
            otherCloaks      = self.TraitsImplementing <Cloak>()
                               .Where(c => c != this)
                               .ToArray();

            if (Cloaked)
            {
                wasCloaked = true;
                if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition))
                {
                    cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition);
                }
            }

            base.Created(self);
        }
コード例 #19
0
ファイル: Cargo.cs プロジェクト: Mete0/anki-OpenRA
        void INotifyCreated.Created(Actor self)
        {
            aircraft         = self.TraitOrDefault <Aircraft>();
            conditionManager = self.TraitOrDefault <ConditionManager>();

            if (conditionManager != null && cargo.Any())
            {
                foreach (var c in cargo)
                {
                    string passengerCondition;
                    if (Info.PassengerConditions.TryGetValue(c.Info.Name, out passengerCondition))
                    {
                        passengerTokens.GetOrAdd(c.Info.Name).Push(conditionManager.GrantCondition(self, passengerCondition));
                    }
                }

                if (!string.IsNullOrEmpty(Info.LoadedCondition))
                {
                    loadedTokens.Push(conditionManager.GrantCondition(self, Info.LoadedCondition));
                }
            }

            // Defer notifications until we are certain all traits on the transport are initialised
            self.World.AddFrameEndTask(w =>
            {
                foreach (var c in cargo)
                {
                    c.Trait <Passenger>().Transport = self;

                    foreach (var nec in c.TraitsImplementing <INotifyEnteredCargo>())
                    {
                        nec.OnEnteredCargo(c, self);
                    }

                    foreach (var npe in self.TraitsImplementing <INotifyPassengerEntered>())
                    {
                        npe.OnPassengerEntered(self, c);
                    }
                }

                initialised = true;
            });
        }
コード例 #20
0
        protected override void Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();
            notify           = self.TraitsImplementing <INotifyDeployTriggered>().ToArray();
            base.Created(self);

            switch (deployState)
            {
            case DeployState.Undeployed:
                OnUndeployCompleted();
                break;

            case DeployState.Deploying:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = Info.Facing;
                }

                Deploy(true);
                break;

            case DeployState.Deployed:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = Info.Facing;
                }

                OnDeployCompleted();
                break;

            case DeployState.Undeploying:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = Info.Facing;
                }

                Undeploy(true);
                break;
            }
        }
コード例 #21
0
        void INotifyCreated.Created(Actor self)
        {
            aircraft         = self.TraitOrDefault <Aircraft>();
            conditionManager = self.TraitOrDefault <ConditionManager>();

            if (conditionManager != null && cargo.Any())
            {
                foreach (var c in cargo)
                {
                    string passengerCondition;
                    if (Info.PassengerConditions.TryGetValue(c.Info.Name, out passengerCondition))
                    {
                        passengerTokens.GetOrAdd(c.Info.Name).Push(conditionManager.GrantCondition(self, passengerCondition));
                    }
                }

                if (!string.IsNullOrEmpty(Info.LoadedCondition))
                {
                    loadedTokens.Push(conditionManager.GrantCondition(self, Info.LoadedCondition));
                }
            }
        }
コード例 #22
0
        public void Created(Actor self)
        {
            conditionManager = self.TraitOrDefault <ConditionManager>();

            switch (deployState)
            {
            case DeployState.Undeployed:
                OnUndeployCompleted();
                break;

            case DeployState.Deploying:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = info.Facing;
                }

                Deploy(true);
                break;

            case DeployState.Deployed:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = info.Facing;
                }

                OnDeployCompleted();
                break;

            case DeployState.Undeploying:
                if (canTurn)
                {
                    self.Trait <IFacing>().Facing = info.Facing;
                }

                Undeploy(true);
                break;
            }
        }
コード例 #23
0
ファイル: ExternalCondition.cs プロジェクト: cjshmyr/OpenRA
 public ExternalCondition(Actor self, ExternalConditionInfo info)
 {
     Info             = info;
     conditionManager = self.Trait <ConditionManager>();
 }
コード例 #24
0
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.Trait <ConditionManager>();
     GrantConditionOnValidHealth(self, health.HP);
 }
コード例 #25
0
ファイル: Cargo.cs プロジェクト: anvilvapre/OpenRA-1
 void INotifyCreated.Created(Actor self)
 {
     aircraft         = self.TraitOrDefault <Aircraft>();
     conditionManager = self.Trait <ConditionManager>();
 }
コード例 #26
0
ファイル: Aircraft.cs プロジェクト: Orikuilov/Engine
 public void Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
     speedModifiers   = self.TraitsImplementing <ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier());
     cachedPosition   = self.CenterPosition;
 }
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
     GrantConditionOnValidDamageState(self, health.DamageState);
 }
コード例 #28
0
ファイル: Carryable.cs プロジェクト: alexeik/openRA.Engine.Hg
        protected override void Created(Actor self)
        {
            conditionManager = self.Trait <ConditionManager>();

            base.Created(self);
        }
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
 }
コード例 #30
0
ファイル: AutoTarget.cs プロジェクト: DoGyAUT/OpenRA
 void INotifyCreated.Created(Actor self)
 {
     conditionManager = self.TraitOrDefault <ConditionManager>();
     targetPriorities = self.TraitsImplementing <AutoTargetPriority>().ToArray();
     ApplyStanceCondition(self);
 }