override public void UseHoop(GameObject obj, RecordPosition record, bool direction)
 {
     base.UseHoop(obj, record, direction);
     GetComponent <AudioSource>().Play();
     if (obj.GetComponent <NumberInfo>())
     {
         AlgebraInfo ai = obj.GetComponent <AlgebraInfo>();
         if (!direction)
         {
             if (ai)
             {
                 ai.SetExponent(ai.exponent - 1);
                 if (ai.exponent == 0)
                 {
                     Destroy(ai);
                     return;
                 }
             }
         }
         else
         {
             if (!ai)
             {
                 ai = obj.AddComponent <AlgebraInfo>();
                 ai.SetExponent(1);
             }
             else
             {
                 ai.SetExponent(ai.exponent + 1);
             }
         }
     }
 }
 void PullExponentBallFromAlgebraNumber(AlgebraInfo ai)
 {
     if (ai.exponentBalls.Count > 0 && !exponentBall)
     {
         exponentBall = ai.exponentBalls[0];
         ai.exponentBalls.RemoveAt(0);
     }
 }
    void OnTriggerEnter(Collider other)
    {
        NumberInfo  ni = other.GetComponent <NumberInfo>();
        AlgebraInfo ai = other.GetComponent <AlgebraInfo>();

        if (ai)
        {
            if (heldNumber)
            {
                Destroy(heldNumber);
                ClearBlocks();
            }
            heldNumber = other.gameObject;
            heldNumber.transform.parent = transform;
            if (heldNumber.GetComponent <Rigidbody>())
            {
                Destroy(heldNumber.GetComponent <Rigidbody>());
            }

//			PopulateBlocks(ai);
        }
    }
Exemple #4
0
    virtual public GameObject CleanComponentsForAmmo(GameObject ammoGraphics)
    {
        if (!ammoGraphics)
        {
//			// commented Debug.Log ("no ammographics here!");
            return(null);
        }
        //		// commented Debug.Log ("killing stuff on ammoghx");
        List <Component> comps = new List <Component>();

        comps.AddRange(ammoGraphics.GetComponentsInChildren(typeof(Component)));
        comps.AddRange(ammoGraphics.GetComponents(typeof(Component)));
        foreach (Component comp in comps)
        {
            //			// commented Debug.Log ("comp: " +comp.GetType() + "typoef " + typeof(MeshFilter));
            if (comp == null)
            {
                continue;
            }
            if (comp.GetType() == typeof(AlgebraInfo))
            {
                AlgebraInfo ai = comp as AlgebraInfo;
                ai.ClearBalls();
            }
            if (

                comp.GetType() == typeof(Collider) ||
                comp.GetType() == typeof(BoxCollider) ||
                comp.GetType() == typeof(SphereCollider) ||
                comp.GetType() == typeof(Rigidbody) ||
                comp.GetType() == typeof(Rotate) ||
                comp.GetType() == typeof(FollowTransform) ||
                comp.GetType() == typeof(ParticlesOnBounce) ||
                comp.GetType() == typeof(Animal) ||
                comp.GetType() == typeof(Animal_Bird) ||
                comp.GetType() == typeof(Animal_Fish) ||
                comp.GetType() == typeof(LineRenderer) ||
                comp.GetType() == typeof(HideMeshAtDistance)
                )
            {
                UnityEngine.Object.Destroy(comp);
            }
            //			// this was blacklist (exclude these) but now let's whitelist and only get rid of collider.
            //			continue;
            //
            //			if (comp.GetType()==typeof(MeshFilter)) { continue; }
            //			if (comp.GetType()==typeof(Transform)) { continue; }
            //			if (comp.GetType()==typeof(MeshRenderer)) { continue; }
            //			if (comp.GetType()==typeof(Renderer)) { continue; }
            //			if (comp.GetType()==typeof(ParticleEmitter)) { continue; }
            //			if (comp.GetType()==typeof(ParticleRenderer)) { continue; }
            //			if (comp.GetType()==typeof(ParticleAnimator)) { continue; }
            //			if (comp.GetType()==typeof(ParticleSystem)) { continue; }
            //			if (comp.GetType()==typeof(CubeWarmer)) { continue; }
            //			if (comp.GetType()==typeof(NumberInfo)) { continue; }
            //			if (comp.GetType()==typeof(SometimesFacePlayer)) {
            //				comp.SendMessage("FacePlayerOnce"); // awk!
            //				continue;
            //			}
            //			// commented Debug.Log("destroying " + comp+ " on " + ammoGraphics.name);
            //			UnityEngine.Object.Destroy(comp);
            //			if (ni.GetComponentInChildren<SometimesFacePlayer>()){
            //				ni.GetComponentInChildren<SometimesFacePlayer>().FacePlayerOnce();
            //			}
        }
        return(ammoGraphics);
    }