protected virtual void Awake() { OriginalParent = transform.parent; Team = _team; xzController = GetComponent <PlayerMover>(); ballUserComponent = GetComponent <BallUserComponent>(); StartCoroutine(DashRoutine()); if (grabHitbox == null) { Debug.LogError("SmallPlayer.grabHitbox is null. HMMMM <_<"); } }
public Player Steal(BoxCollider grabHitbox) { if (HasBall || !CanSteal) { Debug.LogFormat("Cannot steal. HasBall: {0} stealCooldownRemaining: {1}", HasBall, stealCooldownRemaining); return(null); } Collider[] hits = Physics.OverlapBox(grabHitbox.transform.TransformPoint(grabHitbox.center), grabHitbox.bounds.extents); foreach (Collider h in hits) { BallUserComponent other = h.GetComponent <BallUserComponent>(); if (other != null && other.heldBall != null) { if (other.GetComponent <TallPlayer>() != null) { if (other.GetComponent <TallPlayer>().Above == null) { stealCooldownRemaining = stealCooldown; HoldBall(other.heldBall); other.heldBall = null; SoundManager.Instance.Play(successfulSteal); return(h.GetComponent <Player>()); } } else { stealCooldownRemaining = stealCooldown; HoldBall(other.heldBall); other.heldBall = null; SoundManager.Instance.Play(successfulSteal); return(h.GetComponent <Player>()); } } } Debug.Log("Nobody to Steal from detected"); return(null); }