Ejemplo n.º 1
0
        public void addTexture(Texture2D tex, float frameTime)
        {
            if (A_AnimationChar == null)
                A_AnimationChar = new AnimationCharacter();
            if (A_AnimationChar.Animation == null)
            {
                Animation temp = new Animation(tex, frameTime, true);
                A_AnimationChar.PlayAnimation(tex, frameTime, true);
            }
            else
            {
                A_AnimationChar.Animation.effectPlayer.Texture = tex;
                A_AnimationChar.Animation.Texture = tex;

                A_AnimationChar.Animation.FrameTime = frameTime;
                A_AnimationChar.update();
            }
        }
Ejemplo n.º 2
0
        public void addTexture(TextureImg texImg, float frameTime)
        {
            Texture2D img = null;
            switch (texImg)
            {
                case TextureImg.Null:
                    break;
                case TextureImg.tree1:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree1");
                    break;
                case TextureImg.tree2:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree2");
                    break;
                case TextureImg.tree3:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree3");
                    break;
                case TextureImg.tree4:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree4");
                    break;
                case TextureImg.tree5:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree5");
                    break;
                case TextureImg.tree6:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree6");
                    break;
                case TextureImg.tree7:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree7");
                    break;
                case TextureImg.tree8:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree8");
                    break;
                case TextureImg.tree9:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree9");
                    break;
                case TextureImg.tree10:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/tree10");
                    break;
                case TextureImg.grass:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/grass");
                    break;
                case TextureImg.Idle:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/Idle");
                    break;
                case TextureImg.Run:
                    img = EnvironmentVariable.content.Load<Texture2D>("textures/Run");
                    break;
            }
            if (A_AnimationChar == null)
                A_AnimationChar = new AnimationCharacter();
            if (A_AnimationChar.Animation == null)
            {
                Animation temp = new Animation(img, frameTime, true);
                A_AnimationChar.PlayAnimation(img, frameTime, true);
            }
            else
            {
                A_AnimationChar.Animation.effectPlayer.Texture = img;
                A_AnimationChar.Animation.Texture = img;

                A_AnimationChar.Animation.FrameTime = frameTime;
                A_AnimationChar.update();
            }
        }
Ejemplo n.º 3
0
 public void PlayAnimation(Texture2D tex, float FrameTime, bool IsLooping)
 {
     this.Anim = new Animation(tex, FrameTime, true);
     this.i_FrameCurrent = 0;
     this.f_Time = 0.0f;
     if (this.Anim.Texture != null)
         this.i_nbrFrame = this.Anim.Texture.Width / this.Anim.Texture.Height;
 }