Esempio n. 1
0
        private void Start()
        {
            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject);
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent <ThirdPersonCharacter>();
        }
Esempio n. 2
0
        public void Throw(Vector3 direction, ThirdPersonCharacter thrower)
        {
            m_Direction = direction;
            m_Thrower   = thrower;
            m_Thrown    = true;
            m_Floor     = false;
            m_Wall      = false;
            m_InHand    = false;

            m_Collider.isTrigger    = false;
            m_RigidBody.isKinematic = false;
            m_RigidBody.useGravity  = true;
            m_RigidBody.velocity    = m_Direction * throwForce;

            Straighten();
            transform.SetParent(null, true);
            m_AxeTrail.emitting = true;
            m_InitialRot        = transform.rotation;
            m_AxeAudio.axeRumble.Play();
            UpdateAnimatorParam();
        }