Exemplo n.º 1
0
        public BeamWeapon(World world, WeaponInit init) : base(world, init)
        {
            projectile = (BeamProjectile)Type.Projectile;
            rayPhysics = new RayPhysics(world)
            {
                Target       = TargetPosition,
                TargetHeight = TargetHeight
            };

            originPos    = init.Convert("OriginPosition", TargetPosition);
            originHeight = init.Convert("OriginHeight", TargetHeight);
            setPosition();

            impactInterval  = init.Convert("ImpactInterval", projectile.ImpactInterval);
            duration        = init.Convert("Duration", Type.ShootDuration);
            buildupduration = init.Convert("BuildupDuration", projectile.StartupDuration);
            endduration     = init.Convert("EndDuration", projectile.CooldownDuration);

            if (buildupduration > 0 && projectile.BeamStartUp != null)
            {
                useTexture(projectile.BeamStartUp);
            }
            else
            {
                useTexture(projectile.Beam);
            }

            if (projectile.BeamSound != null)
            {
                sound = new Sound(projectile.BeamSound);
                sound.Play(originPos, true);
            }
        }
Exemplo n.º 2
0
        public MagicWeapon(World world, WeaponInit init) : base(world, init)
        {
            projectile = (MagicProjectile)Type.Projectile;

            speed     = init.Convert("Speed", Vector.Zero);
            speedLeft = init.Convert("SpeedLeft", Vector.Zero);
            if (speed == Vector.Zero)
            {
                calculateSpeed();
            }

            rayPhysics = new RayPhysics(world);
        }
Exemplo n.º 3
0
        public BulletWeapon(World world, WeaponInit init) : base(world, init)
        {
            projectile = (BulletProjectile)Type.Projectile;

            speed     = init.Convert("Speed", Vector.Zero);
            speedLeft = init.Convert("SpeedLeft", Vector.Zero);
            if (speed == Vector.Zero)
            {
                calculateStartSpeed();
            }

            if (projectile.OrientateToTarget)
            {
                Rotation = new VAngle(0, 0, Angle);
            }

            rayPhysics = new RayPhysics(world);
        }
Exemplo n.º 4
0
        protected Weapon(World world, WeaponInit init) : base(init.Position, init.Type.Projectile.GetTexture())
        {
            World = world;
            Type  = init.Type;
            ID    = init.ID;

            Height = init.Height;

            var originID = init.Convert("Origin", uint.MaxValue);

            Origin = world.ActorLayer.ToAdd().FirstOrDefault(a => a.ID == originID);

            var targetID    = init.Convert("TargetActor", uint.MaxValue);
            var TargetActor = world.ActorLayer.ToAdd().FirstOrDefault(a => a.ID == targetID);

            if (TargetActor == null)
            {
                var targetPos    = init.Convert("OriginalTargetPosition", CPos.Zero);
                var targetHeight = init.Convert("OriginalTargetHeight", 0);
                Target = new Target(targetPos, targetHeight);
            }
            else
            {
                Target = new Target(TargetActor);
            }

            Angle             = init.Convert("Angle", 0f);
            DistanceTravelled = init.Convert("DistanceTravelled", 0);

            TargetPosition = init.Convert("TargetPosition", CPos.Zero);
            TargetHeight   = init.Convert("TargetHeight", 0);

            Team = init.Convert("Team", Team);

            InaccuracyModifier  = init.Convert("InaccuracyModifier", InaccuracyModifier);
            DamageModifier      = init.Convert("DamageModifier", DamageModifier);
            DamageRangeModifier = init.Convert("DamageRangeModifier", DamageRangeModifier);
            RangeModifier       = init.Convert("RangeModifier", RangeModifier);
        }
Exemplo n.º 5
0
 public InstantHitWeapon(World world, WeaponInit init) : base(world, init)
 {
     projectile = (InstantHitProjectile)Type.Projectile;
 }
Exemplo n.º 6
0
 public static Weapon Create(World world, WeaponInit init)
 {
     return((Weapon)Activator.CreateInstance(getWeaponType(init.Type), new object[] { world, init }));
 }