Exemplo n.º 1
0
 public DeployToUpgrade(Actor self, DeployToUpgradeInfo info)
 {
     this.self        = self;
     this.info        = info;
     manager          = self.Trait <UpgradeManager>();
     checkTerrainType = info.AllowedTerrainTypes.Length > 0;
 }
Exemplo n.º 2
0
 public DeployToUpgrade(Actor self, DeployToUpgradeInfo info)
 {
     this.self        = self;
     this.info        = info;
     manager          = self.Trait <UpgradeManager>();
     checkTerrainType = info.AllowedTerrainTypes.Count > 0;
     canTurn          = self.Info.HasTraitInfo <IFacingInfo>();
     body             = Exts.Lazy(self.TraitOrDefault <ISpriteBody>);
 }
Exemplo n.º 3
0
        public Carryable(Actor self, CarryableInfo info)
        {
            this.info      = info;
            this.self      = self;
            upgradeManager = self.Trait <UpgradeManager>();

            locked         = false;
            Reserved       = false;
            WantsTransport = false;
        }
Exemplo n.º 4
0
 public SwallowActor(Actor self, Target target, WeaponInfo weapon)
 {
     this.target = target;
     this.weapon = weapon;
     sandworm = self.Trait<Sandworm>();
     positionable = self.Trait<Mobile>();
     swallow = self.Trait<AttackSwallow>();
     manager = self.Trait<UpgradeManager>();
     radarPings = self.World.WorldActor.TraitOrDefault<RadarPings>();
 }
Exemplo n.º 5
0
        public Parachute(Actor self, WPos dropPosition)
        {
            um = self.TraitOrDefault<UpgradeManager>();
            pos = self.TraitOrDefault<IPositionable>();

            // Parachutable trait is a prerequisite for running this activity
            para = self.Info.Traits.Get<ParachutableInfo>();
            fallVector = new WVec(0, 0, para.FallRate);
            this.dropPosition = dropPosition;
        }
Exemplo n.º 6
0
        void INotifyCreated.Created(Actor self)
        {
            upgradeManager = self.TraitOrDefault <UpgradeManager>();

            // The upgrade manager exists, but may not have finished being created yet.
            // We'll defer the upgrades until the end of the tick, at which point it will be ready.
            if (Cloaked)
            {
                wasCloaked = true;
                self.World.AddFrameEndTask(_ => GrantUpgrades(self));
            }
        }
Exemplo n.º 7
0
        public Pluggable(ActorInitializer init, PluggableInfo info)
        {
            Info           = info;
            upgradeManager = init.Self.Trait <UpgradeManager>();

            var plugInit = init.Contains <PlugsInit>() ? init.Get <PlugsInit, Dictionary <CVec, string> >() : new Dictionary <CVec, string>();

            if (plugInit.ContainsKey(Info.Offset))
            {
                initialPlug = plugInit[Info.Offset];
            }
        }
Exemplo n.º 8
0
 public DeployToUpgrade(ActorInitializer init, DeployToUpgradeInfo info)
 {
     this.self        = init.Self;
     this.info        = info;
     manager          = self.Trait <UpgradeManager>();
     checkTerrainType = info.AllowedTerrainTypes.Count > 0;
     canTurn          = self.Info.HasTraitInfo <IFacingInfo>();
     body             = Exts.Lazy(self.TraitOrDefault <WithSpriteBody>);
     if (init.Contains <DeployStateInit>())
     {
         deployState = init.Get <DeployStateInit, DeployState>();
     }
 }
Exemplo n.º 9
0
 public void Created(Actor self)
 {
     upgradeManager = self.TraitOrDefault <UpgradeManager>();
     if (remainingTime == 0)
     {
         if (upgradeManager != null)
         {
             foreach (var u in Info.WhileCloakedUpgrades)
             {
                 upgradeManager.GrantUpgrade(self, u, this);
             }
         }
     }
 }
