public void AddTraitToMirrorTest() { TraitStub trait1 = new TraitStub(); FrozenTraitStore traits = new TraitStore() { trait1 } .Freeze(); GameObject gameObject = new GameObject(traits: traits); GameObject gameObject2 = new GameObject(traits: traits); TraitStub2 trait2 = new TraitStub2(); gameObject2.AddTrait(trait2); Assert.That(gameObject.Is <TraitStub>()); Assert.That(!gameObject.Is <TraitStub2>()); Assert.That(gameObject2.Is <TraitStub>()); Assert.That(gameObject2.Is <TraitStub2>()); }
public void RemoveTrait() { FrozenTraitStore initialTraits = new TraitStore() { new TraitStub { traitProperty = 10 } } .Freeze(); GameObject item = new GameObject(traits: initialTraits); GameObject item2 = new GameObject(traits: initialTraits); item.RemoveTrait <TraitStub>(); Assert.IsNull(item.As <TraitStub>()); Assert.AreEqual(10, item2.As <TraitStub>() !.traitProperty); }
void Start() { playerTraitStore = GameObject.FindGameObjectWithTag("Player").GetComponent <TraitStore>(); commitButton.onClick.AddListener(playerTraitStore.Commit); }
void Start() { playerTraitStore = GameObject.FindGameObjectWithTag("Player").GetComponent <TraitStore>(); minusButton.onClick.AddListener(() => Allocate(-1)); plusButton.onClick.AddListener(() => Allocate(1)); }