Beispiel #1
0
    void OnGoal(Object _Obj, System.EventArgs _EventArg)
    {
        Goal.GoalVO lGoalVO = (Goal.GoalVO)_EventArg;

        if (GameManager.Instance.IsScoreLimitReach())
        {
            if (this.m_BallInstance != null)
            {
                Destroy(this.m_BallInstance.gameObject);
            }
            this.m_BallInstance = null;
        }
        else
        {
            this.m_BallInstance.transform.position = this.transform.position;
            this.m_BallInstance.transform.rotation = Quaternion.identity;

            // Set the ball spawn direction to the goaling player.
            if ((this.m_SpawnForce.x > 0.0f && lGoalVO.m_EPlayer == GameManager.EPlayer.Player2) ||
                (this.m_SpawnForce.x < 0.0f && lGoalVO.m_EPlayer == GameManager.EPlayer.Player1))
            {
                this.m_SpawnForce.x *= -1;
            }

            this.Spawn();
        }
    }
Beispiel #2
0
    public void OnGoal(Object _Obj, System.EventArgs _EventArg)
    {
        if (this.m_CurrentState == State.RoundRun)
        {
            Goal.GoalVO lVO = (Goal.GoalVO)_EventArg;

            /**
            ** If the player 2 goal is hit, the player 1 win points.
            **/

            if (lVO.m_EPlayer == EPlayer.Player2)
            {
                this.CalculateScore(GlobalDatas.Instance.m_Player1, lVO.m_EGoalHitType);
            }
            else
            {
                this.CalculateScore(GlobalDatas.Instance.m_Player2, lVO.m_EGoalHitType);
            }

            GameManager.GoalEvent(this, lVO);
        }
    }