Пример #1
0
    // Use this for initialization
    void Start()
    {
        if (!created)
        {
            DontDestroyOnLoad(this.gameObject);
            created = true;
            Debug.Log("Awake(don't destroy on load): " + this.gameObject);
        }
        else
        {
            Debug.Log("Destroying Duplicate: " + this.gameObject);
            Destroy(this.gameObject);
        }

        m_swingerCam = Camera.main.GetComponent <SwingerCamera>();
        if (m_swingerCam == null)
        {
            Debug.Log("[SwingerRopeController] m_swingerCam not found!");
        }

        m_swinger = GameObject.FindGameObjectWithTag("Player").GetComponent <SwingerController>();
        if (m_swinger == null)
        {
            Debug.Log("[SwingerRopeController] m_swinger not found!");
        }
        else
        {
            m_swingerRigidBody = m_swinger.gameObject.GetComponent <Rigidbody>();
            if (m_swingerRigidBody == null)
            {
                Debug.Log("[SwingerRopeController] m_swingerRigidBody not found!");
            }
        }

        m_leftRope = GetComponentsInChildren <LineRenderer>()[0];
        if (m_leftRope == null)
        {
            Debug.Log("[SwingerController] m_leftRope not found!");
        }

        m_rightRope = GetComponentsInChildren <LineRenderer>()[1];
        if (m_rightRope == null)
        {
            Debug.Log("[SwingerController] m_rightRope not found!");
        }

        m_leftRopePoints.Add(new GameObject("leftHandObj"));
        DontDestroyOnLoad(m_leftRopePoints[0]);
        m_leftRopePoints.Add(new GameObject("leftPoint"));
        DontDestroyOnLoad(m_leftRopePoints[1]);
        m_rightRopePoints.Add(new GameObject("rightHandObj"));
        DontDestroyOnLoad(m_rightRopePoints[0]);
        m_rightRopePoints.Add(new GameObject("rightPoint"));
        DontDestroyOnLoad(m_rightRopePoints[1]);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_swinger = GetComponent <SwingerController>();
        if (m_swinger == null)
        {
            Debug.Log("[SwingerInput] m_controller not found!");
        }

        m_ropes = GameObject.FindGameObjectWithTag("RopeController").GetComponent <SwingerRopeController>();
        if (m_ropes == null)
        {
            Debug.Log("[SwingerInput] m_ropes not found!");
        }

        /*m_cam = GetComponent<SwingerCamera>();
         * if (m_cam == null)
         * {
         *  Debug.Log("[SwingerInput] m_cam not found!");
         * }*/
    }