示例#1
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() == typeof(SensorConnectionFile))
            {
                SensorConnectionFile file = (SensorConnectionFile)obj;
                if (!file.GetStart().table.Equals(sensorTable))
                {
                    return(false);
                }
                if (!file.GetStart().location.Equals(sensorLocation))
                {
                    return(false);
                }
                if (!file.GetEnd()[0].Equals(endTable))
                {
                    return(false);
                }
                if (!file.GetEnd()[1].Equals(endSeat))
                {
                    return(false);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
    //Helper method to spawn sensor connections based on given connection file
    private static void SpawnConnection(SensorConnectionFile file)
    {
        //Find start and end gameObjects
        GameObject start = null, end = null;

        foreach (NeuronDesignation nd in loadedPlayers)
        {
            //Find end
            if (nd.isGivenNeuron(file.GetEnd()[0], file.GetEnd()[1]))
            {
                end = nd.GetObject();
            }
        }
        foreach (SensorConnector sc in sensors)
        {
            //Find start
            if (sc.table.Equals(file.GetStart().table) && sc.sensor.location.Equals(file.GetStart().location))
            {
                start = sc.gameObject;
            }
        }
        if (start && end)
        {
            GameObject player = NetworkManager.singleton.client.connection.playerControllers[0].gameObject;
            player.GetComponent <ConnectionManager>().SensorConnection(end, start);
        }
    }