/// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="parent">The parent task.</param>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 public SingleAnimationGameAction(IGameAction parent, SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty)
     : base(parent, "SingleAnimationGameAction" + instances++)
 {
     this.animation          = animation;
     this.singleAnimation    = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
Example #2
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent
            };

            EntityManager.Add(camera2D);

            this.gameStorage = Catalog.GetItem <GameStorage>();
            this.gameScene   = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                               .FindScene <GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem <GameStorage>();
                WaveServices.Storage.Write <GameStorage>(gameStorage);
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;

            // Animations
            Duration duration = TimeSpan.FromSeconds(1);

            this.scaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
Example #3
0
        protected override void Start()
        {
            base.Start();

            var superAnimation = this.EntityManager.Find("Super").FindComponent <AnimationUI>();
            var squidAnimation = this.EntityManager.Find("Squid").FindComponent <AnimationUI>();
            var playAnimation  = this.EntityManager.Find <Button>("Play").Entity.FindComponent <AnimationUI>();


            // Animations
            float    viewportWidthOverTwo = 768 / 2;
            Duration duration             = TimeSpan.FromSeconds(1);

            superAppear       = new SingleAnimation(-viewportWidthOverTwo, viewportWidthOverTwo, duration, EasingFunctions.Back);
            squidAppear       = new SingleAnimation(this.VirtualScreenManager.VirtualWidth * 2, viewportWidthOverTwo, duration, EasingFunctions.Back);
            playScaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            playOpacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);

            // Super animation
            superAnimation.BeginAnimation(Transform2D.XProperty, superAppear);

            // Squid animation
            squidAnimation.BeginAnimation(Transform2D.XProperty, squidAppear);

            // Play button animation
            playAnimation.BeginAnimation(Transform2D.XScaleProperty, playScaleAppear);
            playAnimation.BeginAnimation(Transform2D.YScaleProperty, playScaleAppear);
            playAnimation.BeginAnimation(Transform2D.OpacityProperty, playOpacityAppear);
        }
Example #4
0
        protected override void Start()
        {
            base.Start();

            // Animations
            Duration duration      = TimeSpan.FromSeconds(1);
            var      scaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            var      opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);

            // Game animation
            var gameAnimation = this.EntityManager.Find("Game").FindComponent <AnimationUI>();

            gameAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            gameAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            gameAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);

            // Over animation
            var overAnimation = this.EntityManager.Find("Over").FindComponent <AnimationUI>();

            overAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            overAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            overAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);

            // Restart button animation
            var restartAnimation = this.EntityManager.Find("Restart").FindComponent <AnimationUI>();

            restartAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            restartAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            restartAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);
        }
        /// <summary>
        /// Updates the value.
        /// </summary>
        /// <param name="value">The value.</param>
        private void UpdateValue(int value)
        {
            if (this.value != value)
            {
                int oldValue = this.value;
                this.value = value;

                // Event
                if (this.ValueChanged != null)
                {
                    this.ValueChanged(this, new ChangedEventArgs(oldValue, value));
                }

                // Update
                if (this.animation != null)
                {
                    // UpdateUI with animation
                    float convertionValue = this.Panel.Width * (value - this.minimum) / this.difference;
                    this.move = new SingleAnimation(this.foregroundTransform.XScale, convertionValue, this.duration);
                    this.animation.BeginAnimation(Transform2D.XScaleProperty, this.move);
                }
                else if (this.foregroundTransform != null)
                {
                    // UpdateUI without animation
                    this.foregroundTransform.XScale = this.Panel.Width * (value - this.minimum) / this.difference;
                }
            }
        }
Example #6
0
        /// <summary>
        /// Draws the model.
        /// </summary>
        public void Draw(double aTimeHead = 0, SingleAnimation headanim = null, double aTimeTorso = 0, SingleAnimation torsoanim = null, double aTimeLegs = 0, SingleAnimation legsanim = null, bool forceBones = false)
        {
            LastDrawTime = Engine.cTime;
            hAnim        = headanim;
            tAnim        = torsoanim;
            lAnim        = legsanim;
            bool any = hAnim != null || tAnim != null || lAnim != null || forceBones;

            if (any)
            {
                // globalInverse = Root.Inverted();
                aTHead  = aTimeHead;
                aTTorso = aTimeTorso;
                aTLegs  = aTimeLegs;
                UpdateTransforms(RootNode, Matrix4.Identity);
            }
            // TODO: If hasBones && !any { defaultBones() } ?
            for (int i = 0; i < Meshes.Count; i++)
            {
                if (any && Meshes[i].Bones.Count > 0)
                {
                    Matrix4[] mats = new Matrix4[Meshes[i].Bones.Count];
                    for (int x = 0; x < Meshes[i].Bones.Count; x++)
                    {
                        mats[x] = Meshes[i].Bones[x].Transform;
                    }
                    SetBones(mats);
                }
                Meshes[i].Draw();
            }
        }
        protected override void Start()
        {
            base.Start();

            var superAnimation = this.EntityManager.Find("Super").FindComponent<AnimationUI>();
            var squidAnimation = this.EntityManager.Find("Squid").FindComponent<AnimationUI>();
            var playAnimation = this.EntityManager.Find<Button>("Play").Entity.FindComponent<AnimationUI>();

            // Animations
            float viewportWidthOverTwo = 768 / 2;
            Duration duration = TimeSpan.FromSeconds(1);
            superAppear = new SingleAnimation(-viewportWidthOverTwo, viewportWidthOverTwo, duration, EasingFunctions.Back);
            squidAppear = new SingleAnimation(WaveServices.ViewportManager.VirtualWidth * 2, viewportWidthOverTwo, duration, EasingFunctions.Back);
            playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            playOpacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);

            // Super animation
            superAnimation.BeginAnimation(Transform2D.XProperty, superAppear);

            // Squid animation
            squidAnimation.BeginAnimation(Transform2D.XProperty, squidAppear);

            // Play button animation
            playAnimation.BeginAnimation(Transform2D.XScaleProperty, playScaleAppear);
            playAnimation.BeginAnimation(Transform2D.YScaleProperty, playScaleAppear);
            playAnimation.BeginAnimation(Transform2D.OpacityProperty, playOpacityAppear);
        }
