コード例 #1
0
 void Awake()
 {
     impactColor   = impactParticles.main;
     mainRB        = GetComponent <Rigidbody> ();
     tpMotor       = GetComponent <ThirdPersonCharacterMotor> ();
     anim          = GetComponent <Animator> ();
     reticleSprite = reticle.GetComponentInChildren <SpriteRenderer> ();
 }
コード例 #2
0
        public Transform target;                                    // target to aim for


        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent     = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>();
            character = GetComponent <ThirdPersonCharacterMotor>();

            agent.updateRotation = false;
            agent.updatePosition = true;
        }
コード例 #3
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 <ThirdPersonCharacterMotor>();
        }
コード例 #4
0
    //setup
    void Awake()
    {
        aSource = GetComponent <AudioSource>();
        //create grabBox is none has been assigned
        if (!grabBox)
        {
            grabBox = new GameObject();
            grabBox.AddComponent <BoxCollider>();
            grabBox.GetComponent <Collider>().isTrigger = true;
            grabBox.transform.parent        = transform;
            grabBox.transform.localPosition = new Vector3(0f, 0f, 0.5f);
            grabBox.layer = 2;                  //ignore raycast by default
            Debug.LogWarning("No grabBox object assigned to 'Throwing' script, one has been created and assigned for you", grabBox);
        }

        playerMove = GetComponent <ThirdPersonCharacterMotor>();
        //characterMotor = GetComponent<CharacterMotor>(); line rendererd unnecessary for now. (see line 85)
        //defRotateSpeed = playerMove.rotateSpeed;
        //set arms animation layer to animate with 1 weight (full override)
        //	if(animator)
        //		animator.SetLayerWeight(armsAnimationLayer, 1);
    }