Esempio n. 1
0
 public void ProxyObjectExit(GameObject oldProxy)
 {
     if (proxyObject == oldProxy)
     {
         proxyObject = null;
         proxyType   = ProxyObjectType.NONE;
         CursorScript.RemoveCursors();
     }
 }
Esempio n. 2
0
    public void SelectNewProxyObject(GameObject newProxy)
    {
        //if the current proxy object is null, the new proxy object becomes the current proxy object
        if (!proxyObject)
        {
            proxyObject = newProxy;
            CursorScript.CreateNewCursor(proxyObject.transform.position, cursorPrefab);
        }
        else
        {
            float currentDistance = (proxyObject.transform.position - transform.position).magnitude;
            float newDistance     = (newProxy.transform.position - transform.position).magnitude;

            if (currentDistance < newDistance)
            {
                proxyObject = newProxy;
                CursorScript.CreateNewCursor(proxyObject.transform.position, cursorPrefab);
            }
        }

        //select the correct type of proxy object
        switch (proxyObject.tag.ToUpper())
        {
        case "DOOR":
            proxyType = ProxyObjectType.DOOR;
            break;

        case "LEVER":
            proxyType = ProxyObjectType.LEVER;
            break;

        case "TELEPORTER":
            proxyType = ProxyObjectType.TELEPORTER;
            break;

        case "GRABPOINT":
            proxyType = ProxyObjectType.GRABPOINT;
            break;

        default:
            proxyType = ProxyObjectType.NONE;
            break;
        }
    }