-
Notifications
You must be signed in to change notification settings - Fork 0
/
grabityPoint.cs
43 lines (38 loc) · 888 Bytes
/
grabityPoint.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
41
42
43
using UnityEngine;
using System.Collections;
public class grabityPoint : MonoBehaviour {
private bool isSelected;
// Use this for initialization
void Start () {
isSelected = false;
}
// Update is called once per frame
void Update () {
if(isSelected){
this.transform.Rotate(1,2,3);
GameObject[] gos = GameObject.FindGameObjectsWithTag("Player");
foreach( GameObject go in gos ){
go.SendMessage("sweepTo",this.gameObject.transform.position);
}
}
}
void OnMouseDown () {
#if false
isSelected = !isSelected;
#else
if(!isSelected){
isSelected = true;
GameObject[] gos = GameObject.FindGameObjectsWithTag("GravityPoint");
foreach( GameObject go in gos ){
if (go != this.gameObject){
go.SendMessage("unselect");
}
}
}
#endif
}
public void unselect () {
isSelected = false;
transform.rotation = Quaternion.identity;
}
}