Example #1
0
        public GravityBomb(GravityBombInfo info, ProjectileArgs args)
        {
            this.info = info;
            this.args = args;
            pos       = args.Source;
            var convertedVelocity = new WVec(info.Velocity.Y, -info.Velocity.X, info.Velocity.Z);

            velocity = convertedVelocity.Rotate(WRot.FromYaw(args.Facing));
            var convertedAcceleration = new WVec(info.Acceleration.Y, -info.Acceleration.X, info.Acceleration.Z);

            acceleration = convertedAcceleration.Rotate(WRot.FromYaw(args.Facing));

            if (!string.IsNullOrEmpty(info.Image))
            {
                anim = new Animation(args.SourceActor.World, info.Image, () => args.Facing);

                if (!string.IsNullOrEmpty(info.OpenSequence))
                {
                    anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom)));
                }
                else
                {
                    anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom));
                }
            }

            shadowColor = new float3(info.ShadowColor.R, info.ShadowColor.G, info.ShadowColor.B) / 255f;
            shadowAlpha = info.ShadowColor.A / 255f;
        }
Example #2
0
        public GravityBomb(GravityBombInfo info, ProjectileArgs args)
        {
            this.info    = info;
            this.args    = args;
            pos          = args.Source;
            velocity     = new WVec(WDist.Zero, WDist.Zero, -info.Speed);
            acceleration = new WVec(WDist.Zero, WDist.Zero, info.Acceleration);

            if (!string.IsNullOrEmpty(info.Image))
            {
                anim = new Animation(args.SourceActor.World, info.Image);

                if (!string.IsNullOrEmpty(info.OpenSequence))
                {
                    anim.PlayThen(info.OpenSequence, () => anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom)));
                }
                else
                {
                    anim.PlayRepeating(info.Sequences.Random(args.SourceActor.World.SharedRandom));
                }
            }
        }