Beispiel #1
0
    void GetLocalData(InputDataBase playerInputData)
    {
        FrameSyncInput.CurrentInputData = (InputData)playerInputData;

        if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
        {
            List <FrameSyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
            for (int index = 0, length = managedBehavioursByPlayer.Count; index < length; index++)
            {
                FrameSyncManagedBehaviour bh = managedBehavioursByPlayer[index];

                if (bh != null && !bh.disabled)
                {
                    bh.OnSyncedInput();
                }
            }
        }

        FrameSyncInput.CurrentInputData = null;
    }
    void OnStepUpdate(List <InputDataBase> allInputData)
    {
        FrameSyncInput.SetAllInputs(allInputData);

        FrameSyncInput.CurrentSimulationData = null;


        for (int index = 0; index < mapManagedBehaviors.Count; index++)
        {
            FrameSyncManagedBehaviour bh = mapManagedBehaviors[index].Value;

            if (bh != null && !bh.disabled)
            {
                bh.OnSyncedUpdate();
            }
        }

        for (int index = 0, length = allInputData.Count; index < length; index++)
        {
            InputDataBase playerInputData = allInputData[index];

            if (behaviorsByPlayer.ContainsKey(playerInputData.ownerID))
            {
                FrameSyncInput.CurrentSimulationData = (InputData)playerInputData;

                List <FrameSyncManagedBehaviour> managedBehavioursByPlayer = behaviorsByPlayer[playerInputData.ownerID];
                for (int index2 = 0, length2 = managedBehavioursByPlayer.Count; index2 < length2; index2++)
                {
                    FrameSyncManagedBehaviour bh = managedBehavioursByPlayer[index2];

                    if (bh != null && !bh.disabled)
                    {
                        bh.OnSyncedUpdate();
                    }
                }
            }

            FrameSyncInput.CurrentSimulationData = null;
        }
    }