Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SpeedFaster : MonoBehaviour {
- public GameObject Head;
- private AIBehavior movespeed;
- void OnCollisionEnter(Collision collision)
- {
- //when the player collides with the box
- if(collision.other.transform.tag == "Player")
- {
- //access script aibehavior to change the variable movespeed
- movespeed = Head.gameObject.GetComponent<AIBehavior>();
- //change the movespeed
- movespeed.movespeed = 10.0f;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement