Exemplo 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()
 {
     animator        = GetComponent <Animator>();
     characterMotor  = GetComponent <TPCharacter>().GetCharacteMotor();
     characterCamera = GetComponent <TPCharacter>().GetCamera();
     transform.SetKinematic(true);
     health = startHealth;
 }
Exemplo 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>
        private void Start()
        {
            if (target == null)
            {
                return;
            }

            characterMotor   = target.root.GetComponent <TPCharacter>().GetCharacteMotor();
            _camera          = GetComponent <Camera>();
            currentTarget    = target;
            currentTargetPos = new Vector3(currentTarget.position.x, currentTarget.position.y, currentTarget.position.z);

            targetLookAt           = new GameObject("targetLookAt").transform;
            targetLookAt.position  = currentTarget.position;
            targetLookAt.hideFlags = HideFlags.HideInHierarchy;
            targetLookAt.rotation  = currentTarget.rotation;

            mouseY = currentTarget.eulerAngles.x;
            mouseX = currentTarget.eulerAngles.y;

            distance      = defaultDistance;
            currentHeight = height;
        }
Exemplo 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()
 {
     audioSource    = GetComponent <AudioSource>();
     characterMotor = GetComponent <TPCharacter>().GetCharacteMotor();
 }
 /// <summary>
 /// Init is called on the frame when a script is enabled just before
 /// any of the Update methods is called the first time.
 /// </summary>
 public void Init(Animator animator, Transform transform, TPCMotor characterMotor)
 {
     this.animator       = animator;
     this.transform      = transform;
     this.characterMotor = characterMotor;
 }