public void UpdateRival(OSCErgDataEvent ergEvent)
    {
        if (rivals == null)
        {
            return;
        }
        print("UpdateRival index1 " + ergEvent.senderId);
        print("UpdateRival index2 " + rivals);
        GameObject     rival          = rivals[ergEvent.senderId];
        PhysicsManager physicsManager = physicsManagers[ergEvent.senderId];
        Rigidbody      rigidBody      = rival.GetComponent <Rigidbody>();
        float          v = rigidBody.velocity.x;
        float          x = rigidBody.position.x;
        // float z = ergEvent.senderId * 2.0f;

        ErgData e = new ErgData();

        e.Copy(ergEvent.ergData);
        e.distance = ergEvent.segment.getProgressedDistance(ergEvent.ergData);
        print("UpdateRival p Distance " + e.distance);
        if (e.distance < 0.1 && e.distance > -0.1)
        {
            physicsManager.ResetLocation();
        }

        InteroBody1D body = physicsManager.UpdateLocation(x, v, e);

        rigidBody.velocity = new Vector3(body.velocity, rigidBody.velocity.y, rigidBody.velocity.z);
        rigidBody.position = new Vector3(body.distance, rigidBody.position.y, rigidBody.position.z);
    }
Exemple #2
0
 void IListenerOSC.OnOSCErgDataEvent(OSCErgDataEvent ergEvent)
 {
     textOutUser[ergEvent.senderId].text = name + " " + ergEvent.socketSender.username + " " + ergEvent.ergData;
     // print(name + " Ergata " + ergEvent.senderId);
     server.BroadcastToClients(ergEvent.socketSender.username, ergEvent.ergData, ergEvent.segment, ergEvent.senderId);
     // print(name + " " + ergEvent.ergData + " ss " + ergEvent.segment.index + " s " + ergEvent.segment.startDistance);
 }
    void IListenerOSC.OnOSCErgDataEvent(OSCErgDataEvent ergEvent)
    {
        return;

        string  username = ergEvent.socketSender.username;
        ErgData e        = ergEvent.ergData;
        Segment s        = ergEvent.segment;
        float   d        = s.getProgressedDistance(e);

        print(username + " xx OSC " + ergEvent.ergData + "|" + d);
        leaderboard.UpdateRank(username, d, e, s);
        // rivalController.UpdateRival(ergEvent);
    }
Exemple #4
0
 void IListenerOSC.OnOSCErgDataEvent(OSCErgDataEvent ergEvent)
 {
     //print("OnOSCErgDataEvent " + ergEvent.ergData);
 }