public bool PickUpSmallPlayer() { //Can't pick up SmallPlayer unless your hands are free and you're not being carried bool handsFree = !HasBall && Above == null; if (!handsFree) { Debug.LogFormat("Failed to pick SmallPlayer up. HasBall: {0} Above != null: {1}", HasBall, Above != null); return(false); } //Check grab hitbox Collider[] hits = Physics.OverlapBox(grabHitbox.transform.TransformPoint(grabHitbox.center), grabHitbox.bounds.extents); foreach (Collider h in hits) { SmallPlayer other = h.GetComponent <SmallPlayer>(); if (other != null && other.Team == Team && other.Below == null) { other.OnPickedUp(this); Above = other; Debug.LogFormat("{0} picked up {1}", transform.parent.name, other.transform.parent.name); return(true); } } Debug.Log("Nobody to pick up in grabHitbox"); return(false); }
// this function ensures that there is only ever one game controller void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void Awake() { scorer = GetComponent <SmallPlayer>(); }