// Update is called once per frame
 void Update()
 {
     if (Capacity.CanTriggerCapacity() && !m_bIsOnPause)
     {
         BlinkCursor.gameObject.SetActive(false);
         if (Input.GetAxis("Capacity") > 0.9f)
         {
             BlinkCursor.gameObject.SetActive(true);
             m_eBlinkStatus = E_BlinkStatus.POSITIONING;
             UpdateBlinkPosition();
         }
         else
         {
             if (m_eBlinkStatus == E_BlinkStatus.POSITIONING)
             {
                 StartBlink();
                 Capacity.TriggerCapacity();
                 m_eBlinkStatus = E_BlinkStatus.NONE;
             }
         }
     }
     else
     {
         Capacity.UpdateCurrentCompletion(Time.deltaTime);
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        MeleeAttackCapacity.UpdateCurrentCompletion(Time.deltaTime);
        bool bIsHittingLoot = false;

        RaycastHit hit;

        if (Physics.Raycast(PlayerCamera.transform.position, PlayerCamera.transform.TransformDirection(Vector3.forward), out hit, InteractionRange))
        {
            Loot         lootHit      = hit.transform.GetComponent <Loot>();
            Interactible interactible = hit.transform.GetComponent <Interactible>();
            if (lootHit != null)
            {
                CurrentAimedLoot = lootHit;
                bIsHittingLoot   = true;
            }


            SetCurrentInteractible(interactible);
        }
        else
        {
            CurrentAimedLoot = null;
            SetCurrentInteractible(null);
        }

        aimcursor.ChangeCursorStatus(bIsHittingLoot);
        if (m_InteractibleAimed != null && !bIsHittingLoot)
        {
            aimcursor.ChangeCursorStatus(m_InteractibleAimed.CanBeTriggeredByPlayer(this));
        }

        if (m_fInteractionTimer < 0)
        {
            if (!m_bOnPause)
            {
                if (Input.GetAxis("Interact") > 0.8f && CurrentAimedLoot != null && CurrentAimedLoot.isActiveAndEnabled)
                {
                    LootObject(CurrentAimedLoot);
                    m_fInteractionTimer = InteractionCoolDown;
                }


                if (Input.GetAxis("Interact") > 0.8f && m_InteractibleAimed != null && m_InteractibleAimed.CanBeTriggeredByPlayer(this))
                {
                    m_InteractibleAimed.LaunchInteraction(this);
                    m_fInteractionTimer = InteractionCoolDown;
                }
            }
        }
        else
        {
            m_fInteractionTimer -= Time.deltaTime;
        }

        if (!m_bOnPause)
        {
            if (Input.GetAxis("MeleeAttack") > 0.9f && MeleeAttackCapacity.CanTriggerCapacity())
            {
                m_WeaponController.StartMeleeAttack();
                MeleeAttackCapacity.TriggerCapacity();
            }
        }
    }