-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPartyManagerStand.cs
38 lines (31 loc) · 985 Bytes
/
PartyManagerStand.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
using UnityEngine;
using System.Collections;
public class PartyManagerStand : MonoBehaviour {
private PartyManager partyManager;
private GameController gameController;
// Use this for initialization
void Awake ()
{
GameObject gc = GameObject.FindGameObjectWithTag("GameController");
partyManager = gc.GetComponent<PartyManager>();
gameController = gc.GetComponent<GameController>();
}
void OnMouseUp ()
{
float distanceMin = 6.0f;
bool withinRange = false;
foreach (GameObject go in gameController.players)
{
float distanceToGo = Vector3.Distance(gameObject.transform.position, go.transform.position);
if (distanceToGo < distanceMin)
{
withinRange = true;
}
}
if (withinRange == true)
{
partyManager.enabled = true;
}
Debug.Log("Up");
}
}