Exemplo n.º 1
0
        void attack()
        {
            attackOrdered = false;

            if (Type.PreparationDelay != 0 && !self.DoesAction(ActionType.PREPARE_ATTACK))
            {
                return;                 // Preparation has been canceled
            }
            var weapon = WeaponCache.Create(self.World, info.Type, target, self);

            Target = weapon.TargetPosition;
            beam   = weapon as BeamWeapon;

            if (self.AttackWith(target, weapon))
            {
                var reloadModifier = 1f;
                foreach (var effect in self.GetEffects(EffectType.COOLDOWN))
                {
                    reloadModifier *= effect.Effect.Value;
                }

                Reload = (int)(Type.Reload * reloadModifier);

                var cooldownAction = new ActorAction(ActionType.END_ATTACK, Type.CooldownDelay);
                self.AddAction(ActionType.ATTACK, Type.ShootDuration, cooldownAction);
            }
        }
Exemplo n.º 2
0
        void createObject()
        {
            if (self.World.Game.SharedRandom.NextDouble() > info.Probability)
            {
                return;
            }

            var height = self.Height + info.Offset.Z;

            switch (info.Type)
            {
            case SpawnPartTypes.ACTOR:
                var actor = ActorCache.Create(self.World, info.Name, randomPosition(), info.InheritsTeam ? self.Team : Actor.NeutralTeam, info.InheritsBot && self.IsBot);

                if (info.InheritsBot && self.IsBot)
                {
                    actor.Bot.Target = self.Bot.Target;
                }
                actor.Height = height;

                self.World.Add(actor);
                break;

            case SpawnPartTypes.PARTICLE:
                var particle = ParticleCache.Create(self.World, info.Name, randomPosition(), self.Height + info.Offset.Z);
                particle.Height = height;

                self.World.Add(particle);
                break;

            case SpawnPartTypes.WEAPON:
                var weapon = WeaponCache.Create(self.World, info.Name, randomPosition(), self);
                weapon.Height = height;

                self.World.Add(weapon);
                break;

            default:
                return;
            }
        }