public void SeekTarget()     // call this when instantiating a new player, so that the camera correctly locks to them
 {
     target             = GameObject.Find("Player").GetComponent <Transform>();
     playerScript       = target.gameObject.GetComponent <playerScript>();
     playerSound        = target.gameObject.GetComponent <playerSound>();
     transform.position = new Vector3(target.position.x, target.position.y, transform.position.z);
 }
 void Start()
 {
     rb                    = gameObject.GetComponent <Rigidbody2D>();
     playerPosition        = gameObject.transform.position;
     hookShotAnchorPoint   = gameObject.transform.Find("HookshotAnchor").gameObject;
     hookShotAnchorPointRb = hookShotAnchorPoint.GetComponent <Rigidbody2D>();
     hookshotAnchorSprite  = hookShotAnchorPoint.GetComponent <SpriteRenderer>();
     distanceJoint         = gameObject.GetComponent <DistanceJoint2D>();
     distanceJoint.enabled = false;
     lineRenderer          = gameObject.transform.Find("HookshotAnchor").gameObject.GetComponent <LineRenderer>();
     lineRenderer.enabled  = false;
     playerScript          = GameObject.Find("Player").gameObject.GetComponent <playerScript>();
     hookShotAugment       = gameObject.transform.Find("Head").gameObject.transform.Find("HookshotHead").gameObject;
     playerSound           = GetComponent <playerSound>();
 }
Example #3
0
 void Start()
 {
     playerSound = GameObject.Find("Player").GetComponent <playerSound>();
 }