void Start()
 {
     if (Application.isPlaying)
     {
         instance = this;
         StartCoroutine("CreateSnapshot");
         RewinderSnapshot.MaxSnapshots = MaxSnapshots;
     }
 }
示例#2
0
 void Start()
 {
     photonView      = GetComponent <PhotonView>();
     snapshotCreator = GetComponent <RewinderSnapshotCreator>();
     if (photonView.isMine)
     {
         hitboxGroup = GetComponent <RewinderHitboxGroup>();
         RewinderSnapshot.RegisterGroup(hitboxGroup);
         if (snapshotCreator != null)
         {
             snapshotCreator.NewSnapshot += HandleNewSnapshot;
         }
     }
     else
     {
         if (snapshotCreator != null)
         {
             snapshotCreator.enabled = false;
         }
     }
 }
示例#3
0
    public override void OnInspectorGUI()
    {
        RewinderSnapshotCreator creator = target as RewinderSnapshotCreator;

        if (creator != null)
        {
            creator.FrameType             = (RewinderSnapshotCreator.FrameTypes)EditorGUILayout.EnumPopup("Snapshot on ", creator.FrameType);
            creator.SnapshotEveryNthFrame = EditorGUILayout.IntField("Snapshot interval", creator.SnapshotEveryNthFrame);
            creator.RaiseEveryNthSnapshot = EditorGUILayout.IntField("Event interval", creator.RaiseEveryNthSnapshot);
            creator.MaxSnapshots          = RewinderSnapshot.MaxSnapshots = EditorGUILayout.IntSlider("Max snapshots", creator.MaxSnapshots, 2, 2048);

            if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("Snapshots in memory", RewinderSnapshot.Count.ToString());
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(creator);
        }
    }