Example #8
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent };
            EntityManager.Add(camera2D);

            this.gameStorage = Catalog.GetItem<GameStorage>();
            this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                                                              .FindScene<GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem<GameStorage>();
                WaveServices.Storage.Write<GameStorage>(gameStorage);
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;

            // Animations            
            Duration duration = TimeSpan.FromSeconds(1);          
            this.scaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
        protected override void Initialize()
        {
            base.Initialize();

            var position = this.transform.Position;

            // Animations
            float offset = 80;
            this.leftAnim = new SingleAnimation(position.X + offset, position.X, TimeSpan.FromSeconds(3));
            this.leftAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            };
            this.rightAnim = new SingleAnimation(position.X, position.X + offset, TimeSpan.FromSeconds(3));
            this.rightAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            };

            if (this.RightAnimation)
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            }
            else
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            }

        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 /// <param name="scene">The associated scene.</param>
 public SingleAnimationGameAction(SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty, Scene scene = null)
     : base("SingleAnimationGameAction" + instances++, scene)
 {
     this.animation          = animation;
     this.singleAnimation    = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
Example #11
0
        protected override void Initialize()
        {
            base.Initialize();

            var position = this.transform.Position;

            // Animations
            float offset = 80;

            this.leftAnim            = new SingleAnimation(position.X + offset, position.X, TimeSpan.FromSeconds(3));
            this.leftAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            };
            this.rightAnim            = new SingleAnimation(position.X, position.X + offset, TimeSpan.FromSeconds(3));
            this.rightAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            };

            if (this.RightAnimation)
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            }
            else
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            }
        }
Example #12
0
        /// <summary>
        /// Sets default values for this instance.
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.fadeIn = new SingleAnimation(0.2f, 1, new Duration(TimeSpan.FromSeconds(.4f)));
            this.fadeOut = new SingleAnimation(1, 0.2f, new Duration(TimeSpan.FromSeconds(.4f)));
        }
Example #13
0
        public ScreenBase( ) : base(  )
        {
            this.DrawOrder           = 1;
            this.Visible             = false;
            this.VerticalAlignment   = VerticalAlignment.Stretch;
            this.HorizontalAlignment = HorizontalAlignment.Stretch;
            this.Width          = ScreenHelper.ORIGINAL_WIDTH;
            this.Height         = ScreenHelper.ORIGINAL_HEIGHT;
            this.ScissorTest    = false;
            this.HitTestEnabled = true;

            fadeAnimation = new SingleAnimation(
                0, 1, TimeSpan.FromMilliseconds(300), false);

            fadeAnimation.Completed += delegate {
                if (hiding)
                {
                    this.Visible   = false;
                    this.IsEnabled = false;
                    if (this.Closed != null)
                    {
                        this.Closed(this, EventArgs.Empty);
                    }
                }
                else
                {
                    this.IsEnabled = true;
                    if (this.Open != null)
                    {
                        this.Open(this, EventArgs.Empty);
                    }
                }
            };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 /// <param name="scene">The associated scene.</param>
 public SingleAnimationGameAction(SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty, Scene scene = null)
     : base("SingleAnimationGameAction" + instances++, scene)
 {
     this.animation = animation;
     this.singleAnimation = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
Example #15
0
        /// <summary>
        /// Sets default values for this instance.
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.fadeIn  = new SingleAnimation(0.2f, 1, new Duration(TimeSpan.FromSeconds(.4f)));
            this.fadeOut = new SingleAnimation(1, 0.2f, new Duration(TimeSpan.FromSeconds(.4f)));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
 /// </summary>
 /// <param name="parent">The parent task.</param>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animation">The AnimationUI component.</param>
 /// <param name="dependencyProperty">The dependency property to animate.</param>
 public SingleAnimationGameAction(IGameAction parent, SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty)
     : base(parent, "SingleAnimationGameAction" + instances++)
 {
     this.animation = animation;
     this.singleAnimation = singleAnimation;
     this.dependencyProperty = dependencyProperty;
 }
        private void EndAnimation()
        {
            SingleAnimation getOutAnimation =
                new SingleAnimation(
                    0, -500, TimeSpan.FromSeconds(1), EasingFunctions.Back);

            getOutAnimation.Completed += getOutAnimation_Completed;

            tower.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.XProperty,
                        getOutAnimation)
                    .BeginAnimation(
                        Transform2D.OpacityProperty,
                        new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));

            background.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.OpacityProperty,
                        new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));

            text.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.OpacityProperty,
                        new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));
        }
        protected override void Start()
        {
            base.Start();

            // Animations
            Duration duration = TimeSpan.FromSeconds(1);
            var scaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            var opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);

            // Game animation
            var gameAnimation = this.EntityManager.Find("Game").FindComponent<AnimationUI>();
            gameAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            gameAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            gameAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);

            // Over animation
            var overAnimation = this.EntityManager.Find("Over").FindComponent<AnimationUI>();
            overAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            overAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            overAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);

            // Restart button animation
            var restartAnimation = this.EntityManager.Find("Restart").FindComponent<AnimationUI>();
            restartAnimation.BeginAnimation(Transform2D.XScaleProperty, scaleAppear);
            restartAnimation.BeginAnimation(Transform2D.YScaleProperty, scaleAppear);
            restartAnimation.BeginAnimation(Transform2D.OpacityProperty, opacityAppear);
        }
Example #19
0
        private void EndAnimation()
        {
            SingleAnimation getOutAnimation =
                new SingleAnimation(
                    0, -500, TimeSpan.FromSeconds(1), EasingFunctions.Back);

            getOutAnimation.Completed += getOutAnimation_Completed;

            tower.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.XProperty,
                getOutAnimation)
            .BeginAnimation(
                Transform2D.OpacityProperty,
                new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));

            background.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.OpacityProperty,
                new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));

            text.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.OpacityProperty,
                new SingleAnimation(1, 0, TimeSpan.FromSeconds(1)));
        }
        private void OwnerEntityInitialized(object sender, EventArgs e)
        {
            this.Owner.EntityInitialized -= this.OwnerEntityInitialized;

            var animation = new SingleAnimation(this.From, this.To, TimeSpan.FromSeconds(this.DurationSeconds), EasingFunctions.Cubic);

            this.animationUI.BeginAnimation(this.AnimationProperty, animation);
        }
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckBoxBehavior" /> class.
 /// </summary>
 public CheckBoxBehavior()
     : base("CheckBehavior")
 {
     Duration duration = new Duration(TimeSpan.FromSeconds(.4f));
     this.fadeIn = new SingleAnimation(0, 1, duration);
     this.fadeOut = new SingleAnimation(1, 0, duration);
     this.isChecked = false;
 }
Example #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckBoxBehavior" /> class.
        /// </summary>
        public CheckBoxBehavior()
            : base("CheckBehavior")
        {
            Duration duration = new Duration(TimeSpan.FromSeconds(.4f));

            this.fadeIn    = new SingleAnimation(0, 1, duration);
            this.fadeOut   = new SingleAnimation(1, 0, duration);
            this.isChecked = false;
        }
