World.ToyWorldCore.AutoupdateRegister.Register C# (CSharp) Method

Register() public method

public Register ( IAutoupdateableGameActor actor, int timePeriod = 1 ) : void
actor IAutoupdateableGameActor
timePeriod int
return void
        public void Register(IAutoupdateableGameActor actor, int timePeriod = 1)
        {
            if (actor == null)
                throw new ArgumentNullException("actor");
            if (timePeriod <= 0)
                throw new ArgumentOutOfRangeException("timePeriod", "Update period has to be larger than zero.");
            Contract.EndContractBlock();

            m_register[timePeriod].Add(actor);
        }

Usage Example

        public void TestRegisterForThisStepThrows()
        {
            AutoupdateRegister register = new AutoupdateRegister();
            Mock<IAutoupdateableGameActor> mock = new Mock<IAutoupdateableGameActor>();

            Assert.Throws<ArgumentOutOfRangeException>(() => register.Register(mock.Object, 0));
        }
All Usage Examples Of World.ToyWorldCore.AutoupdateRegister::Register