Пример #1
0
 public void ZeroFX(Vector3 pos)      // break and disappear
 {
     AnalyticsManager.inst.RecordEvent(AnalyticsManager.Keys.zerosCreated, 1);
     EffectsManager.inst.CreateShards(pos);
     AudioManager.inst.PlayNumberShatter(pos);
     SMW_FX.CreateTextEffect(pos, "zero");
 }
Пример #2
0
    public virtual void PostModifyNumber(Fraction original, NumberInfo ni)
    {
        SMW_FX.CreateSmallPurpleExplosion(ni.transform.position);         //,1.5f,.4f);

        if (ni.fraction.numerator != 0)
        {
            ni.SetColor();
        }
        if (ni.fraction.numerator == 0)
        {
            Destroy(ni.gameObject);
            SMW_FX.CreateTextEffect(ni.transform.position, "zero");
            SMW_FX.CreateShards(ni.transform.position);
        }
    }
Пример #3
0
    static void ResolveCollision(CollisionPair pair)
    {
        if (pair.a == null || pair.b == null || pair.a.gameObject == null || pair.b.gameObject == null)
        {
            return;
        }

        NumberInfo a = pair.a;
        NumberInfo b = pair.b;

        if (a.transform.parent == b.transform.parent && b.transform.parent != null)
        {
            return;
        }                                                                                               // don't combine from same generator
//		if (a.transform.parent.GetComponent<AISpikeyGenerator>() && b.tran
        if (a.destroyedThisFrame || b.destroyedThisFrame)
        {
            return;
        }
        if (a.GetComponent <SoapedNumber>() && b.GetComponent <SoapedNumber>())
        {
            return;
        }                                                                                         // soaped number don't combine with each other.
        if (a.GetComponent <TemporaryPreventCombine>() || b.GetComponent <TemporaryPreventCombine>())
        {
            return;
        }                                                                                                               // numbers chopped with sword won't recombine. This behavior is destoyed on player pickup.
        if (a.GetComponent <BlobNumber>() || b.GetComponent <BlobNumber>())
        {
//			if (a.GetComponent<MonsterSnail>() || b.GetComponent<MonsterSnail>()) { return; } // blob monsters
            if (a.GetComponent <BlobNumber>() && b.GetComponent <Rigidbody>() && !b.GetComponent <Rigidbody>().isKinematic)
            {
                a.Eat(b);
            }
            else if (b.GetComponent <BlobNumber>() && a.GetComponent <Rigidbody>() && !a.GetComponent <Rigidbody>().isKinematic)
            {
                b.Eat(a);
            }
        }
        else if (a.GetComponent <MonsterAISpikey1>() || b.GetComponent <MonsterAISpikey1>())
        {
            if (a.GetComponent <MonsterAISpikey1>() && b.GetComponent <MonsterAISpikey1>())
            {
                return;
            }                                                                                                     // spikey' dont eat each other
            else if (!a.GetComponent <Rigidbody>() || !b.GetComponent <Rigidbody>())
            {
                return;
            }                                                                                              // spikeys dont interact with non rigidbodies
            else if (a.GetComponent <Rigidbody>() && a.GetComponent <Rigidbody>().isKinematic)
            {
                return;
            }                                                                                                        // spikeys dont eat kinematics.
            else if (b.GetComponent <Rigidbody>() && b.GetComponent <Rigidbody>().isKinematic)
            {
                return;
            }                                                                                                        // spikeys dont eat kinematics.
            else if (a.GetComponent <MonsterAISpikey1>() && !b.GetComponent <MonsterAISpikey1>())
            {
                a.Eat(b);
            }                                                                                                             // spikeys eat regular num
            else if (!a.GetComponent <MonsterAISpikey1>() && b.GetComponent <MonsterAISpikey1>())
            {
                b.Eat(a);
            }
        }
        else if (a.fraction.numerator == -b.fraction.numerator && a.fraction.denominator == b.fraction.denominator)
        {
//			DestroyedFX(a.transform,b.tran);
//			b.DestroyedFX();
            a.ZeroFX(a.transform.position);
            a.GemFX();
            b.ZeroFX(b.transform.position);
            b.GemFX();
            Destroy(a.gameObject);             //if (a.myShape == NumberShape.Cube) NumberPool.inst.DestroyOrPool (a);
//			else Destroy(a.gameObject);
            Destroy(b.gameObject);             //if (b.myShape == NumberShape.Cube) NumberPool.inst.DestroyOrPool (b);
//			else Destroy(b.gameObject);

            SMW_FX.CreateSmallPurpleExplosion(a.transform.position);  //,1.5f,.5f);
            SMW_FX.CreateWhiteFlash(a.transform.position);            //,20f,.3f);
            SMW_FX.CreateShards(a.transform.position);


            SMW_FX.CreateTextEffect(a.transform.position, "zero");
            a.destroyedThisFrame = true;
            b.destroyedThisFrame = true;
//			a.DestroyedFX();
//			AudioManager.inst.PlayNumberShatter(a.transform.position);
            return;
        }
        else if (a.myShape == NumberShape.Cube && b.myShape == NumberShape.Sphere)
        {
            a.Eat(b);
        }
        else if (a.myShape == NumberShape.Sphere && b.myShape == NumberShape.Cube)
        {
            b.Eat(a);
        }
        else if (a.myShape == NumberShape.Cube && b.myShape == NumberShape.Cube)
        {
            if (a.gameObject.GetComponent <Rigidbody>() && !b.gameObject.GetComponent <Rigidbody>())
            {
                b.Eat(a);
            }
            else if (b.gameObject.GetComponent <Rigidbody>() && !a.gameObject.GetComponent <Rigidbody>())
            {
                a.Eat(b);
            }
        }
        else if (a.gameObject.GetComponent <Rigidbody>() && a.gameObject.GetComponent <Rigidbody>().isKinematic)
        {
            a.Eat(b);
        }
        else if (b.gameObject.GetComponent <Rigidbody>() && b.gameObject.GetComponent <Rigidbody>().isKinematic)
        {
            b.Eat(a);
        }
        else if (a.neverEats)
        {
            b.Eat(a);
        }
        else if (b.neverEats)
        {
            a.Eat(b);
        }
        else if (a.combineLayer > b.combineLayer)
        {
            a.Eat(b);
        }
        else if (a.combineLayer < b.combineLayer)
        {
            b.Eat(a);
        }
        else if (a.gameObject == PlayerGadgetController.inst.thrownNumber)
        {
            b.Eat(a);
        }
        else if (b.gameObject == PlayerGadgetController.inst.thrownNumber)
        {
            a.Eat(b);
        }
        else if (a.GetComponent <SoapedNumber>() && !b.GetComponent <SoapedNumber>())
        {
            a.Eat(b);
        }
        else if (b.GetComponent <SoapedNumber>() && !a.GetComponent <SoapedNumber>())
        {
            b.Eat(a);
        }
        else if (a.gameObject.GetComponent <Rigidbody>() && b.gameObject.GetComponent <Rigidbody>())
        {
            float velA = a.gameObject.GetComponent <Rigidbody>().velocity.sqrMagnitude;
            float velB = b.gameObject.GetComponent <Rigidbody>().velocity.sqrMagnitude;
            if (velA < velB)
            {
                a.Eat(b);
            }
            else
            {
                b.Eat(a);
            }
        }
        else if (Fraction.AbsGreater(a.fraction, b.fraction))
        {
            a.Eat(b);
        }
        else if (Fraction.AbsGreater(b.fraction, a.fraction))
        {
            b.Eat(a);
        }
    }