Example #23
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.ClearFlags = ClearFlags.DepthAndStencil;
            EntityManager.Add(camera2d);

            // Music Player
            MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3");

            WaveServices.MusicPlayer.Play(musicInfo);
            WaveServices.MusicPlayer.IsRepeat = true;

            WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3"));
            WaveServices.MusicPlayer.IsDolbyEnabled = true;
            WaveServices.MusicPlayer.DolbyProfile   = DolbyProfiles.GAME;

            // Button Stack Panel
            buttonPanel = new StackPanel();
            buttonPanel.Entity.AddComponent(new AnimationUI());
            buttonPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Center;
            buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            // Enable/Disable Dolby Button
            this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick);
            buttonPanel.Add(this.enableDolbyButton);

            // Profile Buttons
            this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick);
            buttonPanel.Add(this.profileGameButton);
            this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick);
            buttonPanel.Add(this.profileMovieButton);
            this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick);
            buttonPanel.Add(this.profileMusicButton);
            this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick);
            buttonPanel.Add(this.profileVoiceButton);
            EntityManager.Add(buttonPanel);

            // Information Text
            infoPanel = new StackPanel();
            infoPanel.Entity.AddComponent(new AnimationUI());
            infoPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom;
            infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            infoPanel.Orientation = Orientation.Vertical;
            this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty);
            infoPanel.Add(this.isDolbyEnabledTextBox);
            this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty);
            infoPanel.Add(this.selectedDolbyProfileTextBox);
            EntityManager.Add(infoPanel);

            // Sets text
            this.SetDolbyText();

            //// Animations
            this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic);
        }
Example #24
0
        public Insect(int type, float speed, int score, string spriteName)
        {
            m_Type       = type;
            m_Speed      = speed;
            m_Score      = score;
            m_SpriteName = spriteName;

            int    x          = WaveServices.Random.Next(0, 768);
            string spritePath = m_SpriteName + ".wpkk";
            string spriteMap  = m_SpriteName + ".xml";

            m_Entity = new Entity()
                       .AddComponent(
                new Transform2D()
            {
                Origin = Vector2.Center,
                X      = x,
                Y      = 0,
            })
                       .AddComponent(new Sprite(spritePath))
                       .AddComponent(Animation2D.Create <TexturePackerGenericXml> (spriteMap)
                                     .Add("Run", new SpriteSheetAnimationSequence()
            {
                First           = 2,
                Length          = 2,
                FramesPerSecond = 10
            })
                                     .Add("Die", new SpriteSheetAnimationSequence()
            {
                First           = 1,
                Length          = 1,
                FramesPerSecond = 5
            })
                                     )
                       .AddComponent(new AnimationUI())
                       .AddComponent(new TouchGestures()
            {
                EnabledGestures = SupportedGesture.Translation
            })
                       .AddComponent(new RectangleCollider())
                       .AddComponent(new InsectBehavior())
                       .AddComponent(new AnimatedSpriteRenderer(DefaultLayers.Debug));

            var         move      = new SingleAnimation(0f, WaveServices.Platform.ScreenHeight, 1f / m_Speed, EasingFunctions.Cubic);
            AnimationUI animation = m_Entity.FindComponent <AnimationUI>();

            animation.BeginAnimation(Transform2D.YProperty, move);

            var anim2D = m_Entity.FindComponent <Animation2D>();

            anim2D.Play(true);

            var insectBehavior = m_Entity.FindComponent <InsectBehavior> ();

            insectBehavior.SetState(InsectBehavior.AnimState.Run);
        }
        protected override void Initialize()
        {
            base.Initialize();

            this.inputService = WaveServices.Input;
            this.flicker      = new SingleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.4f)));

            this.Gestures.TouchPressed -= this.Gestures_TouchPressed;
            this.Gestures.TouchPressed += this.Gestures_TouchPressed;
        }
Example #26
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera")
            {
                BackgroundColor = Color.Black,
                ClearFlags      = ClearFlags.DepthAndStencil,
            };

            camera2d.BackgroundColor = Color.Black;
            EntityManager.Add(camera2d);

            Entity logo = new Entity()
                          .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 227, Origin = Vector2.Center, DrawOrder = 0.1f
            })
                          .AddComponent(new Sprite("Content/DeepSpace_logo.wpk"))
                          .AddComponent(new AnimationUI())
                          .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            this.labelAnimation = logo.FindComponent <AnimationUI>();

            this.EntityManager.Add(logo);

            var button = new Button()
            {
                Margin = new Thickness(0, 657, 0, 0),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Text                   = string.Empty,
                IsBorder               = false,
                BackgroundImage        = "Content/PressStart.wpk",
                PressedBackgroundImage = "Content/PressStart.wpk"
            };

            button.Click += (o, e) =>
            {
                var gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlayContext").FindScene <GamePlayScene>();

                gameScene.State = GameState.Game;

                WaveServices.ScreenContextManager.Pop(new CrossFadeTransition(TimeSpan.FromSeconds(0.5f)));
                ////WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f)));
            };

            button.Entity.AddComponent(new AnimationUI());
            this.playAnimation = button.Entity.FindComponent <AnimationUI>();

            this.EntityManager.Add(button);


            this.playScaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, TimeSpan.FromSeconds(1), EasingFunctions.Cubic);
        }
Example #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextBoxBehavior" /> class.
        /// </summary>
        public TextBoxBehavior()
            : base("TextBoxBehavior")
        {
            this.uppercase     = false;
            this.altcase       = false;
            this.acceptsReturn = false;
            this.isReadOnly    = false;

            this.flicker          = new SingleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.4f)));
            this.textBeforeCursor = string.Empty;
            this.textAfterCursor  = string.Empty;
        }
Example #28
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.BackgroundColor = Color.Blue;
            EntityManager.Add(camera2d);

            //// Entities
            // Left Speaker
            this.leftSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.LeftEdge, WaveServices.ViewportManager.VirtualHeight / 2, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity leftChild = this.CreateSpeaker(0.0f, 0.0f, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);

            leftChild.AddComponent(new BlinkBehavior());
            this.leftSpeaker.AddChild(leftChild);
            EntityManager.Add(this.leftSpeaker);

            // Right Speaker
            this.rightSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.RightEdge, WaveServices.ViewportManager.VirtualHeight / 2, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity rightChild = this.CreateSpeaker(0.0f, 0.0f, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);

            rightChild.AddComponent(new BlinkBehavior());
            this.rightSpeaker.AddChild(rightChild);
            EntityManager.Add(this.rightSpeaker);

            // Dolby Logo
            this.dolbyLogo = new Entity()
                             .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = WaveServices.ViewportManager.VirtualHeight / 2, Origin = Vector2.Center, DrawOrder = 0.5f, Opacity = 1
            })
                             .AddComponent(new AnimationUI())
                             .AddComponent(new Sprite("Content/logo.wpk"))
                             .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.dolbyLogo);

            // Background
            this.background = new Entity()
                              .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 0, Origin = new Vector2(0.5f, 0), DrawOrder = 1.0f, XScale = 1.5f, YScale = 1.5f
            })
                              .AddComponent(new AnimationUI())
                              .AddComponent(new Sprite("Content/background.wpk"))
                              .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.background);

            //// Animations
            this.fadeIn                 = new SingleAnimation(0, 1, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.logoYTransform         = new SingleAnimation(WaveServices.ViewportManager.VirtualHeight / 2, 50, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.backgoundYtransform    = new SingleAnimation(-50, -90, TimeSpan.FromSeconds(20), EasingFunctions.Cubic);
            this.leftSpeakerXtransform  = new SingleAnimation(-500, 0, TimeSpan.FromSeconds(6));
            this.rightSpeakerXtransform = new SingleAnimation(WaveServices.ViewportManager.RightEdge + 500, WaveServices.ViewportManager.RightEdge, TimeSpan.FromSeconds(6));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ToggleSwitchBehavior" /> class.
        /// </summary>
        public ToggleSwitchBehavior()
            : base("ToggleSwitchBehavior")
        {
            this.on      = false;
            this.onText  = "On";
            this.offText = "Off";

            Duration duration = new Duration(TimeSpan.FromSeconds(.4f));

            this.animOn  = new SingleAnimation(0, DefaultOffset, duration);
            this.animOff = new SingleAnimation(DefaultOffset, 0, duration);
        }
Example #30
0
        /// <summary>
        /// Sets default values for this instance.
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.uppercase     = false;
            this.altcase       = false;
            this.acceptsReturn = false;
            this.isReadOnly    = false;

            this.flicker          = new SingleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.4f)));
            this.textBeforeCursor = string.Empty;
            this.textAfterCursor  = string.Empty;
        }
