Exemple #1
0
        private void RenderStatusInfo(IList <BattleEntity> allEntities)
        {
            //Ignore if we shouldn't show this UI
            if (battleManager.ShouldShowPlayerTurnUI() == true && UtilityGlobals.IListIsNullOrEmpty(allEntities) == false)
            {
                List <StatusEffect> statuses = (allEntities.Count == 0) ? null : new List <StatusEffect>();

                for (int i = 0; i < allEntities.Count; i++)
                {
                    BattleEntity entity = allEntities[i];

                    Vector2 statusIconPos = new Vector2(entity.Position.X + 10, entity.Position.Y - 40);
                    entity.EntityProperties.GetStatuses(statuses);
                    int index = 0;

                    for (int j = 0; j < statuses.Count; j++)
                    {
                        StatusEffect     status  = statuses[j];
                        CroppedTexture2D texture = status.StatusIcon;

                        //Don't draw the status if it doesn't have an icon or if it's Icon suppressed
                        if (texture == null || texture.Tex == null || status.IsSuppressed(Enumerations.StatusSuppressionTypes.Icon) == true)
                        {
                            continue;
                        }

                        float   yOffset = ((index + 1) * StatusGlobals.IconYOffset);
                        Vector2 iconPos = Camera.Instance.SpriteToUIPos(new Vector2(statusIconPos.X, statusIconPos.Y - yOffset));

                        float depth           = .35f - (index * .01f);
                        float turnStringDepth = depth + .0001f;

                        status.DrawStatusInfo(iconPos, depth, turnStringDepth);

                        index++;
                    }

                    statuses.Clear();
                }
            }
        }
        public virtual void Draw()
        {
            AnimManager.CurrentAnim?.Draw(Position, TintColor, EntityType != EntityTypes.Enemy, .1f);
            PreviousAction?.Draw();

            //Draw Status Effect icons on the BattleEntity
            //You can't see the icons unless it's Mario or his Partner's turn and they're not in a Sequence
            if (BattleManager.Instance.ShouldShowPlayerTurnUI == true)
            {
                Vector2        statusIconPos = new Vector2(Position.X + 10, Position.Y - 40);
                StatusEffect[] statuses      = EntityProperties.GetStatuses();
                int            index         = 0;

                for (int i = 0; i < statuses.Length; i++)
                {
                    StatusEffect     status  = statuses[i];
                    CroppedTexture2D texture = status.StatusIcon;

                    //Don't draw the status if it doesn't have an icon
                    if (texture == null || texture.Tex == null)
                    {
                        continue;
                    }

                    float   yOffset = ((index + 1) * StatusGlobals.IconYOffset);
                    Vector2 iconPos = Camera.Instance.SpriteToUIPos(new Vector2(statusIconPos.X, statusIconPos.Y - yOffset));

                    float depth           = .35f - (index * .01f);
                    float turnStringDepth = depth + .0001f;

                    status.DrawStatusInfo(iconPos, depth, turnStringDepth);

                    index++;
                }
            }
        }