示例#1
0
    //public virtual void Update ()

    public override void Update()

    {
        //Debug.Log("<color=cyan>BEGIN HITTING</color>");
        base.Update();



        if (anchor != null)         // if the anchor is set, then follow it.
        {
            transform.position = anchor.position;
        }


        if (inDetectionOrb)
        {
            if (orbManager.isSessionEnding)
            {
                return;
            }

            if (isHitting() > 0.0f)
            {
                //Debug.Log("Update:isHitting:true:"+gameObject.name);
                orbManager.AddScore(isHitting(), player);
                GetComponent <MeshRenderer> ().enabled = false;

                GetComponent <CircleCollider2D> ().enabled = false;

                // FFD added code nov 19 2016
                AuraControl ac = gameObject.GetComponentInChildren <AuraControl> ();
                if (ac != null)
                {
                    ac.AuraStop();
                }

                Transform child = transform.Find("VisibleSphere");
                if (child != null)
                {
                    child.GetComponent <MeshRenderer> ().enabled = false;
                }

                Transform hotRotationContainer = transform.Find("HotRotationContainer");
                if (hotRotationContainer != null)
                {
                    hotRotationContainer.Find("HitRotationPointer").GetComponent <MeshRenderer> ().enabled = false;
                }
                //this.transform.Find ("HotRotationContainer").transform.Find ("HitRotationPointer").GetComponent<MeshRenderer> ().enabled = false;

                Transform hotRotationContainer2 = transform.Find("HotRotationContainer2");
                if (hotRotationContainer2 != null)
                {
                    hotRotationContainer2.Find("HitRotationPointer2").GetComponent <MeshRenderer> ().enabled = false;
                }
                //this.transform.Find ("HotRotationContainer").transform.Find ("HitRotationPointer").GetComponent<MeshRenderer> ().enabled = false;



                inDetectionOrb = false;
                iTween.Stop(gameObject);
                orbParticles.Play();
                iTween.ValueTo(gameObject,
                               new Hashtable()
                {
                    { "name", "destroyCountdown" },
                    { "from", 0.0f },
                    { "to", 1.0f },
                    { "onupdate", "dummyUpdate" },
                    { "onupdatetarget", gameObject },
                    { "oncomplete", "destroyOrb" },
                    { "oncompletetarget", gameObject },
                    { "time", orbParticles.duration },
                });
            }
            else
            {
                Debug.Log("Update:isHitting:false");
                onEnterFail();
            }
        }
    }
示例#2
0
    // Update is called once per frame
    public virtual void Update()
    {
        //Debug.Log("<color=cyan>BEGIN HITTING</color>");
        if (inDetectionOrb)
        {
            if (orbManager.isSessionEnding)
            {
                return;
            }

            if (isHitting() > 0.0f)
            {
                //Debug.Log("Update:isHitting:true:"+gameObject.name);
                orbManager.AddScore(isHitting(), player);
                GetComponent <MeshRenderer> ().enabled = false;

                GetComponent <CircleCollider2D> ().enabled = false;

                // FFD added code nov 19 2016
                AuraControl ac = gameObject.GetComponentInChildren <AuraControl> ();
                if (ac != null)
                {
                    ac.AuraStop();
                }

                //ParticleSystem.MainModule pm = gameObject.GetComponentInChildren<ParticleSystem.MainModule>;
                //pm.maxParticles = 50;

                Transform child = transform.Find("VisibleSphere");
                if (child != null)
                {
                    child.GetComponent <MeshRenderer> ().enabled = false;
                    Debug.Log("visible Sphere mesh turned off");
                }
                Transform hotRotationContainer = transform.Find("HotRotationContainer");
                if (hotRotationContainer != null)
                {
                    hotRotationContainer.Find("HitRotationPointer").GetComponent <MeshRenderer> ().enabled = false;
                }
                //this.transform.Find ("HotRotationContainer").transform.Find ("HitRotationPointer").GetComponent<MeshRenderer> ().enabled = false;

                Transform hotRotationContainer2 = transform.Find("HotRotationContainer2");
                if (hotRotationContainer2 != null)
                {
                    hotRotationContainer2.Find("HitRotationPointer2").GetComponent <MeshRenderer> ().enabled = false;
                }



                inDetectionOrb = false;
                iTween.Stop(gameObject);

                ParticleSystem ps = orbParticles;
                ps.GetComponent <ParticleSystem>().maxParticles = Mathf.RoundToInt(isHitting() * 5.0f);

                //ps.main.maxParticles = Mathf.RoundToInt (isHitting () * 100.0f);
                orbParticles = ps;
                //int particlesIntensity = Mathf.RoundToInt(isHitting() * 100.0f);
                //orbParticles.main.maxParticles = particlesIntensity;

                orbParticles.Play();
                iTween.ValueTo(gameObject,
                               new Hashtable()
                {
                    { "name", "destroyCountdown" },
                    { "from", 0.0f },
                    { "to", 1.0f },
                    { "onupdate", "dummyUpdate" },
                    { "onupdatetarget", gameObject },
                    { "oncomplete", "destroyOrb" },
                    { "oncompletetarget", gameObject },
                    { "time", orbParticles.duration },
                });
            }
            else
            {
                //Debug.Log("Update:isHitting:false");
            }
        }
    }