void YButton() { Debug.Log("Pressing Y"); if (cooldown) { return; } if (!CheckBall(2.5f)) { return; } OnButtonPush?.Invoke(); StartCoroutine(Cooldown()); Debug.Log("hitball"); Ball.instance.Chilli(pView.transform.forward.x, pView.transform.forward.z, this.gameObject); }
void BButton() { Debug.Log("Pressing B"); if (cooldown) { return; } if (!CheckBall(2.5f)) { return; } OnButtonPush?.Invoke(); StartCoroutine(Cooldown()); Debug.Log("hitball"); //Vector3 force = Vector3.Normalize(Ball.GameBall.transform.position - transform.position); Ball.instance.Watermelon(pView.transform.forward.x, pView.transform.forward.z, this.gameObject); pMove.Knockback(9000, 0.5f); }
public void Click(bool isClicked) { if (_isClicked && isClicked) { OnButtonPush.Invoke(); } if (!_isClicked && isClicked) { OnButtonClick.Invoke(); _isClicked = true; } if (_isClicked && !isClicked) { AfterButtonClick.Invoke(); _isClicked = false; } }
IEnumerator HoldBall() { Ball.instance.SetNewFood(2); ballHeld = true; float duration = 1 + (Ball.instance.speed * 0.004f); StartCoroutine(Cooldown(duration + 0.2f)); float time = 0; Ball.instance.body.velocity = Vector3.zero; while (time < duration) { time += Time.deltaTime; Ball.instance.body.velocity = Vector3.zero; Ball.GameBall.transform.position = transform.position + (pView.transform.forward * 2); yield return(null); } OnButtonPush?.Invoke(); Ball.instance.Pie(pView.transform.forward.x, pView.transform.forward.z, this.gameObject); ballHeld = false; }