Ejemplo n.º 1
0
    void CmdAcceptConnection(GameObject start, GameObject end, string strength, bool isExcitatory)
    {
        GameObject con;

        if (isExcitatory)
        {
            con = Instantiate(excitatoryConnectionPrefab);
        }
        else
        {
            con = Instantiate(inhibitoryConnectionPrefab);
        }
        float str;

        if (float.TryParse(strength, out str))
        {
            con.GetComponent <Connection>().connectionStrength = str;
        }
        else
        {
            //Use dummy strength.  Note: not sure if needed.
            con.GetComponent <Connection>().connectionStrength = 1;
        }
        con.name = "Connection: " + start.name + "->" + end.name;
        con.transform.SetParent(GameObject.Find("NewNetworkManager").transform);
        NetworkServer.Spawn(con);
        con.GetComponent <Connection>().SetPoints(start, end);
        GameSave.ConnectionMade(con.GetComponent <Connection>());
        RpcSpawnConnection(start, end, con, str);
    }