private void OnTriggerExit2D(Collider2D player) { if (player.tag == "Player") { playerControl = player.GetComponent <LeandrePlayerControl>(); playerControl.setRunningSpeed(beforeSlowRunningSpeed); playerControl.setSlidingSpeed(beforeSlowSlidingSpeed); } }
private void OnTriggerEnter2D(Collider2D player) { if (player.tag == "Player") { playerControl = player.GetComponent <LeandrePlayerControl>(); if (firstTriggerPassed == false) { beforeSlowRunningSpeed = (float)playerControl.getRunningSpeed(); beforeSlowSlidingSpeed = (float)playerControl.getSlidingSpeed(); firstTriggerPassed = true; } playerControl.setRunningSpeed(playerControl.getRunningSpeed() * 0.1f); playerControl.setSlidingSpeed(playerControl.getSlidingSpeed() * 0.1f); } }
private void Start() { control = GetComponent <LeandrePlayerControl>(); }
private void Start() { rb = GetComponent <Rigidbody2D>(); col2d = GetComponent <Collider2D>(); control = GetComponent <LeandrePlayerControl>(); }