예제 #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Ball"))
     {
         OnGoal?.Invoke(Side);
     }
 }
예제 #2
0
    IEnumerator DeathCameraDispose()
    {
        yield return(new WaitForSeconds(2f));

        deathCamera.gameObject.SetActive(false);
        OnGoal?.Invoke();
    }
예제 #3
0
파일: Goal.cs 프로젝트: mrbushmen/Penalty
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Ball"))
     {
         OnGoal?.Invoke();
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Ball"))
     {
         OnGoal?.Invoke(position);
     }
 }
예제 #5
0
 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));
         }
     }
 }
예제 #6
0
 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;
     }
 }
예제 #7
0
    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();
    }
예제 #8
0
        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();
        }
예제 #9
0
파일: Ball.cs 프로젝트: extrud/PongForTwo
    void Update()
    {
        if (!On)
        {
            return;
        }


        if (Mathf.Abs(transform.position.y) >= 6)
        {
            On = false;
            Debug.Log("Goal");
            if (OnGoal != null)
            {
                OnGoal.Invoke(transform.position);
            }
        }
    }
예제 #10
0
        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();
            }
        }