示例#1
0
    //public void ResetClaw(){
    //this.transform.localPosition = originalClawPos;
    //}

    void OnTriggerEnter(Collider other)
    {
        if (!retracting)
        {
            retracting = true;
            SoundManager_Script.Play_BG_SFX("reelbackheavy");                   //this is the sound for reeling back the rod

            GetOrigin();
            //target = origin.position;
            //target = retractOrigin;
            gunScript.CallRotateBackRod();
            if (other.gameObject.CompareTag("balls"))
            {
                SoundManager_Script.Play_SFX("hit");                 // this plays when the claw hits  an object
                //Debug.Log ("Hit");

                hitBall     = true;
                childObject = other.gameObject;
                SM_Script.playerAnswerInSM = childObject.GetComponent <BallScript>().points;
                if (SM_Script.VerifyAnswer())
                {
                    //SoundManager_Script.Play_SFX("correct");
                    BeeM_Script.SpawnBees(other.gameObject);
                }
                other.transform.SetParent(this.transform);
            }
            else if (other.gameObject.CompareTag("collectibles"))
            {
                SoundManager_Script.Play_SFX("hit");                 // this plays when the claw hits an object
                hitCollectibles = true;
                childObject     = other.gameObject;
                other.gameObject.GetComponent <CollectiblesScript>().isCollected = true;
                other.transform.SetParent(this.transform);
            }
            else if (other.gameObject.CompareTag("AngryBee"))
            {
                SoundManager_Script.Play_SFX("hit");                 // this plays when the claw hits an object
                hitAngryBee = true;
                other.gameObject.GetComponent <AngryBee_Script>().isCollected = true;
                other.transform.SetParent(this.transform);
                childObject = other.gameObject;
            }
        }
    }