コード例 #1
0
    // when they press the New Route button, we start into the adding route nodes.
    public void BT_NewRoute()
    {
        // we also spawn a new route at the feet of whichever player is currently active.
        int actInd = cSelector.FGetActivePlayerIndex();

        if (actInd == -1)
        {
            Debug.Log("Problem, no player active");
            return;
        }

        PE_Route[] oldRoutes = FindObjectsOfType <PE_Route>();
        for (int i = 0; i < oldRoutes.Length; i++)
        {
            if (oldRoutes[i].mTag == cSelector.rGuys[actInd].GetComponent <PE_Role>().mTag)
            {
                oldRoutes[i].FDestroySelf();
                break;
            }
        }

        mState = ROUTE_TOOL_STATE.SOPENED;

        mCurRoute        = Instantiate(PF_RouteObj, cSelector.rGuys[actInd].transform.position, transform.rotation);
        mCurRoute.mNodes = new List <GameObject>();

        SpawnPoint(cSelector.rGuys[actInd].transform.position);
    }
コード例 #2
0
 // save the current route to the disk.
 public void BT_RouteNamed()
 {
     Debug.Log("BT_ROuteNamed");
     if (mState != ROUTE_TOOL_STATE.SSAVING)
     {
         Debug.Log("Woah, not in saving state");
         return;
     }
     // If the route already exists, then we ask them if they want to overwrite.
     if (IO_RouteList.FCHECK_ROUTE_EXISTS(rRouteNamingUI.rRouteName.text))
     {
         rOverwriteRouteUI.SetActive(true);
     }
     else
     {
         if (SaveRoute() == false)
         {
             Debug.Log("Error saving route");
         }
         else
         {
             mState = ROUTE_TOOL_STATE.SCLOSED;
         }
     }
 }
コード例 #3
0
    public void BT_Cancel()
    {
        Debug.Log("Canceling Route");
        // get rid of the current route and clean up.
        mCurRoute.FDestroySelf();

        mState = ROUTE_TOOL_STATE.SCLOSED;
    }
コード例 #4
0
    void Start()
    {
        cSelector = GetComponent <PE_Selector>();

        mState = ROUTE_TOOL_STATE.SCLOSED;
    }
コード例 #5
0
 // Just opens up the name route menu.
 public void BT_Save()
 {
     mState = ROUTE_TOOL_STATE.SSAVING;
 }