Advertisement
Guest User

Untitled

a guest
Mar 6th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SpeedFaster : MonoBehaviour {
  5.  
  6. public GameObject Head;
  7. private AIBehavior movespeed;
  8.  
  9. void OnCollisionEnter(Collision collision)
  10. {
  11. //when the player collides with the box
  12. if(collision.other.transform.tag == "Player")
  13. {
  14. //access script aibehavior to change the variable movespeed
  15. movespeed = Head.gameObject.GetComponent<AIBehavior>();
  16. //change the movespeed
  17. movespeed.movespeed = 10.0f;
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement