Пример #1
0
 void Update()
 {
     if (!m_PlayerHealth)
     {
         m_PlayerHealth = myPlayerCharacter.GetComponent <Health>();
     }
     // update health bar value
     healthFillImage.fillAmount = m_PlayerHealth.currentHealth / m_PlayerHealth.maxHealth;
 }
Пример #2
0
 void Update()
 {
     if (Input.GetKeyDown(activateKey))
     {
         m_IS_PlayerCharacterController.transform.SetPositionAndRotation(transform.position, transform.rotation);
         Health playerHealth = m_IS_PlayerCharacterController.GetComponent <Health>();
         if (playerHealth)
         {
             playerHealth.Heal(999);
         }
     }
 }
Пример #3
0
    void OnPicked(IS_PlayerCharacterController player)
    {
        Health playerHealth = player.GetComponent <Health>();

        if (playerHealth && playerHealth.canPickup())
        {
            playerHealth.Heal(healAmount);

            m_Pickup.PlayPickupFeedback();

            Destroy(gameObject);
        }
    }
Пример #4
0
    void Start()
    {
        // Subscribe to player damage events
        // myPlayerCharacter = GetComponentInParent<IS_PlayerCharacterController>();
        // DebugUtility.HandleErrorIfNullFindObject<IS_PlayerCharacterController, FeedbackFlashHUD>(myPlayerCharacter, this);

        m_PlayerHealth = myPlayerCharacter.GetComponent <Health>();
        DebugUtility.HandleErrorIfNullGetComponent <Health, FeedbackFlashHUD>(m_PlayerHealth, this, myPlayerCharacter.gameObject);

        m_GameFlowManager = FindObjectOfType <GameFlowManager>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, FeedbackFlashHUD>(m_GameFlowManager, this);

        m_PlayerHealth.onDamaged += OnTakeDamage;
        m_PlayerHealth.onHealed  += OnHealed;
    }
Пример #5
0
    void OnPicked(IS_PlayerCharacterController byPlayer)
    {
        var jetpack = byPlayer.GetComponent <Jetpack>();

        if (!jetpack)
        {
            return;
        }

        if (jetpack.TryUnlock())
        {
            m_Pickup.PlayPickupFeedback();

            Destroy(gameObject);
        }
    }
Пример #6
0
    void OnPicked(IS_PlayerCharacterController byPlayer)
    {
        IS_PlayerWeaponsManager IS_PlayerWeaponsManager = byPlayer.GetComponent <IS_PlayerWeaponsManager>();

        if (IS_PlayerWeaponsManager)
        {
            if (IS_PlayerWeaponsManager.AddWeapon(weaponPrefab))
            {
                // Handle auto-switching to weapon if no weapons currently
                if (IS_PlayerWeaponsManager.GetActiveWeapon() == null)
                {
                    IS_PlayerWeaponsManager.SwitchWeapon(true);
                }

                m_Pickup.PlayPickupFeedback();

                Destroy(gameObject);
            }
        }
    }