Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() == typeof(ConnectionFile))
            {
                ConnectionFile file = (ConnectionFile)obj;
                if (!file.GetStart()[0].Equals(startTable))
                {
                    return(false);
                }
                if (!file.GetStart()[1].Equals(startSeat))
                {
                    return(false);
                }
                if (!file.GetEnd()[0].Equals(endTable))
                {
                    return(false);
                }
                if (!file.GetEnd()[1].Equals(endSeat))
                {
                    return(false);
                }
                if (!file.GetStrength().Equals(GetStrength()))
                {
                    return(false);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
    //Helper method to spawn connections based on given connection file
    private static void SpawnConnection(ConnectionFile file)
    {
        //Find start and end gameObjects
        GameObject start = null, end = null;

        foreach (NeuronDesignation nd in loadedPlayers)
        {
            //Find start
            if (nd.isGivenNeuron(file.GetStart()[0], file.GetStart()[1]))
            {
                start = nd.GetObject();
            }
            //Find end
            else if (nd.isGivenNeuron(file.GetEnd()[0], file.GetEnd()[1]))
            {
                end = nd.GetObject();
            }
        }
        bool excitatory;

        if (file.GetStrength() > 0)
        {
            excitatory = true;
        }
        else
        {
            excitatory = false;
        }
        if (start && end)
        {
            GameObject player = NetworkManager.singleton.client.connection.playerControllers[0].gameObject;
            player.GetComponent <ConnectionManager>().AcceptConnection(start, end, file.GetStrength().ToString(), excitatory);
        }
    }