Пример #1
0
    void OnCollisionEnter(Collision hit)
    {
        Collider    other = hit.collider;
        RedBlueBall rbb   = other.GetComponent <RedBlueBall>();

        if (rbb && rbb.color != color)
        {
            // two balls of opposite kind hit.
        }
    }
Пример #2
0
    static void ResolveCollision(CollisionPair2 pair)
    {
        if (pair.a == null || pair.b == null || pair.a.gameObject == null || pair.b.gameObject == null)
        {
            // commented Debug.Log("null!");
            return;
        }

        RedBlueBall a = pair.a;
        RedBlueBall b = pair.b;

        if (a.color != b.color)
        {
            EffectsManager.inst.CreateSmallPurpleExplosion(a.transform.position, 2, 2);
            EffectsManager.inst.CreateSmallPurpleExplosion(b.transform.position, 2, 2);
            AudioManager.inst.PlayWrongAnswerError(a.transform.position, 1, 1);
        }
    }
Пример #3
0
 public CollisionPair2(RedBlueBall _a, RedBlueBall _b)
 {
     a = _a; b = _b;
 }