예제 #1
0
파일: Ball.cs 프로젝트: Gen0902/KemuProject
    private void OnCollisionEnter(Collision collision)
    {
        if (isDestroying)
        {
            return;
        }

        GroundTile       tile   = collision.gameObject.GetComponent <GroundTile>();
        PlayerController player = collision.gameObject.GetComponent <PlayerController>();
        Ramp             ramp   = collision.gameObject.GetComponent <Ramp>();

        if (tile != null)
        {
            if (tile.HandleHit(teamAllegiance))
            {
                Disintegrate();
            }
        }
        else if (player != null && player.team == TeamUtils.GetOppositeTeam(teamAllegiance))
        {
            if (GameManager.Instance.rules.scoreIfHitPlayer)
            {
                GameManager.Instance.IncrementScore(teamAllegiance);
                Disintegrate();
            }
        }
        else if (ramp != null)
        {
            if (GameManager.Instance.rules.rampChangeAlliegance)
            {
                ChangeAllegiance(ramp.team);
            }
        }
    }