public virtual void SetBallTo(IBallControlObject target) { this.UpdateOwner(target); this.m_BallObject.transform.localPosition = Vector3.zero; this.m_MaxLength = (target.GetBallWorldPosition() - this.GetPosition()).sqrMagnitude - this.ballRadius; this.m_BallHeight = Random.Range(0, 3f); }
public virtual void UpdateBall(IBallControlObject value) { // NOT ACTIVE if (this.isBallActive == false) { return; } // NOT HAVE TEAM if (value.GetTeam() == null) { return; } // IS INRANGE var direction = value.GetPosition() - this.GetPosition(); if (direction.sqrMagnitude >= this.m_BallRadius * this.m_BallRadius) { return; } // SET OWNER if (this.m_BallOwner == null) { this.UpdateOwner(value); } else { if (value.GetTeam().teamName == this.m_BallOwner.GetTeam().teamName) { return; } // CHECK BALL VALUE if (value.GetBallValue() >= this.m_BallOwner.GetBallValue()) { this.m_BallOwner.SetBall(null); this.UpdateOwner(value); } } }
protected virtual void UpdateOwner(IBallControlObject value) { this.m_BallOwner = value; this.m_BallOwner.SetBall(this); }