コード例 #1
0
    private void Update()
    {
        if (PetInfoPanel.IsOpen)
        {
            return;
        }

        _ray         = _camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        _hoverAiming = Physics.Raycast(_ray, out _hoverHit, ActiveDistance, LayerMask.GetMask("PetPointer"));
        _animator.SetBool("Aiming", _hoverAiming);

        _currentHoverTarget = _hoverAiming ? _hoverHit.transform.gameObject : null;
        if (_hoverAiming)
        {
            _hoverPet = _currentHoverTarget.GetComponentInParent <Pet>();

            if (_hoverPet != null)
            {
                HoveredPetID.SetValue(_hoverPet.ID);
            }
            else
            {
                HoveredPetID.SetValue(0);
            }
        }
        else
        {
            HoveredPetID.SetValue(0);
        }
    }
コード例 #2
0
 private void Start()
 {
     if (ResetHP)
     {
         HP.SetValue(MaxHP);
     }
 }
コード例 #3
0
    public void OnCollect(Inventory inventory)
    {
        int amount = Mathf.Clamp(MagicAmount.Value + Template.Quantity.Value, 0, MaxMagicAmount.Value);

        MagicAmount.SetValue(amount);
        OnCollectEvent.Invoke();
        Destroy(this.gameObject);
    }
コード例 #4
0
 public void SetIsActiveWorld(bool state)
 {
     _activeWorld = state;
     if (!state)
     {
         Crosshair.SetActive(false);
         FocusedPetID.SetValue(0);
         HoveredPetID.SetValue(0);
         PlayerController.LockPlayer();
     }
     else
     {
         PlayerController.UnlockPlayer();;
         Crosshair.SetActive(true);
         RestartButton.SetActive(false);
     }
 }
コード例 #5
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         Debug.Log("Resetting player stats....");
         Inventory.ResetInventory();
         PlayerMagic.SetValue(MagicResetValue);
         OnResetEvent.Invoke();
     }
 }
コード例 #6
0
    public void ApplyChangeToCount(int value)
    {
        int amount = Mathf.Clamp(Count.Value + value, 0, Max.Value);

        Count.SetValue(amount);
    }