Ejemplo n.º 1
0
Archivo: Skree.cs Proyecto: endy/IvyXNA
        public override void Initialize()
        {
            base.Initialize();

            m_spriteMap = Game.Content.Load<Texture2D>("Sprites\\skree");

            m_animGraph = new AnimGraph(this);
            m_animGraph.Initialize();

            Rectangle rotateAnimRect = new Rectangle(0, 0, 88, 30);
            AnimatedSprite rotateAnim = new AnimatedSprite(m_spriteMap, rotateAnimRect, 4, 10);
            rotateAnim.Initialize();
            rotateAnim.Scale = new Vector2(3f, 3f);

            Rectangle attackRect = new Rectangle(88, 0, 26, 26);
            AnimatedSprite attackAnim = new AnimatedSprite(m_spriteMap, attackRect, 1, 1);
            attackAnim.Initialize();
            attackAnim.Scale = new Vector2(3f, 3f);

            IAnimGraphNode rotateNode = m_animGraph.AddAnim(rotateAnim);
            IAnimGraphNode attackNode = m_animGraph.AddAnim(attackAnim);

            m_animGraph.AddTransition(rotateNode, MessageType.ActivateSkree, attackNode);
            m_animGraph.AddTransition(attackNode, MessageType.ActivateSkree, rotateNode);

            m_animGraph.SetCurrentNode(rotateNode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            m_weaponMap = Game.Content.Load<Texture2D>("Sprites\\samusMap");
            m_fireEffect = Game.Content.Load<SoundEffect>("Audio\\weapon_fire");

            m_projectileAnim = new AnimatedSprite(m_weaponMap, m_projectileRect, 2, 10f);
            m_projectileAnim.Initialize();

            m_explosionAnim = new AnimatedSprite(m_weaponMap, m_explosionRect, 6, 18f);
            m_explosionAnim.Initialize();
            m_explosionAnim.Loop = false;

            base.Initialize();
        }