protected void Awake() { playerAudio = GetComponent <PlayerAudioScript>(); initialPosition = transform.position; initialRotation = transform.rotation.eulerAngles; myRigidBody = GetComponent <Rigidbody2D>(); powerupEffect = transform.GetChild(0).GetComponent <PowerupEffectScript>(); tail = GetComponent <TrailRenderer>(); transform.Find("Orb Attractor").GetComponent <CircleCollider2D>().radius = coinAttractionRadius / transform.lossyScale.x; nearbyPlanets = new List <GameObject>(); chargeBar = transform.Find("Charge Bar").gameObject; jetpackBar = GameObject.FindGameObjectWithTag("PlayerHUD").GetComponent <JetpackBar>(); tractorBeam = GetComponent <LineRenderer>(); jetpackFlame = transform.Find("Jetpack Flame").gameObject; }
public void Start() { score = 0; initialPosition = transform.position; initialRotation = transform.rotation.eulerAngles; powerupEffect = transform.GetChild(0).GetComponent <PowerupEffectScript>(); // keep track of the other player object for convenience GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); if (players[0] == this.gameObject) { otherPlayer = players[1].GetComponent <PlayerScript>(); } else { otherPlayer = players[0].GetComponent <PlayerScript>(); } cameraShaker = GameObject.FindGameObjectsWithTag("MainCamera")[0].GetComponent <CameraShakeScript>(); // puts player in its initial state ResetPlayerStates(); }