-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmoveMngr.cs
40 lines (32 loc) · 1 KB
/
moveMngr.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using UnityEngine;
using System.Collections;
public class moveMngr : MonoBehaviour {
public CrankyRigidBodyController script;
void OnCollisionEnter (Collision collision) {
if (collision.gameObject.GetComponent<Renderer> ().material.color == Color.blue) {
movement_blue ();
} else if (collision.gameObject.GetComponent<Renderer> ().material.color == Color.green) {
movement_green ();
} else if (collision.gameObject.GetComponent<Renderer> ().material.color == Color.magenta) {
movement_magenta ();
}
}
void OnCollisionExit (Collision collision) {
movement_exit ();
}
public void movement_blue () {
script.enabled = false;
}
public void movement_green () {
this.GetComponent<Rigidbody> ().constraints = RigidbodyConstraints.FreezeAll;
}
public void movement_magenta () {
script.MovementSpeed = 700.0f;
}
public void movement_exit()
{
script.enabled = true;
script.MovementSpeed = 7.0f;
this.GetComponent<Rigidbody> ().constraints = RigidbodyConstraints.FreezeRotation;
}
}