Ejemplo n.º 1
0
        public override void Initialize(ContentManager _Content)
        {
            base.Initialize(_Content);
            ResetDimensions();

            CreateFramesFromXML("Chickens_Frames");

            //Animation = "Fire";
            ResetDimensions();
            baseBarrel = new Sprite("chickens");
            baseBarrel.Initialize(_Content);
            baseBarrel.CreateFramesFromXML("Chickens_Frames");
            baseBarrel.UniformScale = 2.0f;

            baseBarrel.CurrentFrame = "cannon-base00000";
            Animation    = "Barrel";
            CurrentFrame = "cannon-seq-00000";


            baseBarrel.ResetDimensions();
            ResetDimensions();
            baseBarrel.UniformScale = 2.0f;
            UniformScale            = 2.0f;

            RayCastHit ah = screen.scene.World.RayCast(Position, new Vector2(0, -500) + Position);

            if (ah.actor != null)
            {
                Vector2 worldPos = ah.worldImpact + new Vector2(0, Height * UniformScale) / 2.7f;
                Position = worldPos;
            }

            Handle       = SpriteHandle.CUSTOM;
            CustomOrigin = new Vector2(Width / 2.0f, Height / 2.0f + 7);

            FrameChanges += OnFrameChange;

            smoke = new AnimSprite("chickens");
            smoke.Initialize(_Content);
            smoke.CreateFramesFromXML("Chickens_Frames");
            smoke.Animation    = "Barrel";
            smoke.UniformScale = UniformScale;
            smoke.Width        = Width;
            smoke.Height       = Height;
            smoke.Handle       = SpriteHandle.CENTERLEFT;
            smoke.RaiseFlag(Jabber.Flags.PASSRENDER);

            smoke.FrameChanges += OnSmokeFrameChange;


            trajectory = new AnimSprite("chickens");
            trajectory.Initialize(_Content);
            trajectory.CreateFramesFromXML("Chickens_Frames");
            trajectory.CurrentFrame = "feather-00000";
            trajectory.ResetDimensions();
            trajectory.UniformScale = 6.0f;
            trajectory.Width        = 10;
            trajectory.Height       = 10;
            trajectory.Handle       = SpriteHandle.CENTER;


            arrow = new AnimSprite("ui/ui");
            arrow.Initialize(_Content);
            arrow.CreateFramesFromXML("ui/ui_frames");
            arrow.CurrentFrame = "arrow_dir";
            arrow.ResetDimensions();
            arrow.UniformScale = 1.0f;
            arrow.Width        = 10;
            arrow.Height       = 10;
            arrow.Handle       = SpriteHandle.CENTER;
        }