Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PowerupScript : MonoBehaviour{
- new AudioSource audio;
- public Animator anim;
- void Start() {
- audio = GetComponent<AudioSource>();
- }
- void OnTriggerEnter(Collider other)
- {
- if (other.tag == "Enemy") {
- Tortuga playerScript = other.gameObject.GetComponent<Tortuga> ();
- anim = other.gameObject.GetComponentInChildren<Animator> ();
- if (playerScript) {
- // We speed up the player and then tell to stop after a few seconds
- anim.SetInteger ("muerte", 1);
- playerScript.coeffSpeedUp = 9.5f;
- StartCoroutine (playerScript.StopSpeedUp ());
- if (playerScript.StopSpeedUp = 9.5f){
- anim.SetInteger ("muerte", 0);
- }
- audio.Play ();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement