// Use this for initialization void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <CustomPlatformerCharacter2D>(); playerRigidbody = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>(); } gravity = player.GetGravityScale(); //Save this so we can go between no gravity and full gravity canHoldToAttach = true; }
void Start() { hdzc = horizontalDeadZoneCenter; cam = GetComponent <Camera>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); playerMov = player.gameObject.GetComponent <CustomPlatformerCharacter2D>(); playerRigidbody = player.gameObject.GetComponent <Rigidbody2D>(); float offset = (0.5f - horizontalDeadZoneCenter) / 0.4f; Vector3 newPos = new Vector3(player.position.x + (2.0f * offset), player.position.y + offsetY, -10f); gameObject.transform.position = newPos; GameManager.instance.OnPlayerDeath.AddListener(ResetCamera); }
private void Awake() { m_Character = GetComponent <CustomPlatformerCharacter2D>(); }
private void Awake() { m_Character = GetComponent<CustomPlatformerCharacter2D>(); }