Example #31
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera")
            {
                BackgroundColor = Color.Black,
                ClearFlags = ClearFlags.DepthAndStencil,
            };
            camera2d.BackgroundColor = Color.Black;
            EntityManager.Add(camera2d);

            Entity logo = new Entity()
            .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 227, Origin = Vector2.Center, DrawOrder = 0.1f })
            .AddComponent(new Sprite("Content/DeepSpace_logo.wpk"))
            .AddComponent(new AnimationUI())
            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            this.labelAnimation = logo.FindComponent<AnimationUI>();

            this.EntityManager.Add(logo);
           
            var button = new Button()
            {
                Margin = new Thickness(0, 657, 0, 0),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Text = string.Empty,
                IsBorder = false,
                BackgroundImage = "Content/PressStart.wpk",
                PressedBackgroundImage = "Content/PressStart.wpk"

            };

            button.Click += (o, e) =>
            {
                var gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlayContext").FindScene<GamePlayScene>();

                gameScene.State = GameState.Game;

                WaveServices.ScreenContextManager.Pop(new CrossFadeTransition(TimeSpan.FromSeconds(0.5f)));
                ////WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f)));
            };

            button.Entity.AddComponent(new AnimationUI());
            this.playAnimation = button.Entity.FindComponent<AnimationUI>();

            this.EntityManager.Add(button);


            this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, TimeSpan.FromSeconds(1), EasingFunctions.Cubic);
        }
Example #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Squid" /> class.
        /// </summary>
        /// <param name="positionY">The position Y.</param>
        public Squid(float positionY)
        {
            this.initialPosY  = positionY;
            this.gamePlayPosY = WaveServices.ViewportManager.BottomEdge + 50;

            this.entity = new Entity("SquidEntity")
                          .AddComponent(new Transform2D()
            {
                Origin    = new Vector2(0.5f, 0f),
                X         = WaveServices.ViewportManager.VirtualWidth / 2,
                Y         = this.gamePlayPosY,
                DrawOrder = 0.3f,
            })
                          .AddComponent(new AnimationUI())
                          .AddComponent(new SquidBehavior())
                          .AddComponent(new Sprite(Directories.TexturePath + "squidSpriteSheet.wpk"))
                          .AddComponent(Animation2D.Create <TexturePackerGenericXml>(Directories.TexturePath + "squidSpriteSheet.xml")
                                        .Add("swim", new SpriteSheetAnimationSequence()
            {
                First = 1, Length = 30, FramesPerSecond = 30
            }))
                          .AddComponent(new PerPixelCollider(Directories.TexturePath + "squidCollider.wpk", 0.5f))
                          .AddComponent(new AnimatedSpriteRenderer(DefaultLayers.Alpha));

            // Cached
            this.transform   = this.entity.FindComponent <Transform2D>();
            this.animation2D = this.entity.FindComponent <Animation2D>();
            this.direction   = -Vector2.UnitY;
            this.animation   = this.entity.FindComponent <AnimationUI>();

            // Bubble
            this.entity.AddChild(new Entity("bubblesParticle")
                                 .AddComponent(new Transform2D()
            {
                LocalY = 210,
            })
                                 .AddComponent(ParticleFactory.CreateBubbleParticles())
                                 .AddComponent(
                                     new Material2D(new BasicMaterial2D(Directories.TexturePath + "waterParticle.wpk",
                                                                        DefaultLayers.Additive)))
                                 .AddComponent(new ParticleSystemRenderer2D("bubblesParticle")));

            // Cached
            this.particleSystem = this.entity.FindChild("bubblesParticle").FindComponent <ParticleSystem2D>();

            // Animations
            this.appearAnim = new SingleAnimation(gamePlayPosY, this.initialPosY, TimeSpan.FromSeconds(1.5f), EasingFunctions.Cubic);
        }
Example #33
0
        /// <summary>
        /// Performs further custom initialization for this instance.
        /// </summary>
        /// <remarks>
        /// By default this method does nothing.
        /// </remarks>
        protected override void Initialize()
        {
            base.Initialize();

            // Start accelerometer if it is avaible
            if (this.inputManager.AccelerometerState.IsConnected)
            {
                this.inputManager.StartAccelerometer();
            }

            // Animations
            float gamePlayPosY = this.transform2D.Y;
            float initialPosY  = gamePlayPosY + 400;

            this.appearAnim = new SingleAnimation(initialPosY, gamePlayPosY, TimeSpan.FromSeconds(1.5f), EasingFunctions.Cubic);
        }
        public ButtonScroll()
        {
            PixelShader           = new PixelShader();
            PixelShader.UriSource = new Uri("pack://application:,,,/WrathEdControls;component/Shader/ButtonScroll.ps");
            AlphaTex  = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/WrathEdControls;component/Art/Textures/ShellButton/ShellButtonHoverAlpha.png")));
            ScrollTex = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/WrathEdControls;component/Art/Textures/ShellButton/ShellButtonHoverScroll.png")));
            UpdateShaderValue(InputProperty);
            UpdateShaderValue(alphaTex);
            UpdateShaderValue(scrollTex);
            SingleAnimation animation = new SingleAnimation();

            animation.From           = 0.5f;
            animation.To             = -1;
            animation.Duration       = new Duration(TimeSpan.FromSeconds(1));
            animation.RepeatBehavior = RepeatBehavior.Forever;
            BeginAnimation(time, animation);
        }
