protected override void OnDraw()
        {
            //The cursor is drawn on top of the entity being targeted
            //Only 1/4 of the full cursor is stored as a texture, so we can just draw 3 more versions flipped differently

            string text  = "NO!";
            Color  color = Color.Red;

            if (WithinRange == true)
            {
                text  = "OKAY!";
                color = Color.Green;
            }

            SpriteRenderer.Instance.DrawText(AssetManager.Instance.TTYDFont, text, new Vector2(300, 100), color, .7f);

            //Handle rotation
            float rotation = -ElapsedTime *UtilityGlobals.ToRadians(.1f);

            DrawBigCursor(rotation);
            DrawSmallCursor(rotation);

            //Show success rectangle (comment out if not debugging)
            //Texture2D DebugBoxTex = AssetManager.Instance.LoadAsset<Texture2D>($"{ContentGlobals.UIRoot}/Box");
            //SpriteRenderer.Instance.Draw(DebugBoxTex, new Vector2(SuccessRect.X, SuccessRect.Y), null, Color.Red, 0f, Vector2.Zero,
            //    new Vector2(SuccessRect.Width, SuccessRect.Height), false, false, .21f, true);
        }
        public override void Update()
        {
            if (ActionCmd?.AcceptingInput == false)
            {
                return;
            }

            //Initialize if not initialized
            if (Initialized == false)
            {
                Initialize();
                Initialized = true;
            }

            if (MarioHPRestoredVal != ActionCmd.HealingResponse.MarioHPRestored)
            {
                MarioHPRestoredVal = ActionCmd.HealingResponse.MarioHPRestored;
                MarioHPText.Text   = MarioHPRestoredVal.ToString();
            }

            if (PartnerHPText != null && PartnerHPRestoredVal != ActionCmd.HealingResponse.PartnerHPRestored)
            {
                PartnerHPRestoredVal = ActionCmd.HealingResponse.PartnerHPRestored;
                PartnerHPText.Text   = PartnerHPRestoredVal.ToString();
            }

            if (FPRestoredVal != ActionCmd.HealingResponse.FPRestored)
            {
                FPRestoredVal = ActionCmd.HealingResponse.FPRestored;
                FPText.Text   = FPRestoredVal.ToString();
            }

            Cursor.Position = UtilityGlobals.GetPointAroundCircle(new Circle(ActionCmd.StartPosition, ActionCmd.CircleRadius), ActionCmd.CursorAngle, true);
            Cursor.Rotation = (float)(-ActionCmd.ElapsedTime * UtilityGlobals.ToRadians(ActionCmd.CursorRotSpeed));
        }
        public override void Update()
        {
            ElapsedTime += Time.ElapsedMilliseconds;

            BigCursor.Rotation   = (float)(-ElapsedTime * UtilityGlobals.ToRadians(.1f));
            BigCursor.Position   = ActionCmd.BigCursorPos;
            SmallCursor.Position = ActionCmd.SmallCursorPos;
        }
Ejemplo n.º 4
0
        protected void CreateStar()
        {
            PrevThrow = Time.ActiveMilliseconds + ThrowCooldown;

            double angleRadians = UtilityGlobals.ToRadians(CursorAngle);

            //Throw the star and send it off with the current velocity
            Vector2 curVelocity = new Vector2(StarThrowVelocity.X * (float)Math.Cos(angleRadians), StarThrowVelocity.Y * (float)Math.Sin(angleRadians));

            SweetTreatThrownStar star = new SweetTreatThrownStar(BUIManager, StartPosition, curVelocity);

            StarsThrown.Add(star);
        }
Ejemplo n.º 5
0
        protected void UpdateCursor()
        {
            CursorAngle = UtilityGlobals.Clamp(CursorAngle + CursorMoveSpeed, MinCursorAngle, MaxCursorAngle);

            //If it reached its limits, reverse the angle
            if (CursorAngle >= MaxCursorAngle || CursorAngle <= MinCursorAngle)
            {
                CursorMoveSpeed = -CursorMoveSpeed;
            }

            Cursor.Position = UtilityGlobals.GetPointAroundCircle(new Circle(StartPosition, CircleRadius), CursorAngle, true);
            Cursor.Rotation = (float)(-ElapsedTime * UtilityGlobals.ToRadians(CursorRotSpeed));
        }
