Example #1
0
    private void Update()
    {
        currentSign = inputAdapter.inputType == InputAdapter.InputType.CONTROLLER_XBOX ? signXBOX : signKB;

        float distanceToPlayer = Vector3.Distance(player.transform.position, transform.position);

        if (distanceToPlayer < pickupRadius)
        {
            currentSign.SetActive(true);
            currentSign.transform.LookAt(Camera.main.transform.position);
            if (inputAdapter.GetInputDown(InputAdapter.InputKey.A))
            {
                player.Eat(this);
                Destroy(gameObject);
            }
        }
        else
        {
            signXBOX.SetActive(false);
            signKB.SetActive(false);
        }

        if (inputAdapter.GetInputDown(InputAdapter.InputKey.A) && distanceToPlayer < pickupRadius)
        {
            player.Eat(this);
            Destroy(gameObject);
        }
    }
Example #2
0
 private void Update()
 {
     if (inputAdapter.GetInputDown(InputAdapter.InputKey.A))
     {
         SceneManager.LoadScene(2);
     }
     if (inputAdapter.GetInputDown(InputAdapter.InputKey.B))
     {
         SceneManager.LoadScene(1);
     }
 }
Example #3
0
    private void Update()
    {
        currentSign = inputAdapter.inputType == InputAdapter.InputType.CONTROLLER_XBOX ? signXBOX : signKB;

        float distanceToPlayer = Vector3.Distance(player.transform.position, transform.position);

        if (distanceToPlayer < hideRadius)
        {
            currentSign.SetActive(true);
            currentSign.transform.LookAt(Camera.main.transform.position);

            if (inputAdapter.GetInputDown(InputAdapter.InputKey.A) && !occupied)
            {
                Debug.Log("hello");
                occupied = true;
                player.EnterHiddingSpot(() =>
                {
                    Sequence sec = DOTween.Sequence();
                    sec.AppendInterval(0.1f)
                    .OnComplete(() =>
                    {
                        occupied = false;
                    });
                }, isBurrow);
            }
        }
        else
        {
            signXBOX.SetActive(false);
            signKB.SetActive(false);
        }
    }
Example #4
0
 private void HandleHidding()
 {
     if (inputAdapter.GetInputDown(InputAdapter.InputKey.A))
     {
         Debug.Log("oh");
         animator.gameObject.SetActive(true);
         isHidding = false;
         onLeaveHiddingSpot?.Invoke();
     }
 }
Example #5
0
    private void Update()
    {
        currentSign = inputAdapter.inputType == InputAdapter.InputType.CONTROLLER_XBOX ? signXBOX : signKB;

        float distanceToPlayer = Vector3.Distance(player.transform.position, transform.position);

        if (distanceToPlayer < pickupRadius)
        {
            if (!pickedUp)
            {
                currentSign.SetActive(true);
            }
            else
            {
                currentSign.SetActive(false);
            }
            currentSign.transform.LookAt(Camera.main.transform.position);

            if (inputAdapter.GetInputDown(InputAdapter.InputKey.A) && !pickedUp)
            {
                pickedUp = true;
                transform.SetParent(player.mouth);
                transform.localPosition    = Vector3.zero;
                transform.localEulerAngles = Vector3.zero;


                player.PickupStraw(this, () =>
                {
                    if (pickedUp)
                    {
                        pickedUp = false;
                        transform.SetParent(originalParent);
                        transform.localPosition    = new Vector3(player.transform.position.x, 0.1f, player.transform.position.z);
                        transform.localEulerAngles = Vector3.zero;
                    }
                });
            }
        }
        else
        {
            signXBOX.SetActive(false);
            signKB.SetActive(false);
        }
    }