Example #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SliderBehavior" /> class.
        /// </summary>
        public SliderBehavior()
            : base("SliderBehavior")
        {
            this.maximum     = 100;
            this.minimum     = 0;
            this.difference  = this.maximum - this.minimum;
            this.value       = this.minimum;
            this.orientation = Orientation.Horizontal;

            Duration duration = new Duration(TimeSpan.FromSeconds(.4f));

            this.fadeIn  = new SingleAnimation(0, 1, duration);
            this.fadeOut = new SingleAnimation(1, 0, duration);

            this.oldCachedValue1 = -1;
            this.oldCachedValue2 = -1;
        }
Example #36
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent };
            EntityManager.Add(camera2D);

            this.gameStorage = Catalog.GetItem<GameStorage>();

            this.CreateUI();

            // Animations
            float viewportWidthOverTwo = WaveServices.ViewportManager.VirtualWidth / 2;
            Duration duration = TimeSpan.FromSeconds(1);
            this.superAppear = new SingleAnimation(-viewportWidthOverTwo, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.squidAppear = new SingleAnimation(WaveServices.ViewportManager.VirtualWidth * 2, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
Example #37
0
        /// <summary>
        /// Draws the model.
        /// </summary>
        public void Draw(double aTimeHead = 0, SingleAnimation headanim = null, double aTimeTorso = 0, SingleAnimation torsoanim = null, double aTimeLegs = 0, SingleAnimation legsanim = null)
        {
            hAnim = headanim;
            tAnim = torsoanim;
            lAnim = legsanim;
            bool any = hAnim != null || tAnim != null || lAnim != null;

            if (any)
            {
                if (hAnim != null)
                {
                    Engine = hAnim.Engine;
                }
                else if (tAnim != null)
                {
                    Engine = tAnim.Engine;
                }
                else
                {
                    Engine = lAnim.Engine;
                }
                globalInverse = Root.Inverted();
                aTHead        = aTimeHead;
                aTTorso       = aTimeTorso;
                aTLegs        = aTimeLegs;
                UpdateTransforms(RootNode, Matrix4.Identity);
            }
            for (int i = 0; i < Meshes.Count; i++)
            {
                if (Meshes[i].Bones.Count > 0)
                {
                    Matrix4[] mats = new Matrix4[Meshes[i].Bones.Count];
                    for (int x = 0; x < Meshes[i].Bones.Count; x++)
                    {
                        mats[x] = Meshes[i].Bones[x].Transform;
                    }
                    SetBones(mats);
                }
                Meshes[i].Draw();
            }
            if (any)
            {
                VBO.BonesIdentity();
            }
        }
Example #38
0
 public void SetAnimation(string anim, byte mode)
 {
     if (mode == 0)
     {
         hAnim  = TheClient.Animations.GetAnimation(anim, TheClient.Files);
         aHTime = 0;
     }
     else if (mode == 1)
     {
         tAnim  = TheClient.Animations.GetAnimation(anim, TheClient.Files);
         aTTime = 0;
     }
     else
     {
         lAnim  = TheClient.Animations.GetAnimation(anim, TheClient.Files);
         aLTime = 0;
     }
 }
Example #39
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all 
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.BackgroundColor = Color.Blue;
            EntityManager.Add(camera2d);
            
            //// Entities
            // Left Speaker
            this.leftSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.LeftEdge, WaveServices.ViewportManager.VirtualHeight / 2, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity leftChild = this.CreateSpeaker(0.0f, 0.0f, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);
            leftChild.AddComponent(new BlinkBehavior());
            this.leftSpeaker.AddChild(leftChild);
            EntityManager.Add(this.leftSpeaker);

            // Right Speaker
            this.rightSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.RightEdge, WaveServices.ViewportManager.VirtualHeight / 2, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity rightChild = this.CreateSpeaker(0.0f, 0.0f, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);
            rightChild.AddComponent(new BlinkBehavior());
            this.rightSpeaker.AddChild(rightChild);
            EntityManager.Add(this.rightSpeaker);

            // Dolby Logo
            this.dolbyLogo = new Entity()
                            .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2, Y = WaveServices.ViewportManager.VirtualHeight / 2, Origin = Vector2.Center, DrawOrder = 0.5f, Opacity = 1 })
                            .AddComponent(new AnimationUI())
                            .AddComponent(new Sprite("Content/logo.wpk"))
                            .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.dolbyLogo);

            // Background
            this.background = new Entity()
                  .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 0, Origin = new Vector2(0.5f, 0), DrawOrder = 1.0f, XScale = 1.5f, YScale = 1.5f })
                  .AddComponent(new AnimationUI())
                  .AddComponent(new Sprite("Content/background.wpk"))
                  .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.background);

            //// Animations
            this.fadeIn = new SingleAnimation(0, 1, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.logoYTransform = new SingleAnimation(WaveServices.ViewportManager.VirtualHeight / 2, 50, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.backgoundYtransform = new SingleAnimation(-50, -90, TimeSpan.FromSeconds(20), EasingFunctions.Cubic);
            this.leftSpeakerXtransform = new SingleAnimation(-500, 0, TimeSpan.FromSeconds(6));
            this.rightSpeakerXtransform = new SingleAnimation(WaveServices.ViewportManager.RightEdge + 500, WaveServices.ViewportManager.RightEdge, TimeSpan.FromSeconds(6));         
        }
Example #40
0
        private void StartAnimation()
        {
            TimeSpan animationTime = TimeSpan.FromMilliseconds(600);

            background.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.OpacityProperty,
                new SingleAnimation(0f, 1f, TimeSpan.FromMilliseconds(2000)));

            tower.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.XScaleProperty,
                new SingleAnimation(1f, 1.2f, TimeSpan.FromMilliseconds(2000), EasingFunctions.Cubic))
            .BeginAnimation(
                Transform2D.YScaleProperty,
                new SingleAnimation(1f, 1.2f, TimeSpan.FromMilliseconds(2000), EasingFunctions.Cubic))
            .BeginAnimation(
                Transform2D.XProperty,
                new SingleAnimation(-400, 0, TimeSpan.FromSeconds(2), EasingFunctions.Cubic));

            SingleAnimation positionX =
                new SingleAnimation(
                    -325,
                    300,
                    TimeSpan.FromMilliseconds(2200),
                    EasingFunctions.Circle);

            positionX.Completed += positionX_Completed;

            text.FindComponent <AnimationUI>()
            .BeginAnimation(
                Transform2D.OpacityProperty,
                new SingleAnimation(0, 0.4f, TimeSpan.FromMilliseconds(400)))
            .BeginAnimation(
                Transform2D.XProperty,
                positionX)
            .BeginAnimation(
                Transform2D.YProperty,
                new SingleAnimation(
                    800,
                    300,
                    TimeSpan.FromMilliseconds(2200),
                    EasingFunctions.Circle));
        }
