void DispatchGoalEvent(BallEvent e) { if (GoalEventHandler != null) { GoalEventHandler(this, e); } }
void OnTableContact(object sender, BallEvent e) { if (e.State == BallEvent.CollisionState.Enter) { contacts.Enqueue(ball.transform.position); } }
void OnTableContact(object sender, BallEvent e) { if (e.State == BallEvent.CollisionState.Exit) { source.PlayOneShot(bounce, 0.5f); } }
void DispatchPlayerContactEvent(BallEvent e) { if (PlayerContactEventHandler != null) { PlayerContactEventHandler(this, e); } }
void DispatchTableContactEvent(BallEvent e) { if (TableContactEventHandler != null) { TableContactEventHandler(this, e); } }
void OnPlayerContact(object sender, BallEvent e) { if (e.State == BallEvent.CollisionState.Exit) { bool isAgentTeam = e.Team == agentTeam.gameObject; Stats.OnPlayerContact(isAgentTeam); } }
void OnGoal(object sender, BallEvent e) { if (e.Team == teamRed.gameObject) { source.PlayOneShot(goalA, 0.75f); } else { source.PlayOneShot(goalB, 0.75f); } }
void OnGoal(object sender, BallEvent e) { bool hasScored = e.Object == opponentTeam.Goal; Stats.OnGoal(hasScored); AddReward(hasScored ? goalScoredReward : -goalConcededPenalty); if (hasScored) { agentTeam.HighlightGoal(); } }
void OnGoal(object sender, BallEvent e) { bool hasScored = e.Object == opponentTeam.Goal; Stats.OnGoal(hasScored); AddReward(hasScored ? goalScoredReward : -goalConcededPenalty); matchState = hasScored ? GhostTrainerMatchState.WIN : GhostTrainerMatchState.LOSS; if (hasScored) { agentTeam.HighlightGoal(); } }
void OnGoal(object sender, BallEvent e) { // Highlight. foreach (LineRenderer line in lines) { Color col = colors[2]; col.a = line.startColor.a; line.startColor = col; col.a = line.endColor.a; line.endColor = col; } draw = false; }
void OnPlayerContact(object sender, BallEvent e) { if (e.State == BallEvent.CollisionState.Exit) { if (e.Team == teamRed.gameObject) { source.PlayOneShot(kickA); } else { source.PlayOneShot(kickB); } } }
void OnPlayerContact(object sender, BallEvent e) { if (e.State == BallEvent.CollisionState.Enter) { int index = e.Team == teamRed.gameObject ? 0 : 1; if (index != crntTeamIndex) { contacts.Clear(); crntTeamIndex = index; draw = true; } contacts.Enqueue(e.Object.transform.position); } }
void OnCollision(BallEvent e) { if (e.Object.CompareTag(Tags.PLAYER)) { DispatchPlayerContactEvent(e); } else if (e.Object.CompareTag(Tags.TABLE)) { DispatchTableContactEvent(e); if (e.State == BallEvent.CollisionState.Enter) { Vector3 p = e.Object.transform.localPosition; Vector3 normal = Mathf.Abs(p.z) > 0.5f ? Vector3.back * Mathf.Sign(p.z) : Vector3.left * Mathf.Sign(p.x); rb.velocity = Vector3.Reflect(-e.Collision.relativeVelocity, normal) * wallBounce; } } }
void OnAutoKick(object sender, BallEvent e) { Stats.OnAutoKick(); }
void OnAutoKick(object sender, BallEvent e) { ReSet(); }
void OnReset(object sender, BallEvent e) { ReSet(); }
void OnReset(object sender, BallEvent e) { source.PlayOneShot(reset); }