Example #1
0
        partial void UpdateProjSpecific(float deltaTime, Camera cam)
        {
            if (info != null || Vitality < MaxVitality * 0.98f)
            {
                hudInfoTimer -= deltaTime;
                if (hudInfoTimer <= 0.0f)
                {
                    if (controlled == null)
                    {
                        hudInfoVisible = true;
                    }

                    //if the character is not in the camera view, the name can't be visible and we can avoid the expensive visibility checks
                    else if (WorldPosition.X < cam.WorldView.X || WorldPosition.X > cam.WorldView.Right ||
                             WorldPosition.Y > cam.WorldView.Y || WorldPosition.Y < cam.WorldView.Y - cam.WorldView.Height)
                    {
                        hudInfoVisible = false;
                    }
                    else
                    {
                        //Ideally it shouldn't send the character entirely if we can't see them but /shrug, this isn't the most hacker-proof game atm
                        hudInfoVisible = controlled.CanSeeCharacter(this, controlled.ViewTarget == null ? controlled.WorldPosition : controlled.ViewTarget.WorldPosition);
                    }
                    hudInfoTimer = Rand.Range(0.5f, 1.0f);
                }
            }

            if (controlled == this)
            {
                CharacterHealth.UpdateHUD(deltaTime);
            }
        }
Example #2
0
        partial void UpdateProjSpecific(float deltaTime, Camera cam)
        {
            if (!IsDead && !IsUnconscious)
            {
                if (soundTimer > 0)
                {
                    soundTimer -= deltaTime;
                }
                else if (AIController != null)
                {
                    switch (AIController.State)
                    {
                    case AIController.AIState.Attack:
                        PlaySound(CharacterSound.SoundType.Attack);
                        break;

                    default:
                        PlaySound(CharacterSound.SoundType.Idle);
                        break;
                    }
                }
            }

            if (info != null || Vitality < MaxVitality * 0.98f)
            {
                hudInfoTimer -= deltaTime;
                if (hudInfoTimer <= 0.0f)
                {
                    if (controlled == null)
                    {
                        hudInfoVisible = true;
                    }

                    //if the character is not in the camera view, the name can't be visible and we can avoid the expensive visibility checks
                    else if (WorldPosition.X < cam.WorldView.X || WorldPosition.X > cam.WorldView.Right ||
                             WorldPosition.Y > cam.WorldView.Y || WorldPosition.Y < cam.WorldView.Y - cam.WorldView.Height)
                    {
                        hudInfoVisible = false;
                    }
                    else
                    {
                        //Ideally it shouldn't send the character entirely if we can't see them but /shrug, this isn't the most hacker-proof game atm
                        hudInfoVisible = controlled.CanSeeCharacter(this, controlled.ViewTarget == null ? controlled.WorldPosition : controlled.ViewTarget.WorldPosition);
                    }
                    hudInfoTimer = Rand.Range(0.5f, 1.0f);
                }
            }

            if (controlled == this)
            {
                CharacterHealth.UpdateHUD(deltaTime);
            }
        }