Example #41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashEffect" /> class.
        /// </summary>
        public CrashEffect()
        {
            this.entity = new Entity()
                          .AddComponent(new Transform2D()
            {
                X       = WaveServices.ViewportManager.LeftEdge,
                Y       = WaveServices.ViewportManager.TopEdge,
                XScale  = 1 / WaveServices.ViewportManager.RatioX,
                YScale  = 1 / WaveServices.ViewportManager.RatioY,
                Opacity = 0
            })
                          .AddComponent(new ImageControl(
                                            Color.White,
                                            (int)WaveServices.ViewportManager.ScreenWidth,
                                            (int)WaveServices.ViewportManager.ScreenHeight))
                          .AddComponent(new ImageControlRenderer(DefaultLayers.GUI))
                          .AddComponent(new AnimationUI());

            this.fadeOutAnimation = new SingleAnimation(1, 0, TimeSpan.FromMilliseconds(200));
        }
Example #42
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrashEffect" /> class.
        /// </summary>
        public CrashEffect()
        {
            this.entity = new Entity()
                                .AddComponent(new Transform2D()
                                {
                                    X = WaveServices.ViewportManager.LeftEdge,
                                    Y = WaveServices.ViewportManager.TopEdge,
                                    XScale = 1 / WaveServices.ViewportManager.RatioX,
                                    YScale = 1 / WaveServices.ViewportManager.RatioY,
                                    Opacity = 0
                                })
                                .AddComponent(new ImageControl(
                                    Color.White,
                                    (int)WaveServices.ViewportManager.ScreenWidth,
                                    (int)WaveServices.ViewportManager.ScreenHeight))
                                .AddComponent(new ImageControlRenderer(DefaultLayers.GUI))
                                .AddComponent(new AnimationUI());

            this.fadeOutAnimation = new SingleAnimation(1, 0, TimeSpan.FromMilliseconds(200));
        }
        private void RefreshAnimations()
        {
            if(this.fadeIn != null)
            {
                this.fadeIn.Completed -= this.FadeIn_Completed;
            }

            if (this.fadeOut != null)
            {
                this.fadeOut.Completed -= this.FadeOut_Completed;
            }

            Duration duration = TimeSpan.FromSeconds(this.Speed);
            this.fadeIn = new SingleAnimation(0, 1, duration);
            this.fadeOut = new SingleAnimation(1, 0, duration);

            this.fadeIn.Completed += this.FadeIn_Completed;
            this.fadeOut.Completed += this.FadeOut_Completed;

            this.animationUI.BeginAnimation(Transform2D.OpacityProperty, this.fadeIn);
        }
Example #44
0
        protected override void Update(TimeSpan gamTime)
        {
            // Touch
            var touch = this.Owner.FindComponent <TouchGestures>();

            touch.TouchPressed += (s, o) =>
            {
                this.currentState = AnimState.Die;
            };

            if (this.Owner.FindComponent <Transform2D> ().Y >= 1280)
            {
                this.currentState = AnimState.Destroy;
            }

            if (currentState == AnimState.Die)
            {
                // display the die sprite
                anim2D.CurrentAnimation = "Die";
                trans2D.Effect          = SpriteEffects.FontSprite;
                anim2D.Play();
                this.Owner.RemoveComponent <AnimationUI> ();
                // play animation blur
                var dieing = new SingleAnimation(1f, 0f, 0.8f, EasingFunctions.Cubic);
                this.Owner.AddComponent(new AnimationUI());
                animUI = this.Owner.FindComponent <AnimationUI>();
                animUI.BeginAnimation(Transform2D.OpacityProperty, dieing);
                currentState = AnimState.BeforeDesTroy;
            }

            if (currentState == AnimState.BeforeDesTroy && this.trans2D.Opacity == 0)
            {
                currentState = AnimState.Destroy;
            }

            if (currentState == AnimState.Destroy)
            {
                this.EntityManager.Remove(this.Owner);
            }
        }
Example #45
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.ClearFlags = ClearFlags.DepthAndStencil;
            EntityManager.Add(camera2d);            

            // Music Player
            MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3");
            WaveServices.MusicPlayer.Play(musicInfo);
            WaveServices.MusicPlayer.IsRepeat = true;

            WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3"));
            WaveServices.MusicPlayer.IsDolbyEnabled = true;
            WaveServices.MusicPlayer.DolbyProfile = DolbyProfiles.GAME;

            // Button Stack Panel
            buttonPanel = new StackPanel();
            buttonPanel.Entity.AddComponent(new AnimationUI());
            buttonPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center;
            buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            // Enable/Disable Dolby Button
            this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick);
            buttonPanel.Add(this.enableDolbyButton);

            // Profile Buttons
            this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick);
            buttonPanel.Add(this.profileGameButton);
            this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick);
            buttonPanel.Add(this.profileMovieButton);
            this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick);
            buttonPanel.Add(this.profileMusicButton);
            this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick);
            buttonPanel.Add(this.profileVoiceButton);
            EntityManager.Add(buttonPanel);

            // Information Text
            infoPanel = new StackPanel();
            infoPanel.Entity.AddComponent(new AnimationUI());
            infoPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom;
            infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            infoPanel.Orientation = Orientation.Vertical;
            this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty);
            infoPanel.Add(this.isDolbyEnabledTextBox);
            this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty);
            infoPanel.Add(this.selectedDolbyProfileTextBox);
            EntityManager.Add(infoPanel);

            // Sets text
            this.SetDolbyText();

            //// Animations
            this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic);
        }
Example #46
0
        private void StartAnimation()
        {
            TimeSpan animationTime = TimeSpan.FromMilliseconds(600);

            background.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.OpacityProperty,
                        new SingleAnimation(0f, 1f, TimeSpan.FromMilliseconds(2000)));

            tower.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.XScaleProperty,
                        new SingleAnimation(1f, 1.2f, TimeSpan.FromMilliseconds(2000), EasingFunctions.Cubic))
                    .BeginAnimation(
                        Transform2D.YScaleProperty,
                        new SingleAnimation(1f, 1.2f, TimeSpan.FromMilliseconds(2000), EasingFunctions.Cubic))
                    .BeginAnimation(
                        Transform2D.XProperty,
                        new SingleAnimation(-400, 0, TimeSpan.FromSeconds(2), EasingFunctions.Cubic));

            SingleAnimation positionX =
                new SingleAnimation(
                    -325,
                    300,
                    TimeSpan.FromMilliseconds(2200),
                    EasingFunctions.Circle);

            positionX.Completed += positionX_Completed;

            text.FindComponent<AnimationUI>()
                    .BeginAnimation(
                        Transform2D.OpacityProperty,
                        new SingleAnimation(0, 0.4f, TimeSpan.FromMilliseconds(400)))
                    .BeginAnimation(
                        Transform2D.XProperty,
                        positionX)
                    .BeginAnimation(
                        Transform2D.YProperty,
                        new SingleAnimation(
                                800,
                                300,
                                TimeSpan.FromMilliseconds(2200),
                                EasingFunctions.Circle));
        }