Ejemplo n.º 6
0
        public void Update()
        {
            /* The ProgressTextStar does the following:
             * 1. Rotates back and forth about 25 degrees from 0
             * 2. Scales down and up very slightly when rotating away from and towards 0, respectively
             */

            ElapsedTime += Time.ElapsedMilliseconds;

            //Scale twice as fast, as it should be at max scale with a rotation of 0 and min scale when fully rotated in either direction
            Scale    = Interpolation.Interpolate(MinScale, MaxScale, UtilityGlobals.PingPong((ElapsedTime * 2) / RotateTime, 1), Interpolation.InterpolationTypes.Linear);
            Rotation = UtilityGlobals.ToRadians(Interpolation.Interpolate(MinRotation, MaxRotation, UtilityGlobals.PingPong(ElapsedTime / RotateTime, 1), Interpolation.InterpolationTypes.Linear));
        }
Ejemplo n.º 7
0
        public void Update()
        {
            /* The ProgressTextStar does the following:
             * 1. Rotates back and forth about 30 degrees from 0
             * 2. Scales down and up very slightly when rotating away from and towards 0, respectively
             */

            ElapsedTime += Time.ElapsedMilliseconds;

            Scale = Interpolation.Interpolate(MinScale, MaxScale, UtilityGlobals.PingPong(ElapsedTime * 2, RotateTime) / RotateTime, Interpolation.InterpolationTypes.Linear);

            float minRot = UtilityGlobals.ToRadians(MinRotation);
            float maxRot = UtilityGlobals.ToRadians(MaxRotation);

            Rotation = UtilityGlobals.PingPong(ElapsedTime / RotateTime, minRot, maxRot);
        }
Ejemplo n.º 8
0
        protected override void OnUpdate()
        {
            //This can lead to a softlock if the event is added after the entity is removed from battle
            //The event system needs to be less error-prone
            //Add the in-battle check since the entity won't update its death animation if it's not in battle
            if (DeathAnim == null || Entity.IsInBattle == false)
            {
                End();
                return;
            }

            //Play the death animation if it isn't being played
            if (Entity.AnimManager.CurrentAnim != DeathAnim)
            {
                DeathAnim.Play();
            }

            if (DeathAnim.Finished == true)
            {
                //End after the death animation if we shouldn't perform the rotation
                if (PerformRotation == false)
                {
                    End();
                    return;
                }

                //Perform the rotation
                CurRotation += RotateAmount;

                Entity.Rotation = UtilityGlobals.ToRadians(CurRotation);

                //End after rotating a certain amount
                if (CurRotation >= MaxRotation)
                {
                    //Play death sound if it's an enemy
                    if (Entity.EntityType == Enumerations.EntityTypes.Enemy)
                    {
                        SoundManager.Instance.PlaySound(SoundManager.Sound.EnemyDeath);
                    }

                    End();
                }
            }
        }
        private void ThrowBomb()
        {
            double angleRadians = UtilityGlobals.ToRadians(CursorAngle);

            Vector2 throwVelocity = new Vector2((float)Math.Cos(angleRadians) * BaseThrowVelocity.X, (float)Math.Sin(angleRadians) * BaseThrowVelocity.Y);

            //Debug.Log($"CursorAngle: {angleRadians}, ThrowVelocity: {throwVelocity}, Cos: {Math.Cos(angleRadians)}, Sin: {Math.Sin(angleRadians)}");

            NumBombsThrown++;

            LastBombThrowTime = ElapsedTime + AutomaticThrowTime;
            ThrownCursorTime  = ElapsedTime + ThrownCursorDur;

            //Show a grey cursor indicating this is where the bomb was thrown for 1 second
            CursorThrownPosition   = Cursor.Position;
            ThrownCursor           = Cursor.Copy();
            ThrownCursor.Depth    -= .01f;
            ThrownCursor.TintColor = Color.Gray;

            SendResponse(new ActionCommandGlobals.BombSquadResponse(throwVelocity, ThrowGravity));
        }
        protected override void OnUpdate()
        {
            //Remove protection
            ShellRef.RemoveEntityDefending();

            //Start the animation in a BattleObject
            ShellBreakAnimObj breakAnim = new ShellBreakAnimObj(ShellRef.BManager.battleObjManager, ShellRef.Position, 2000d, (float)UtilityGlobals.ToRadians(25d), 750d);

            ShellRef.BManager.battleObjManager.AddBattleObject(breakAnim);

            End();
        }
Ejemplo n.º 11
0
        protected override void OnUpdate()
        {
            base.OnUpdate();

            Entities[0].Rotation += UtilityGlobals.ToRadians(5f);
        }