public void TestContainerCanAddMultipleAspects() { var container = new Container(); container.AddAspect <TestAspect> ("Test1"); container.AddAspect <TestAspect> ("Test2"); Assert.AreEqual(container.Aspects().Count, 2); }
public void TestContainerCanAddMultipleTypesOfAspects() { var container = new Container(); container.AddAspect <TestAspect> (); container.AddAspect <AltTestAspect> (); Assert.AreEqual(container.Aspects().Count, 2); }
public void AddingMultipleInstancesOfTheSameAspectToContainer_AspectsAreAllAdded() { var container = new Container(); container.AddAspect <TestAspect>("Test1"); container.AddAspect <TestAspect>("Test2"); Assert.AreEqual(container.Aspects.Count, 2); }
public void AddingMultipleTypesOfAspectToContainer_AspectsAreAllAdded() { var container = new Container(); container.AddAspect <TestAspect>(); container.AddAspect <AltTestAspect>(); Assert.AreEqual(container.Aspects.Count, 2); }
void Awake() { gameContainer = GetComponentInParent <GameViewSystem>().container; gameStateMachine = gameContainer.GetAspect <StateMachine>(); container = new Container(); stateMachine = container.AddAspect <StateMachine>(); container.AddAspect(new WaitingForInputState()).owner = this; container.AddAspect(new FinishInputState()).owner = this; container.AddAspect(new CompleteState()).owner = this; stateMachine.ChangeState <WaitingForInputState>(); }
public static Container AddResourceSystems(Container game, ResourceType type) { switch (type) { case ResourceType.Mana: game.AddAspect <ManaSystem>(); break; case ResourceType.Energy: game.AddAspect <EnergySystem>(); break; } return(game); }
public void TestContainerCanAddAspect() { var container = new Container(); container.AddAspect <TestAspect> (); Assert.AreEqual(container.Aspects().Count, 1); }
public void TestAspectTracksItsContainer() { var container = new Container(); var aspect = container.AddAspect <TestAspect> (); Assert.IsNotNull(aspect.container); }
public void AddingAspectToContainer_AspectIsAdded() { var container = new Container(); container.AddAspect <TestAspect>(); Assert.AreEqual(container.Aspects.Count, 1); }
public void TestContainerCanAddPreCreatedAspect() { var container = new Container(); var aspect = new TestAspect(); container.AddAspect <TestAspect> (aspect); Assert.IsNotEmpty(container.Aspects()); }
public void TestContainerCanGetAspectWithKey() { var container = new Container(); var original = container.AddAspect <TestAspect> ("Foo"); var fetch = container.GetAspect <TestAspect> ("Foo"); Assert.AreSame(original, fetch); }
public void AddingPreCreatedAspect_AspectIsAdded() { var container = new Container(); var aspect = new Mock <IAspect>().Object; container.AddAspect(aspect); Assert.IsNotEmpty(container.Aspects); }
public void GettingAspectWithKey_ReturnsCorrectAspect() { var container = new Container(); var original = container.AddAspect <TestAspect>("Test"); var fetch = container.GetAspect <TestAspect>("Test"); Assert.AreSame(original, fetch); }
void Awake() { game = GetComponentInParent <GameViewSystem> ().container; container = new Container(); stateMachine = container.AddAspect <StateMachine> (); container.AddAspect(new WaitingForInputState()).owner = this; container.AddAspect(new ShowPreviewState()).owner = this; container.AddAspect(new ConfirmOrCancelState()).owner = this; container.AddAspect(new CancellingState()).owner = this; container.AddAspect(new ConfirmState()).owner = this; container.AddAspect(new ShowTargetState()).owner = this; container.AddAspect(new TargetState()).owner = this; container.AddAspect(new ResetState()).owner = this; stateMachine.ChangeState <WaitingForInputState> (); }
public void TestContainerCanGetPreCreatedAspect() { var container = new Container(); var original = new TestAspect(); container.AddAspect <TestAspect> (original); var fetch = container.GetAspect <TestAspect> (); Assert.AreSame(original, fetch); }
public static Container Create() { Container game = new Container(); // Add Default Systems game.AddAspect <ActionSystem>(); game.AddAspect <AttackSystem>(); game.AddAspect <DataSystem>(); // Add Other game.AddAspect <StateMachine>(); game.AddAspect <GlobalGameState>(); game = AddPlayerSystems(game, false); game = AddCardSystems(game); game = AddResourceSystems(game, ResourceType.Mana); return(game); }
public void GettingPreCreatedAspect_ReturnsPreCreatedAspect() { var container = new Container(); var original = new Mock <IAspect>().Object; container.AddAspect(original); var fetch = container.GetAspect <IAspect>(); Assert.AreSame(original, fetch); }
public static Container AddCardSystems(Container game) { game.AddAspect <AbilitySystem>(); game.AddAspect <TargetSystem>(); game.AddAspect <CardSystem>(); game.AddAspect <ConsumableCardSystem>(); game.AddAspect <EventCardSystem>(); game.AddAspect <CurseCardSystem>(); game.AddAspect <EquipCardSystem>(); game.AddAspect <PassiveCardSystem>(); return(game); }
public static Container AddPlayerSystems(Container game, bool isPvP) { game.AddAspect <DestructableSystem>(); game.AddAspect <PlayerSystem>(); game.AddAspect <ResourceSystem>(); game.AddAspect <VictorySystem>(); if (isPvP) { game.AddAspect <PvPMatchSystem>(); } else { game.AddAspect <PvEMatchSystem>(); game.AddAspect <DungeonSystem>(); game.AddAspect <LootSystem>(); game.AddAspect <EncounterSystem>(); } return(game); }
public static Container Create() { var game = new Container(); // Add Systems game.AddAspect <ActionSystem>(); game.AddAspect <DataSystem>(); game.AddAspect <DestructableSystem>(); game.AddAspect <MatchSystem>(); game.AddAspect <PlayerSystem>(); game.AddAspect <VictorySystem>(); // Add Others game.AddAspect <StateMachine>(); game.AddAspect <GameState>(); return(game); }
void Awake() { //inputHandler = GetComponentInParent<InputHandler>(); game = GetComponentInParent <GameViewSystem>().Container; gameStateMachine = game.GetAspect <StateMachine>(); container = new Container(); stateMachine = container.AddAspect <StateMachine>(); AddState <WaitingForInputState>(); AddState <ShowTargetState>(); AddState <TargetState>(); AddState <FinishInputState>(); AddState <CompleteState>(); AddState <CancellingState>(); AddState <ResetState>(); stateMachine.ChangeState <WaitingForInputState>(); }
public void ChangeState <T>() where T : class, IState, new() { IState fromState = currentState; T toState = Container.GetAspect <T>() ?? Container.AddAspect <T>(); if (fromState != null) { if (fromState == toState || fromState.CanTransition(toState) == false) { return; } fromState.Exit(); } currentState = toState; previousState = fromState; toState.Enter(); }
public IState ChangeState <T>() where T : class, IState, new() { IState fromState = CurrentState; T toState = Container.GetAspect <T>() ?? Container.AddAspect <T>(); if (fromState != null) { if (fromState == toState || !fromState.CanTransition(toState)) { return(toState); } fromState.Exit(); } CurrentState = toState; PreviousState = fromState; toState.Enter(); return(toState); }
public static Container Create() { Container game = new Container(); //Añade sistemas game.AddAspect <AbilitySystem> (); game.AddAspect <ActionSystem> (); game.AddAspect <AttackSystem> (); game.AddAspect <CardSystem> (); game.AddAspect <CombatantSystem> (); game.AddAspect <DataSystem> (); game.AddAspect <DeathSystem> (); game.AddAspect <DestructableSystem> (); game.AddAspect <EnemySystem> (); game.AddAspect <ManaSystem> (); game.AddAspect <MatchSystem> (); game.AddAspect <MinionSystem> (); game.AddAspect <PlayerSystem> (); game.AddAspect <SpellSystem> (); game.AddAspect <TargetSystem> (); game.AddAspect <TauntSystem> (); game.AddAspect <VictorySystem> (); //Añade estados game.AddAspect <StateMachine> (); game.AddAspect <GlobalGameState> (); return(game); }