Example #1
0
        private void Awake()
        {
            authorityArbiter = new AuthorityArbiter();

            gameObject.AddComponent <BeforeFixedUpdate>().OnBeforeFixedUpdate += OnBeforeFrame;
            gameObject.AddComponent <AfterFixedUpdate>().OnAfterFixedUpdate   += OnAfterFrame;
        }
Example #2
0
        // TODO: Allow authority arbiter to be null, or replace with interface.
        // If it is not present, all objects should be permitted to write state fields.
        public void Initialize(AuthorityArbiter authorityArbiter)
        {
            statefulObjects = new Dictionary <int, StatefulObject>();

            foreach (StatefulObject statefulObject in FindObjectsOfType <StatefulObject>())
            {
                Add(statefulObject, true);
            }

            this.authorityArbiter = authorityArbiter;

            OnInitialize?.Invoke();
        }