Exemplo n.º 10
0
        public Cargo(ActorInitializer init, CargoInfo info)
        {
            self             = init.Self;
            Info             = info;
            Unloading        = false;
            checkTerrainType = info.UnloadTerrainTypes.Count > 0;
            upgradeManager   = self.Trait <UpgradeManager>();

            if (init.Contains <RuntimeCargoInit>())
            {
                cargo       = new Stack <Actor>(init.Get <RuntimeCargoInit, Actor[]>());
                totalWeight = cargo.Sum(c => GetWeight(c));
            }
            else if (init.Contains <CargoInit>())
            {
                foreach (var u in init.Get <CargoInit, string[]>())
                {
                    var unit = self.World.CreateActor(false, u.ToLowerInvariant(),
                                                      new TypeDictionary {
                        new OwnerInit(self.Owner)
                    });

                    cargo.Push(unit);
                }

                totalWeight = cargo.Sum(c => GetWeight(c));
            }
            else
            {
                foreach (var u in info.InitialUnits)
                {
                    var unit = self.World.CreateActor(false, u.ToLowerInvariant(),
                                                      new TypeDictionary {
                        new OwnerInit(self.Owner)
                    });

                    cargo.Push(unit);
                }

                totalWeight = cargo.Sum(c => GetWeight(c));
            }

            facing = Exts.Lazy(self.TraitOrDefault <IFacing>);
        }
Exemplo n.º 11
0
        public GainsExperience(ActorInitializer init, GainsExperienceInfo info)
        {
            self      = init.Self;
            this.info = info;

            MaxLevel = info.Upgrades.Count;

            var cost = self.Info.Traits.Get <ValuedInfo>().Cost;

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

            if (init.Contains <ExperienceInit>())
            {
                GiveExperience(init.Get <ExperienceInit, int>(), info.SuppressLevelupAnimation);
            }

            um = self.Trait <UpgradeManager>();
        }
Exemplo n.º 12
0
 public UpgradeOnTerrain(ActorInitializer init, UpgradeOnTerrainInfo info)
 {
     self      = init.Self;
     this.info = info;
     manager   = self.Trait <UpgradeManager>();
 }
Exemplo n.º 13
0
 void INotifyCreated.Created(Actor self)
 {
     upgradeManager = self.TraitOrDefault <UpgradeManager>();
 }
Exemplo n.º 14
0
 public GlobalUpgradable(Actor self, GlobalUpgradableInfo info)
 {
     this.info     = info;
     globalManager = self.Owner.PlayerActor.Trait <GlobalUpgradeManager>();
     manager       = self.Trait <UpgradeManager>();
 }
Exemplo n.º 15
0
 public Pluggable(Actor self, PluggableInfo info)
 {
     Info           = info;
     upgradeManager = self.Trait <UpgradeManager>();
 }
Exemplo n.º 16
0
 void INotifyCreated.Created(Actor self)
 {
     manager = self.TraitOrDefault<UpgradeManager>();
 }
Exemplo n.º 17
0
 public UpgradeOnDamage(Actor self, UpgradeOnDamageInfo info)
 {
     this.info = info;
     um        = self.TraitOrDefault <UpgradeManager>();
 }
Exemplo n.º 18
0
 public void Created(Actor self)
 {
     um = self.TraitOrDefault <UpgradeManager>();
 }
Exemplo n.º 19
0
 public PrimaryBuilding(Actor self, PrimaryBuildingInfo info)
 {
     this.info = info;
     manager   = self.Trait <UpgradeManager>();
 }
Exemplo n.º 20
0
 public Carryable(Actor self, CarryableInfo info)
 {
     this.info      = info;
     upgradeManager = self.Trait <UpgradeManager>();
 }
Exemplo n.º 21
0
 public void Created(Actor self)
 {
     um             = self.TraitOrDefault <UpgradeManager>();
     speedModifiers = self.TraitsImplementing <ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier());
 }
 public UpgradeOnDamageState(Actor self, UpgradeOnDamageStateInfo info)
 {
     this.info = info;
     um        = self.Trait <UpgradeManager>();
     health    = self.Trait <Health>();
 }