Example #1
0
        public void Palauta(float kesto = Kamerointi.NOPEA)
        {
            var X = Game.Camera.X + LaskeHiirenOffset();

            Tweetteri.Tween <Camera>(Game.Camera, new { ZoomFactor = 1, Y = 0, X = X }, kesto).Ease(Ease.QuadOut)
            .OnComplete(() => Seuraahiirtä = true);
        }
Example #2
0
        public void SyöMinut(Sieni sieni, Öggiäinen poimija)
        {
            if (Käytetty)
            {
                return;
            }
            Käytetty = true;

            Velocity = Vector.Zero;
            Stop();

            //taulu.PreferredSize = new Vector(100, 100);
            Debug.WriteLine("Sieni syöty");
            Tweetteri.Tween(poimija, new {
                Width  = poimija.Width * 2,
                Height = poimija.Height * 2,
                Y      = poimija.Y + poimija.Height / 2
            }, 1.5f, 0, false).Ease(Ease.BounceIn);

            Morte.Instance.Kantama = Morte.Instance.Kantama * 2;

            IgnoresPhysicsLogics     = true;
            IgnoresCollisionResponse = true;

            Tweetteri.Tween(this, new { Width = 1, Height = 1 }, 1.51f, 0, false).Ease(Ease.QuadOut).OnComplete(() => Destroy());
        }
Example #3
0
        public override void KuolinAnimaatio()
        {
            var _Y = Game.Screen.Top + Height;
            var _X = X + RandomGen.NextDouble(-40, 40);

            Tweetteri.Tween(this, new { Y = Game.Level.Bottom - Height / 2, Vaaleus = 1.0 }, KuolemanKesto)
            .Ease(Ease.QuadIn).OnComplete(ReallyKuole);
        }
Example #4
0
        protected void Juo()
        {
            if (Käytetty || Parent == null)
            {
                return;
            }
            Käytetty = true;

            var impulssi = new Vector(RandomGen.NextDouble(20, 50) * Poimija.Suunta, RandomGen.NextDouble(20, 50));

            Tweetteri.Tween(this, new {
                X = SUU_X * Poimija.Suunta,
                Y = SUU_Y
            },
                            0.4f).OnComplete(delegate() {
                // Anglea ei voi tweenata
                Angle = Angle.FromDegrees(127 * Poimija.Suunta);
                Game.LoadSoundEffect(AssetsPath + "sound").Play();
            });


            // Heitä pullo veks.
            Timer.SingleShot(1.4, () => {
                Mass = 0.2;
                this.Hit(impulssi);
                AngularVelocity = 1 * Poimija.Suunta;
            });

            // Hahmo "kuolee"
            Timer.SingleShot(2, () =>
            {
                Poimija.AngularVelocity      = RandomGen.NextDouble(-0.7, 0.7);
                Poimija.IgnoresPhysicsLogics = true;
                //Poimija.IgnoresCollisionResponse = true;

                Morte.Instance.Kamera.Kohdista(new Vector(Poimija.X, Morte.Instance.Level.Bottom), RESPAWN_KESTO / 1.2f);

                var hautakivi = new Hautakivi();
                hautakivi.X   = Poimija.AbsolutePosition.X;
                Game.Add(hautakivi, Morte.TASO_PAPPI);

                hautakivi.Nouse();

                Tweetteri.Tween(Poimija, new { Y = Game.Level.Bottom - Poimija.Height / 2, X = Poimija.X }, RESPAWN_KESTO).Ease(Ease.QuadIn).OnComplete(delegate() {
                    Poimija.X = RandomGen.NextDouble(Game.Level.Left - Poimija.Left, Game.Level.Right - Poimija.Right);
                    Debug.WriteLine("Pappi sijainnissa " + Poimija.X);
                    Morte.Instance.ResetoiPelaaja();
                    Morte.Instance.Kamera.Palauta();

                    Poimija.Shape = Shape.Circle;
                });
            });
        }
Example #5
0
        public void Nouse()
        {
            IsUpdated = true;
            Debug.WriteLine("Hautakivi nousee " + X + "," + Y);
            var _Width  = Width;
            var _Height = Height;

            Width  = Width * 0.8;
            Height = Height * 0.8;

            //Image.DrawTextOnImage(Image, string.Format("Manasi {0}", Morte.Instance.Manattu), Font.DefaultSmall, TekstinVäri);

            Tweetteri.Tween(this, new { Y = Game.Level.Bottom + _Height / 2, Width = _Width, Height = _Height }, 0.8f);
        }
Example #6
0
        /// <summary>
        /// Kohdistaa kameran pisteeseen.
        /// </summary>
        /// <param name="kohde"></param>
        /// <param name="kesto"></param>
        /// <param name="zoom"></param>
        public void Kohdista(Vector kohde, float kesto = Kamerointi.NORMA, double zoom = 2)
        {
            Seuraahiirtä = false;

            double kuvan_reuna_w = Game.Screen.Width / 2 / zoom;
            double kuvan_reuna_h = Game.Screen.Height / 2 / zoom;

            double _x = kohde.X;
            double _y = kohde.Y;

            _x = Math.Min(Game.Level.Right - kuvan_reuna_w, _x);
            _x = Math.Max(Game.Level.Left + kuvan_reuna_w, _x);

            _y = Math.Min(Game.Level.Top - kuvan_reuna_h, _y);
            _y = Math.Max(Game.Level.Bottom + kuvan_reuna_h, _y);

            Tweetteri.Tween(Game.Camera, new { X = _x, Y = _y, ZoomFactor = zoom }, kesto).Ease(Ease.QuadIn);
        }
Example #7
0
        public override void VahingoitaSankaria(Öggiäinen sankari)
        {
            base.VahingoitaSankaria(sankari);

            if (!Kuollut && !Napattu)
            {
                Debug.WriteLine("Koura sai napattua sankarin");

                Tweetteri.Cancel();
                Tweetteri.Update(0.0f);

                Image = Spritet[1];

                TarraaPelaajaan();

                // Paljasta pintaa.
                if (Y < Game.Level.Bottom)
                {
                    Y = Game.Level.Bottom + Height / 5;
                }
            }
        }
Example #8
0
        public override void HyökiLoop()
        {
            if (Hyökkimässä || Napattu)
            {
                return;
            }
            Hyökkimässä = true;

            X = RandomGen.NextDouble(Game.Level.Left + Width, Game.Level.Right - Width);

            // Aseta ylösnousun animaatio.
            Tweetteri.Tween(this, new { Y = Game.Level.Bottom + Height / 2 }, Hyökkimisen_Kesto).OnComplete(delegate()
            {
                // Esillä, aseta piilotuksen animaation.
                Tweetteri.Tween(this, new { Y = Game.Level.Bottom - Height / 2 }, Hyökkimisen_Kesto * 2).OnComplete(delegate()
                {
                    Hyökkimässä = false;
                });
            });

            base.HyökiLoop();
        }