Ejemplo n.º 1
0
 private void Start()
 {
     player             = GetComponentInParent <Rigidbody>();
     pMovement          = player.GetComponent <PlayerMovement>();
     myCapsuleCollider  = player.GetComponentInParent <CapsuleCollider>();
     positionOfAnchor   = transform.TransformDirection(Vector3.up);
     positionOfAnchor.y = maxHookShotDistance;
     fishRef            = player.GetComponentInChildren <RefScript>();
     anim             = player.GetComponentInChildren <Animator>();
     capsuleHRef      = myCapsuleCollider.height;
     hookLineRenderer = GetComponent <LineRenderer>();
 }
Ejemplo n.º 2
0
    //script is a component - access script components on other game objects, takes type as a parameter
    //initialise variables

    private void Awake()
    {
        refScript    = GetComponent <RefScript>();
        refScriptAlt = otherGameObject.GetComponent <RefScriptAlt>();
        boxCol       = otherGameObject.GetComponent <BoxCollider>();
    }