示例#1
0
    public void findParamControllers()
    {
        GameObject globalTimeControllerObject = GameObject.Find("GlobalTimeController");

        if (globalTimeControllerObject)
        {
            m_animCtrl    = globalTimeControllerObject.GetComponent <AnimParameterController>();
            m_physicsCtrl = globalTimeControllerObject.GetComponent <PhysicsParameterController>();
        }
        //m_animCtrl = FindObjectOfType<AnimParameterController>();
        //m_physicsCtrl = FindObjectOfType<PhysicsParameterController>();
    }
    //////////////////////////////////////////////////////////////////////////////////////////
    #region Runtime
    //////////////////////////////////////////////////////////////////////////////////////////

    // Use this for initialization
    void Start()
    {
        m_rigidBody = GetComponent <Rigidbody>();
        PhysicsParameterController ctrler = FindObjectOfType <PhysicsParameterController> () as PhysicsParameterController;

        if (ctrler)
        {
            ctrler.register(this);
        }
        else
        {
            Debug.Log("Warning, no global phyics controller found, " + this.gameObject.name + " may not be time controllable");
        }
    }