Esempio n. 1
0
        /// <summary>
        /// Awake is called when the script instance is being loaded.
        /// </summary>
        ///
        /// <remarks>
        /// Awake is called only once during the lifetime of the script instance.
        /// Awake is always called before any Start functions.
        /// This allows you to order initialization of scripts.
        /// </remarks>
        protected virtual void Awake()
        {
            //Init required components
            characterHealth   = GetComponent <CharacterHealth>();
            character         = GetComponent <TPCharacter>();
            _camera           = character.GetCamera().transform;
            inverseKinematics = character.GetInverseKinematics();

            //Ignore player layer for grabbing raycast
            layerMask = ~(1 << LayerMask.NameToLayer("Player"));
        }
Esempio n. 2
0
        /// <summary>
        /// Start is called on the frame when a script is enabled just before
        /// any of the Update methods is called the first time.
        /// </summary>
        protected virtual void Start()
        {
            //Init required components
            character         = GetComponent <TPCharacter>();
            _camera           = character.GetCamera().transform;
            inverseKinematics = character.GetInverseKinematics();
            characterHealth   = GetComponent <CharacterHealth>();

            //Ignore player layer for grabbing raycast
            layerMask = ~(1 << LayerMask.NameToLayer("Player"));

            //Add and configuring Spring Joint
            if (!springJoint)
            {
                GameObject go = new GameObject("Rigidbody Dragger");
                gameObject.transform.parent = transform;
                Rigidbody body = go.AddComponent <Rigidbody>();
                springJoint      = go.AddComponent <SpringJoint>();
                body.isKinematic = true;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Start is called on the frame when a script is enabled just before
 /// any of the Update methods is called the first time.
 /// </summary>
 protected virtual void Start()
 {
     inverseKinematics = GetComponent <TPCharacter>().GetInverseKinematics();
     StartCoroutine("IKInteractiveProcessing", 0.1f);
 }