Exemple #1
0
        // Take Damage
        public override void TakeDamage(DamageInfo damageInfo)
        {
            HudElements.HealthBar.SetDamageTargetPosition(damageInfo.source.position);

            int   finalDamage = CalcDamage(damageInfo.damage);
            float shakeRange  = finalDamage / 10f;

            if (finalDamage < damageToPain && HealthInPercent > percentToPain)
            {
                switch (damageInfo.type)
                {
                case EDamageType.Impact:
                case EDamageType.Melee:
                    PlayerCamera.ShakeOneShot(Random.Range(shakeRange, shakeRange * 1.65f));
                    HudElements.ShowPainScreen();
                    break;

                default:
                    break;
                }
            }
            else
            {
                PlayerCamera.ShakeOneShot(Random.Range(shakeRange, shakeRange * 1.65f));
                HudElements.ShowPainScreen();
            }

            DecrementHealth(finalDamage);
        }
Exemple #2
0
        // OnDie
        protected override void OnDie()
        {
            base.OnDie();
            //
            this.enabled = false;
            PlayerCamera.PlayerDie();
            HudElements.PlayerDie();
            FirstPersonController.PlayerDie();

            FirstPersonWeaponSway[] tmpFPWeapSways = this.GetComponentsInChildren <FirstPersonWeaponSway>();
            foreach (FirstPersonWeaponSway fpWSway in tmpFPWeapSways)
            {
                fpWSway.enabled = false;
            }

            GameObject bAnimGO = this.GetComponentInChildren <BodyAnimation>().gameObject;

            if (bAnimGO != null)
            {
                bAnimGO.SetActive(false);
            }

            // Show menu after die.
            ASKInputManager.PlayerDie();
        }
Exemple #3
0
 // Awake
 internal void AwakeHUD()
 {
     m_Instance = this;
     cameraObj  = this.GetComponentInChildren <Camera>().gameObject;
     //
     healthBar.Awake();
     crosshair.Awake();
     weaponInformer.Awake();
     //
     nativePosition = rotationElements.localPosition;
     nativeRotation = rotationElements.localEulerAngles;
     //
     SetActive(GameSettings.ShowHud);
 }
Exemple #4
0
        // Take Damage
        public virtual void TakeDamage(DamageInfo damageInfo)
        {
            if (GameSettings.DamageIndication == EDamageIndication.ForAll)
            {
                if (damageInfo.owner.isPlayer)
                {
                    HudElements.ShowDamegeIndicator();
                }
            }
            else if (GameSettings.DamageIndication == EDamageIndication.OnlyCharacters)
            {
                if (damageInfo.owner.isPlayer && isNPC)
                {
                    HudElements.ShowDamegeIndicator();
                }
            }

            lastDamage = damageInfo;
        }
Exemple #5
0
        // Pause
        public static void Pause()
        {
            if (!PlayerCharacter.Instance.isAlive)
            {
                return;
            }

            gameIsPaused   = !gameIsPaused;
            Time.timeScale = gameIsPaused ? 0f : 1f;
            MenuElements.SetActive(gameIsPaused);
            //
            if (GameSettings.ShowHud)
            {
                HudElements.SetActive(!gameIsPaused);
            }

#if TOUCH_CONTROLS_KIT
            TCKInput.SetActive(!gameIsPaused);
#endif
        }
Exemple #6
0
 // OnDisable
 protected override void OnDisable()
 {
     base.OnDisable();
     HudElements.SetActive(false);
 }
Exemple #7
0
 // OnEnable
 protected override void OnEnable()
 {
     base.OnEnable();
     HudElements.SetActive(GameSettings.ShowHud);
 }