void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Ball")) { OnGoal?.Invoke(Side); } }
IEnumerator DeathCameraDispose() { yield return(new WaitForSeconds(2f)); deathCamera.gameObject.SetActive(false); OnGoal?.Invoke(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Ball")) { OnGoal?.Invoke(); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Ball")) { OnGoal?.Invoke(position); } }
protected virtual void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer("Area")) { currentArea = other.gameObject.GetComponent <Area>(); OnEnterArea?.Invoke(this, new FrisbeeEventArgs(lastPlayer, currentArea)); } else if (other.gameObject.layer == LayerMask.NameToLayer("Player")) { Player player = other.gameObject.GetComponent <Player>(); player.OnCatchFrisbee(this); } else if (other.gameObject.layer == LayerMask.NameToLayer("Wall")) { Wall wall = other.gameObject.GetComponent <Wall>(); Bounce(wall.BouncingVector); } else if (other.gameObject.layer == LayerMask.NameToLayer("Deadzone")) { FindObjectOfType <GameMatchManager>().Goal(false, 0); } else if (other.gameObject.layer == LayerMask.NameToLayer("Goal")) { var fake = gameObject.GetComponent <FakeFrisbee>(); if (fake == null) { var goal = other.gameObject.GetComponent <Goal>(); OnGoal?.Invoke(this, new FrisbeeGoalEventArgs(goal)); } } }
public override void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent <PlayBall>() != null && !reached) { OnGoal.Invoke(); GameManager.Instance.player.GetComponent <ThingController>().bounds = transform.parent.gameObject.GetComponent <Collider2D>(); GameManager.Instance.RaiseLevel(); reached = true; } }
public void Goal(bool teamA, int points) { var team = teamA ? m_teams [1] : m_teams [0]; team.Score += points; var scoreTxt = teamA ? m_scoreB : m_scoreA; scoreTxt.text = team.Score.ToString(); OnGoal?.Invoke(this, null); ResetGame(); }
public void MakeGoal(Footballer footballer) { if (FirstTeam.Title.Equals(footballer.TeamTitle) && Ball.BallOnGoalForSecondTeam()) { Count[0]++; Ball.Attacker = SecondTeam.Players.Find(f => f.Role == FootballerRole.Goolkeeper); OnGoal?.Invoke(footballer); } if (SecondTeam.Title.Equals(footballer.TeamTitle) && Ball.BallOnGoalForFirstTeam()) { Count[1]++; Ball.Attacker = FirstTeam.Players.Find(f => f.Role == FootballerRole.Goolkeeper); OnGoal?.Invoke(footballer); } Ball.Fly(); }
void Update() { if (!On) { return; } if (Mathf.Abs(transform.position.y) >= 6) { On = false; Debug.Log("Goal"); if (OnGoal != null) { OnGoal.Invoke(transform.position); } } }
protected override void Observe() { var tick = ObservableContext.Ticks; if (_checkPoints != null) { while (_currentCheckPointIndex < _checkPoints.Length && tick == _checkPoints[_currentCheckPointIndex]) { OnCheckPoint?.Invoke(this, EventArgs.Empty); ++_currentCheckPointIndex; } } if (tick == Goal) { OnGoal?.Invoke(this, EventArgs.Empty); Dispose(); } }