Ejemplo n.º 1
0
        public override void InitializeSlaveEntry(Actor slave, BaseSpawnerSlaveEntryB entry)
        {
            var se = entry as MobSpawnerSlaveEntry;

            base.InitializeSlaveEntry(slave, se);

            se.SpawnerSlave = slave.Trait <MobSpawnerSlave>();
            se.Health       = slave.Trait <Health>();
        }
Ejemplo n.º 2
0
        public virtual BaseSpawnerSlaveEntryB[] CreateSlaveEntries(BaseSpawnerMasterBInfo info)
        {
            var slaveEntries = new BaseSpawnerSlaveEntryB[info.Actors.Length];

            for (var i = 0; i < slaveEntries.Length; i++)
            {
                slaveEntries[i] = new BaseSpawnerSlaveEntryB();
            }

            return(slaveEntries);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Slave entry initializer function.
        /// Override this function from derived classes to initialize their own specific stuff.
        /// </summary>
        public virtual void InitializeSlaveEntry(Actor slave, BaseSpawnerSlaveEntryB entry)
        {
            entry.Actor        = slave;
            entry.SpawnerSlave = slave.Trait <BaseSpawnerSlaveB>();

            if (IsTraitDisabled)
            {
                entry.SpawnerSlave.GrantMasterDisabledCondition(entry.Actor);
            }

            if (IsTraitPaused)
            {
                entry.SpawnerSlave.GrantMasterPausedCondition(entry.Actor);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Replenish one slave entry.
        /// </summary>
        public virtual void Replenish(Actor self, BaseSpawnerSlaveEntryB entry)
        {
            if (entry.IsValid)
            {
                throw new InvalidOperationException("Replenish must not be run on a valid entry!");
            }

            // Some members are missing. Create a new one.
            var slave = self.World.CreateActor(false, entry.ActorName,
                                               new TypeDictionary {
                new OwnerInit(self.Owner)
            });

            // Initialize slave entry
            InitializeSlaveEntry(slave, entry);
            entry.SpawnerSlave.LinkMaster(entry.Actor, self, this);
        }