Example #47
0
        public JellyFish(JellyFishType type, Vector2 position, bool rightAnimation = true)
        {
            this.entity = new Entity()
                               .AddComponent(new Transform2D()
                               {
                                   Origin = Vector2.Center,
                                   X = position.X,
                                   Y = position.Y,
                                   DrawOrder = 0.3f,
                               })                               
                               .AddComponent(new AnimationUI());

            // Cached
            this.animation = this.entity.FindComponent<AnimationUI>();


            string textureName, colliderName;
            switch (type)
            {
                case JellyFishType.Big:
                    textureName = "jellyFishSpriteSheet";     
                    colliderName = "jellyFishCollider.wpk";
                    break;
                case JellyFishType.Little:
                    textureName = "jellyFishLittleSpriteSheet";
                    colliderName = "jellyFishLittleCollider.wpk";
                    break;
                default:
                    textureName = "jellyFishSpriteSheet";
                    colliderName = "jellyFishCollider.wpk";
                    break;
            }

            this.entity.AddComponent(new PerPixelCollider(Directories.TexturePath + colliderName, 0.5f) { IsGlobalAsset = true});
            this.entity.AddComponent(new Sprite(Directories.TexturePath + string.Format("{0}.wpk", textureName)) { IsGlobalAsset = true});
            this.entity.AddComponent(Animation2D.Create<TexturePackerGenericXml>(Directories.TexturePath + string.Format("{0}.xml", textureName))
                                                       .Add("swim", new SpriteSheetAnimationSequence() { First = 1, Length = 40, FramesPerSecond = 30 }));
            this.entity.AddComponent(new AnimatedSpriteRenderer(DefaultLayers.Alpha));

            this.entity.FindComponent<Animation2D>().Play(true);


            // Animations
            float offset = 80;
            this.leftAnim = new SingleAnimation(position.X + offset, position.X, TimeSpan.FromSeconds(3));
            this.leftAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            };
            this.rightAnim = new SingleAnimation(position.X, position.X + offset, TimeSpan.FromSeconds(3));
            this.rightAnim.Completed += (s, o) =>
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            };

            if (rightAnimation)
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.rightAnim);
            }
            else
            {
                this.animation.BeginAnimation(Transform2D.XProperty, this.leftAnim);
            }

            this.Collider = this.entity.FindComponent<Collider2D>(false);
        }
Example #48
0
 public CrimsonFulgur(Unit owner, AbilityContent abilityContent)
     : base(owner, abilityContent)
 {
     sa = new SingleAnimation(abilityContent.AbilityTexture, 1);
 }
Example #49
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.ClearFlags = ClearFlags.DepthAndStencil;
            EntityManager.Add(camera2d);
            
            Entity logo = new Entity()
            .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 300, Origin = new Vector2(0.5f, 0), DrawOrder = 0.1f })
            .AddComponent(new Sprite("Content/GameOver.wpk"))
            .AddComponent(new AnimationUI())
            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            this.gameStorage = Catalog.GetItem<GameStorage>();

            this.EntityManager.Add(logo);

            this.labelAnimation = logo.FindComponent<AnimationUI>();

            this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, TimeSpan.FromSeconds(1), EasingFunctions.Cubic);

            var button = new Button()
            {
                Margin = new Thickness(0, 657, 0, 0),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Text = string.Empty,
                IsBorder = false,
                BackgroundImage = "Content/restart.wpk",
                PressedBackgroundImage = "Content/restart.wpk"

            };

            button.Click += (o, e) =>
            {
                GamePlayScene scene = WaveServices.ScreenContextManager.FindContextByName("GamePlayContext").FindScene<GamePlayScene>();

                scene.State = Behaviors.GameState.Game;

                scene.Reset();

                WaveServices.ScreenContextManager.Pop(new CrossFadeTransition(TimeSpan.FromSeconds(0.5f)));
            };

            button.Entity.AddComponent(new AnimationUI());
            this.playAnimation = button.Entity.FindComponent<AnimationUI>();

            this.EntityManager.Add(button);

            var stackPanel = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Bottom,
                Orientation = Orientation.Horizontal,
                Margin = new Thickness(0, 0, (WaveServices.ViewportManager.VirtualWidth - WaveServices.ViewportManager.RightEdge), 20)// (WaveServices.ViewportManager.VirtualWidth - WaveServices.ViewportManager.RightEdge), 20)
            };

            var bestScoreLabel = new Image("Content/BestScore.wpk")
            {
                VerticalAlignment = VerticalAlignment.Center
            };

            stackPanel.Add(bestScoreLabel);

            var bestScoreText = new TextBlock()
            {
                Text = this.gameStorage.BestScore.ToString(),
                FontPath = "Content/Space Age.wpk",
                VerticalAlignment = VerticalAlignment.Center,
                Margin = new Thickness(5,0,0,10)
            };
            stackPanel.Add(bestScoreText);

            this.EntityManager.Add(stackPanel);
        }
Example #50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Squid" /> class.
        /// </summary>
        /// <param name="positionY">The position Y.</param>
        public Squid(float positionY)
        {
            this.initialPosY = positionY;
            this.gamePlayPosY = WaveServices.ViewportManager.BottomEdge + 50;

            this.entity = new Entity("SquidEntity")
                            .AddComponent(new Transform2D()
                            {
                                Origin = new Vector2(0.5f, 0f),
                                X = WaveServices.ViewportManager.VirtualWidth / 2,
                                Y = this.gamePlayPosY,
                                DrawOrder = 0.3f,
                            })
                            .AddComponent(new AnimationUI())
                            .AddComponent(new SquidBehavior())
                            .AddComponent(new Sprite(Directories.TexturePath + "squidSpriteSheet.wpk"))
                            .AddComponent(Animation2D.Create<TexturePackerGenericXml>(Directories.TexturePath + "squidSpriteSheet.xml")
                                                .Add("swim", new SpriteSheetAnimationSequence() { First = 1, Length = 30, FramesPerSecond = 30 }))
                            .AddComponent(new PerPixelCollider(Directories.TexturePath + "squidCollider.wpk", 0.5f))
                            .AddComponent(new AnimatedSpriteRenderer(DefaultLayers.Alpha));

            // Cached
            this.transform = this.entity.FindComponent<Transform2D>();
            this.animation2D = this.entity.FindComponent<Animation2D>();
            this.direction = -Vector2.UnitY;
            this.animation = this.entity.FindComponent<AnimationUI>();

            // Bubble
            this.entity.AddChild(new Entity("bubblesParticle")
                .AddComponent(new Transform2D()
                {
                    LocalY = 210,
                })
                .AddComponent(ParticleFactory.CreateBubbleParticles())
                .AddComponent(
                    new Material2D(new BasicMaterial2D(Directories.TexturePath + "waterParticle.wpk",
                        DefaultLayers.Additive)))
                .AddComponent(new ParticleSystemRenderer2D("bubblesParticle")));

            // Cached
            this.particleSystem = this.entity.FindChild("bubblesParticle").FindComponent<ParticleSystem2D>();

            // Animations
            this.appearAnim = new SingleAnimation(gamePlayPosY, this.initialPosY, TimeSpan.FromSeconds(1.5f), EasingFunctions.Cubic);            
        }
 /// <summary>
 /// Creates the single animation action.
 /// </summary>
 /// <param name="scene">The scene.</param>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animationUI">The animation UI.</param>
 /// <param name="dependencyProperty">The dependency property.</param>
 /// <returns>The action</returns>
 public static IGameAction CreateSingleAnimationGameAction(this Scene scene, SingleAnimation singleAnimation, AnimationUI animationUI, DependencyProperty dependencyProperty)
 {
     return new SingleAnimationGameAction(singleAnimation, animationUI, dependencyProperty, scene);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonBehavior" /> class.
 /// </summary>
 public ButtonBehavior()
     : base("ButtonBehavior")
 {
     this.fadeIn = new SingleAnimation(0.2f, 1, new Duration(TimeSpan.FromSeconds(.4f)));
     this.fadeOut = new SingleAnimation(1, 0.2f, new Duration(TimeSpan.FromSeconds(.4f)));
 }
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.fadeOutAnimation = new SingleAnimation(1, 0, TimeSpan.FromMilliseconds(200));
        }
