private void Start()
        {
            this.m_Transform       = transform.root;
            this.m_Animator        = this.m_Transform.GetComponent <Animator> ();
            this.m_Rigidbody       = this.m_Transform.GetComponent <Rigidbody> ();
            this.m_CapsuleCollider = this.m_Transform.GetComponent <CapsuleCollider> ();
            this.m_Camera          = Camera.main.GetComponent <ThirdPersonCamera>();

            ThirdPersonController[] controllers = this.m_Transform.GetComponents <ThirdPersonController> ();
            for (int i = 0; i < controllers.Length; i++)
            {
                if (controllers [i].enabled)
                {
                    this.m_Controller = controllers [i];
                }
            }
        }
Esempio n. 2
0
        private void OnEnable()
        {
            this.m_Camera     = target as ThirdPersonCamera;
            this.m_Presets    = serializedObject.FindProperty("m_Presets");
            this.m_PresetList = new ReorderableList(serializedObject, this.m_Presets, true, true, true, true)
            {
                drawHeaderCallback            = new ReorderableList.HeaderCallbackDelegate(DrawPresetHeader),
                drawElementCallback           = new ReorderableList.ElementCallbackDelegate(DrawPreset),
                onSelectCallback              = new ReorderableList.SelectCallbackDelegate(SelectPreset),
                onAddCallback                 = new ReorderableList.AddCallbackDelegate(AddPreset),
                drawElementBackgroundCallback = new ReorderableList.ElementCallbackDelegate(DrawPresetBackground)
            };

            int layerIndex = EditorPrefs.GetInt("CameraPresetIndex" + target.GetInstanceID().ToString(), -1);

            if (this.m_PresetList.count > layerIndex)
            {
                this.m_PresetList.index = layerIndex;
                SelectPreset(this.m_PresetList);
            }

            this.m_Script = serializedObject.FindProperty("m_Script");
        }
 private void Start()
 {
     this.m_ThirdPersonCamera = GetComponent <ThirdPersonCamera>();
 }