Example #54
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.BackgroundColor = Color.White;
            EntityManager.Add(camera2d);

            // Sonic
            Button spankerButton = new Button()
            {
                Width = 226,
                Height = 226,
                Text = string.Empty,
                Margin = new Thickness(40, 500, 0, 0),
                BackgroundImage = "Content/spanker.wpk",
                PressedBackgroundImage = "Content/spankerPressed.wpk",
            };
            spankerButton.Entity.AddComponent(new AnimationUI());
            this.spankerAnimation = spankerButton.Entity.FindComponent<AnimationUI>();
            spankerButton.Click += (s, o) =>
            {
                WaveServices.GetService<AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Spanker");
            };
            EntityManager.Add(spankerButton);

            // Link
            Button colonelButton = new Button()
            {
                Width = 226,
                Height = 226,
                Text = string.Empty,
                Margin = new Thickness(288, 500, 0, 0),
                BackgroundImage = "Content/colonel.wpk",
                PressedBackgroundImage = "Content/colonelPressed.wpk",
            };
            colonelButton.Entity.AddComponent(new AnimationUI());
            this.colonelAnimation = colonelButton.Entity.FindComponent<AnimationUI>();
            colonelButton.Click += (s, o) =>
            {
                WaveServices.GetService<AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Colonel");
            };
            EntityManager.Add(colonelButton);

            // Mario
            Button fuzzButton = new Button()
            {
                Width = 226,
                Height = 226,
                Text = string.Empty,
                Margin = new Thickness(536, 500, 0, 0),
                BackgroundImage = "Content/fuzz.wpk",
                PressedBackgroundImage = "Content/fuzzPressed.wpk",
            };
            fuzzButton.Entity.AddComponent(new AnimationUI());
            this.fuzzAnimation = fuzzButton.Entity.FindComponent<AnimationUI>();
            fuzzButton.Click += (s, o) =>
            {
                WaveServices.GetService<AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Fuzz");
            };
            EntityManager.Add(fuzzButton);

            this.showSpanker = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
            this.showColonel = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
            this.showFuzz = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
        }
 /// <summary>
 /// And play a single animation action.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="singleAnimation">The single animation.</param>
 /// <param name="animationUI">The animation UI.</param>
 /// <param name="dependencyProperty">The dependency property.</param>
 /// <returns>The action</returns>
 public static IGameAction AndPlaySingleAnimation(this IGameAction parent, SingleAnimation singleAnimation, AnimationUI animationUI, DependencyProperty dependencyProperty)
 {
     return new SingleAnimationGameAction(parent, singleAnimation, animationUI, dependencyProperty);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ToggleSwitchBehavior" /> class.
        /// </summary>
        public ToggleSwitchBehavior()
            : base("ToggleSwitchBehavior")
        {
            this.on = false;
            this.onText = "On";
            this.offText = "Off";

            Duration duration = new Duration(TimeSpan.FromSeconds(.4f));
            this.animOn = new SingleAnimation(0, DefaultOffset, duration);
            this.animOff = new SingleAnimation(DefaultOffset, 0, duration);
        }
Example #57
0
        /// <summary>
        /// Sets default values for this instance.
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.uppercase = false;
            this.altcase = false;
            this.acceptsReturn = false;
            this.isReadOnly = false;

            this.flicker = new SingleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.4f)));
            this.textBeforeCursor = string.Empty;
            this.textAfterCursor = string.Empty;
        }
        /// <summary>
        /// Updates the value.
        /// </summary>
        /// <param name="value">The value.</param>
        private void UpdateValue(int value)
        {
            if (this.value != value)
            {
                int oldValue = this.value;
                this.value = value;

                // Event
                if (this.ValueChanged != null)
                {
                    this.ValueChanged(this, new ChangedEventArgs(oldValue, value));
                }

                // Update
                if (this.animation != null)
                {
                    // UpdateUI with animation
                    float convertionValue = this.Panel.Width * (value - this.minimum) / this.difference;
                    this.move = new SingleAnimation(this.foregroundTransform.XScale, convertionValue, this.duration);
                    this.animation.BeginAnimation(Transform2D.XScaleProperty, this.move);
                }
                else if (this.foregroundTransform != null)
                {
                    // UpdateUI without animation
                    this.foregroundTransform.XScale = this.Panel.Width * (value - this.minimum) / this.difference;
                }
            }
        }
Example #59
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextBoxBehavior" /> class.
        /// </summary>
        public TextBoxBehavior()
            : base("TextBoxBehavior")
        {
            this.uppercase = false;
            this.altcase = false;
            this.acceptsReturn = false;
            this.isReadOnly = false;

            this.flicker = new SingleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.4f)));
            this.textBeforeCursor = string.Empty;
            this.textAfterCursor = string.Empty;
        }
Example #60
0
        /// <summary>
        /// Performs further custom initialization for this instance.
        /// </summary>
        /// <remarks>
        /// By default this method does nothing.
        /// </remarks>
        protected override void Initialize()
        {
            base.Initialize();

            // Start accelerometer if it is avaible
            if (this.inputManager.AccelerometerState.IsConnected)
            {
                this.inputManager.StartAccelerometer();
            }

            // Animations
            float gamePlayPosY = this.transform2D.Y;
            float initialPosY = gamePlayPosY + 400;
            this.appearAnim = new SingleAnimation(initialPosY, gamePlayPosY, TimeSpan.FromSeconds(1.5f), EasingFunctions.Cubic);

            this.virtualScreenManager = this.Owner.Scene.VirtualScreenManager;
        }