public void EndInit() { if (!DesignMode) { Animotion.Attach(this); } }
private void CombineMove(KimbokoCombine combien, MoveAbilityEventInfo movInfo) { IMoveCommand moveCommand = new IMoveCommand(movInfo, game); Invoker.AddNewCommand(moveCommand); Invoker.ExecuteCommands(); Vector3 startPosition = movInfo.fromTile.GetRealWorldLocation(); Vector3 endPosition = movInfo.endPosition.GetRealWorldLocation(); GameObject[] goToMove = new GameObject[combien.kimbokos.Count]; for (int i = 0; i < goToMove.Length; i++) { goToMove[i] = combien.kimbokos[i].goAnimContainer.GetGameObject(); } //Motion combineMoveMotion = moveManagerUI.CombineMoveMotion(startPosition, endPosition, goToMove); //InvokerMotion.AddNewMotion(combineMoveMotion); //InvokerMotion.StartExecution(game); Animotion combineMoveMotion = moveManagerUI.CombineMoveAnimotion(startPosition, endPosition, goToMove); InvokerAnimotion.AddNewMotion(combineMoveMotion); InvokerAnimotion.StartExecution(game); }
private void ExecuteNormalSpawn(SpawnAbility spawnAbility, SpawnAbilityEventInfo spwInf) { spawnAbility.SetRequireGameData(spwInf); StartPerform(spawnAbility); if (spawnAbility.CanIExecute() == false) { if (debugOn) { Debug.Log("SPAWN ABILITY NO SE PUEDE EJECUTAR"); } return; } GameObject goKimboko = spawnManagerUI.GetKimbokoPrefab(); ISpawnCommand spawnCommand = new ISpawnCommand(spwInf, goKimboko, game); Invoker.AddNewCommand(spawnCommand); Invoker.ExecuteCommands(); Vector3 spawnPosition = spwInf.spawnTile.GetRealWorldLocation(); //Motion normalSpawnMotion = spawnManagerUI.NormalSpawn(spawnPosition, goKimboko); //InvokerMotion.AddNewMotion(normalSpawnMotion); //InvokerMotion.StartExecution(spawnManagerUI); Animotion normalSpawnMotion = spawnManagerUI.NormalSpawnAnimotion(spawnPosition, goKimboko); InvokerAnimotion.AddNewMotion(normalSpawnMotion); InvokerAnimotion.StartExecution(spawnManagerUI); Perform(spawnAbility); EndPerform(spawnAbility); spawnIndexID++; }
public static void RemoveMotion(Animotion motion) { motionsToExecute.Remove(motion); if (logOn) { Debug.Log("MOTION REMOVED"); } }
public static void AddNewMotion(Animotion motion) { motionsToExecute.Add(motion); if (logOn) { Debug.Log("NEW MOTION ADDED"); } }
public void EndInit() { if (!DesignMode) { OnInputTagChanged(); Animotion.Attach(this); } }
public void OnCardWaitForTargetSelection(Transform cardTransform) { //Motion twaitMotion = cardManagerUI.OnCardWaitingTarget(cardTransform); //InvokerMotion.AddNewMotion(twaitMotion); //InvokerMotion.StartExecution(cardManagerUI); Animotion twaitMotion = cardManagerUI.OnCardWaitingTargetAnimotion(cardTransform); InvokerAnimotion.AddNewMotion(twaitMotion); InvokerAnimotion.StartExecution(cardManagerUI); }
public static IEnumerator ExecuteMotion() { isExecuting = true; while (isExecuting) { // SI ESTA EJECUTANDO ENTONCES ESPERAMOS if (motionController.IsPerforming) { if (logOn) { Debug.Log("IS PERFORMING"); } yield return(null); } else { // SI NO HAY MAS MOTIONS QUE EXECUTE ENTONCES TERMINAMOS if (motionsToExecute.Count == 0) { if (logOn) { Debug.Log("ACTUAL MOTION HAS FINISH"); } isExecuting = false; } else { // SI NO ESTA EJECUTANDO, EJECUTAMOS Animotion motionToExecute = motionsToExecute[0]; ReproduceMotion(motionToExecute); RemoveMotion(motionsToExecute[0]); yield return(null); } } } if (logOn) { Debug.Log("ALL MOTIONS FINISH"); } if (motionsToExecute.Count > 0) { if (logOn) { Debug.Log("SE AGREGO UNA MOTION DESPUES DE FINALIZAR"); } } }
public void SendCardToGraveyard(TakeCardAbilityEventInfo tkeCardInfo, RectTransform cardRect) { ISendCardToGraveyardCommand destroyCardCmd = new ISendCardToGraveyardCommand(tkeCardInfo.cardTaker, tkeCardInfo.card); Invoker.AddNewCommand(destroyCardCmd); Invoker.ExecuteCommands(); //Motion sendToGraveyardMotion = cardManagerUI.OnCardSendToGraveyard(cardRect, tkeCardInfo.cardTaker.PlayerID); //InvokerMotion.AddNewMotion(sendToGraveyardMotion); //InvokerMotion.StartExecution(cardManagerUI); Animotion sendToGraveyardMotion = cardManagerUI.OnCardSendToGraveyardAnimotion(cardRect, tkeCardInfo.cardTaker.OwnerPlayerID); InvokerAnimotion.AddNewMotion(sendToGraveyardMotion); InvokerAnimotion.StartExecution(cardManagerUI); }
public void ExecuteNormalCombine(CombineAbility combineAbility, CombineAbilityEventInfo cmbInfo) { combineAbility.SetRequireGameData(cmbInfo); StartPerform(combineAbility); if (combineAbility.CanIExecute() == false) { if (debugOn) { Debug.Log("COMBINE ABILITY NO SE PUEDE EJECUTAR"); } return; } ICombineCommand combineCommand = new ICombineCommand(cmbInfo, game); Invoker.AddNewCommand(combineCommand); Invoker.ExecuteCommands(); Vector3 spawnPosition = game.board2DManager.GetUnitPosition(cmbInfo.combiner).GetRealWorldLocation(); List <GameObject> combinersGO = new List <GameObject>(); if (cmbInfo.combiner.UnitType == UNITTYPE.COMBINE) { KimbokoCombine kimbComb = (KimbokoCombine)cmbInfo.combiner; for (int i = 0; i < kimbComb.kimbokos.Count; i++) { combinersGO.Add(kimbComb.kimbokos[i].goAnimContainer.GetGameObject()); } } else { combinersGO.Add(cmbInfo.combiner.goAnimContainer.GetGameObject()); } //Motion combineMoveMotion = combineManagerUI.NormalCombineMotion(spawnPosition, cmbInfo.kimbokoToCombine.goAnimContainer.GetGameObject(), combinersGO, game); //InvokerMotion.AddNewMotion(combineMoveMotion); //InvokerMotion.StartExecution(combineManagerUI); Animotion combineMoveMotion = combineManagerUI.NormalCombineAnimotion(spawnPosition, cmbInfo.kimbokoToCombine.goAnimContainer.GetGameObject(), combinersGO, game); InvokerAnimotion.AddNewMotion(combineMoveMotion); InvokerAnimotion.StartExecution(combineManagerUI); Perform(combineAbility); EndPerform(combineAbility); }
private void NormalMove(MoveAbilityEventInfo movInfo) { IMoveCommand moveCommand = new IMoveCommand(movInfo, game); Invoker.AddNewCommand(moveCommand); Invoker.ExecuteCommands(); Vector3 endPosition = movInfo.endPosition.GetRealWorldLocation(); //Motion normalMoveMotion = moveManagerUI.MoveMotion(movInfo.moveOccupy.goAnimContainer.GetGameObject(), endPosition); //InvokerMotion.AddNewMotion(normalMoveMotion); //InvokerMotion.StartExecution(game); Animotion normalMoveMotion = moveManagerUI.MoveAnimotion(movInfo.moveOccupy.goAnimContainer.GetGameObject(), endPosition); InvokerAnimotion.AddNewMotion(normalMoveMotion); InvokerAnimotion.StartExecution(game); }
public override void OnUpdate() { if (HaveReachCondition()) { //PositionerDemo.Motion bannerMotion = gmMachine.informationUIManager.SetAndShowBanner("TURN STATE", 0.5f); //InvokerMotion.AddNewMotion(bannerMotion); //InvokerMotion.StartExecution(gmMachine); Animotion bannerMotion = gmMachine.informationUIManager.SetAndShowBannerAnimotion("TURN STATE", 0.5f); InvokerAnimotion.AddNewMotion(bannerMotion); InvokerAnimotion.StartExecution(gmMachine); TurnState turnState = new TurnState(60, gmMachine); IState changePhaseState = new ChangePhaseState(gmMachine, turnState); OnNextState(changePhaseState); } base.OnUpdate(); }
public override void OnUpdate() { if (HaveReachCondition()) { AdministrationState adminState = new AdministrationState(20, gmMachine, 1); //Motion bannerMotion = gmMachine.informationUIManager.SetAndShowBanner(adminState.stateName, 0.5f); //InvokerMotion.AddNewMotion(bannerMotion); //InvokerMotion.StartExecution(gmMachine); Animotion bannerMotion = gmMachine.informationUIManager.SetAndShowBannerAnimotion(adminState.stateName, 0.5f); InvokerAnimotion.AddNewMotion(bannerMotion); InvokerAnimotion.StartExecution(gmMachine); IState changePhaseState = new ChangePhaseState(gmMachine, adminState); OnNextState(changePhaseState); //OnNextState(adminState); } base.OnUpdate(); }
public override void OnUpdate() { if (logOn) { Debug.Log("IN STATE " + stateName); } if (HaveReachCondition()) { //PositionerDemo.Motion bannerMotion = gmMachine.informationUIManager.SetAndShowBanner(nextState.stateName, 0.5f); //InvokerMotion.AddNewMotion(bannerMotion); //InvokerMotion.StartExecution(gmMachine); Animotion bannerMotion = gmMachine.informationUIManager.SetAndShowBannerAnimotion(nextState.stateName, 0.5f); InvokerAnimotion.AddNewMotion(bannerMotion); InvokerAnimotion.StartExecution(gmMachine); IState changePhaseState = new ChangePhaseState(gmMachine, nextState); OnNextState(changePhaseState); } gameTimer.RestTime(); }
private void TakeCardFromDeck(TakeCardAbilityEventInfo tkeCardInfo) { IAddCardCommand addCardCmd = new IAddCardCommand(tkeCardInfo.cardTaker, tkeCardInfo.card); Invoker.AddNewCommand(addCardCmd); Invoker.ExecuteCommands(); GameObject cardGo = cardManagerUI.CreateNewCardPrefab(tkeCardInfo.card, tkeCardInfo.cardTaker.OwnerPlayerID, this); //Motion takeCardMotion = cardManagerUI.AddCard(cardGo, tkeCardInfo.cardTaker.PlayerID); //InvokerMotion.AddNewMotion(takeCardMotion); //InvokerMotion.StartExecution(cardManagerUI); Animotion takeCardMotion = cardManagerUI.AddCardAnimotion(cardGo, tkeCardInfo.cardTaker.OwnerPlayerID); InvokerAnimotion.AddNewMotion(takeCardMotion); InvokerAnimotion.StartExecution(cardManagerUI); // ENTRAMOS EN ESTE ESTADO PARA PODER TOMAR LA CARD Y SOLO VER LA ANIMACION TakeCardState spawn = new TakeCardState(game, game.baseStateMachine.currentState); game.baseStateMachine.PopState(true); game.baseStateMachine.PushState(spawn); }
public IEnumerator InitializeGame() { // ACA DEBERIA RECIBIR LA CONFIGURATION DATA DE CADA UNO // UNA VEZ QUE MIRROR ME DIGA "OK HERMANO", LOS DOS JUGADORES MANDARON SU CONFIGURATION DATA // ENTONCES AHI PUEDO VENIR A INITIALIZE GAME Y COMPROBAR LA PARTE DE FIREBASE Y SUS CONEXIONES // 0d- CHEQUEAR QUE LA BASE DE DATOS ESTE INITIALIZED //yield return WaitForDatabaseToLoad(); // REACTIVAR CUANDO FUNCIONE BIEN LA DB // 0- CHEQUEAR QUE LOS DOS JUGADORES ESTEN EN LINEA Y LISTOS PARA JUGAR. // 0b- CHEQUEAR QUE LOS DOS JUGADORES EXISTAN // 4- CARGAR EL DECK SELECCIONADO DE CADA JUGADOR // 4b- CHEQUEAR QUE SEA UN DECK VALIDO // 4c- SI ES INVALIDO SACAMOS TODO A LA MIERDA, SI ES VALID CREAMOS LOS DECKS DE CADA PLAYER // CREATE PLAYERS STATE // 1 - CREAR PLAYERS Y USERS // 0c- SEGUN EL JUGADOR QUE HAYA CREADO LA PARTIDA ESE SERA EL PLAYER ONE, NO SIGNIFICA QUE VA A EMPEZAR PRIMERO playerManager = new PlayerManager(); playerManager.CreatePlayers(); playerManager.CreateNewUser(null); // CREATE BOARD STATE // 3- IR CREANDO EL BOARD board2DManager = new Board2DManager(board2DManagerUI, 5, 7); //Motion motion = board2DManager.CreateBoard(playerManager.GetPlayer(), OnBoardComplete); //InvokerMotion.AddNewMotion(motion); //InvokerMotion.StartExecution(this); Animotion motion = board2DManager.CreateBoardAnimotion(playerManager.GetPlayer(), OnBoardComplete); InvokerAnimotion.AddNewMotion(motion); InvokerAnimotion.StartExecution(this); // CREATE TURNS STATE => ESTO LO DEBERIA HACER EL SERVER PARA QUE NO LO HAGA CADA JUGADOR Y SE PUEDE HACKEAR // 2- ASIGNAR LOS PLAYER AL TURN MANAGER turnController = new TurnController(playerManager.GetPlayer()); // 2b - DECIDIR QUE PLAYER COMIENZA PRIMERO turnController.DecideStarterPlayer(); // CREATE MANAGER STATE // 3b - Inicializar los managers generales ESTOS LOS VA A TENER EL GAME... ASI QUE SEGURO LO HAGAMOS DESDE AHI spawnManager = new SpawnManager(spawnManagerUI, this); combineManager = new CombineManager(this, combineManagerUI); movementManager = new MovementManager(this, moveManagerUI); actionsManager = new ActionsManager(); yield return(null); // LOADCOLLECTIONSTATE => LAS COLLECTION LAS DEBERIA TENER EL SERVER Y PASARSELAS A CADA JUGADOR // 3- CARGAR LA GAME COLLECTION InGameCardCollectionManager inGameCardCollectionManager = new InGameCardCollectionManager(this, OnCardCollectionLoadComplete); //inGameCardCollectionManager.LoadAllCollection(users);// REACTIVAR CUANDO FUNCIONE BIEN LA DB inGameCardCollectionManager.LoadAllCollectionJson(playerManager.GetUsers().ToArray()); while (isCardCollectionLoaded == false) { if (logOn) { Debug.Log("WAITING FOR CARD COLLECTION TO LOAD"); } yield return(null); } if (logOn) { Debug.Log("GAME CARD COLLECTION LOADED"); } // CREATEDECKSTATE cardManager = new CardController(inGameCardCollectionManager, cardManagerUI, this); // VOLVER A ACTIVAR QUE ESTA ES LA FORMA DE CARGAR EL DECK SEGUN LA INFO DE LOS PLAYERS //cardManager.LoadDeckFromConfigurationData(playerManager.GetPlayer()[0], playerManager.playerConfigurationData); //cardManager.LoadDeckFromConfigurationData(playerManager.GetPlayer()[1], playerManager.playerConfigurationData); cardManager.LoadDeckTest(playerManager.GetPlayer()[0]); cardManager.LoadDeckTest(playerManager.GetPlayer()[1]); // WAIT FOR BOARD TO LOAD STATE while (isBoardLoaded == false) { if (logOn) { Debug.Log("WAITING FOR BOARD TO LOAD"); } yield return(null); } // INITIALIZECONTROLLERSTATE // 5 - INICIALIZAMOS LOS CONTROLES mouseController = new MouseController(0, board2DManager, Camera.main); keyBoardController = new KeyBoardController(0, board2DManager, Camera.main); tileSelectionManagerUI.SetController(board2DManager, mouseController, keyBoardController); // STARTGAMESTATE => ACA DEBERIA MANDAR CADA JUGADOR QUE ESTA READY, Y AHI EL SERVER EMITIRIA EL NUEVO STATE PARA CADA UNO // CREAMOS EL STATE INICIAL AdministrationState AdminState = new AdministrationState(10, this, 1); TurnState turnState = new TurnState(50, this); InitialAdministrationStateA initialAdminStateA = new InitialAdministrationStateA(40, this, 4); //Motion bannerMotion = informationUIManager.SetAndShowBanner(initialAdminStateA.stateName, 0.5f); //InvokerMotion.AddNewMotion(bannerMotion); //InvokerMotion.StartExecution(this); //Debug.Log("CREATING BANNER"); Animotion bannerMotion = informationUIManager.SetAndShowBannerAnimotion(initialAdminStateA.stateName, 0.5f); InvokerAnimotion.AddNewMotion(bannerMotion); InvokerAnimotion.StartExecution(this); IState changePhaseState = new ChangePhaseState(this, initialAdminStateA); baseStateMachine = new BaseStateMachine(this); baseStateMachine.PushState(changePhaseState, true); baseStateMachine.Initialize(); // DEBERIA DIVIR PLAYER == BASE NEXUS Y GAME PLAYER == JUGADOR EN SI QUE VA A ENVIAR LOS COMANDOS... // PODRIAMOS TENER UN GAME PLAYER QUE LO UNICA QUE VA A TENER ES UNA ID // ENTONCES CUANDO // game.actionsManager.IncrementPlayerActions(game.turnController.CurrentPlayerTurn, managmentPoints); // ESTO DEBARA CAMBIARSE game.turnController.CurrentPlayerTurn // SI UN JUGADOR APRETA UNA UNIDAD... COMO SABEMOS SI MOSTRAR O NO LA UI DE LOS BOTONES // POR QUE SOLO PODEMOS MOSTRARLA EN TURN STATE, OK, Y SOLO CON UNIDADES NUESTRAS OK // Y SI ACTIVAMOS EL BOTON ENTONCES IGUAL SIEMPRE VAMOS A SER NOSOTROS TECNICAMENTE... // POR QUE EL BOTON SE CREA CON EL OCUPIER O CON EL PLAYER EN ESTE CASO... // // // YA QUE ESTOY ENTRANDO A UN NUEVO STATE game.actionsManager.IncrementPlayerActions LO DEBARIA REALIZAR EL SERVER // // REALIZA SI O SI JUGADOR //// 1 - SUSCRIBIRSE AL EVENTO DE SELECCION ESTO SI LO TIENE QUE HACER EL JUGADOR //gmMachine.tileSelectionManagerUI.onTileSelected += ExecuteAction; //ExecuteAction(Tile action) //if (action == null) //{ // gmMachine.abilityButtonCreationUI.SetUnit(game.turnController.CurrentPlayerTurn); //} // ESTO LO HACE EL SERVER, VUELVE A REAHBILITAR LOS BOTONES DEL JUGADOR PARA SPAWN O TAKE CARD // SOLO JUGADOR YA QUE ES PARA LA UI //// NOS SUSCRIBIMOS AL EVENTO DE CAMBIAR EL TIEMPO //gameTimer.OnTimePass += gmMachine.uiGeneralManagerInGame.UpdateTime; // DEBE REALIZARLO SERVER //// 2 - TENGO QUE SETEAR LOS ACTIONS POINTS PARA ESTE JUGADOR //game.actionsManager.IncrementPlayerActions(game.turnController.CurrentPlayerTurn, managmentPoints); // DEBE REALIZARLO SERVER Y ENVIAR EL END STATE EN TODO CASO //// COMENZAMOS EL CONTADOR DE TIEMPO //base.OnEnter(); // DEBE REALIZARLO SERVER ???? //gmMachine.abilityButtonCreationUI.SetUnit(game.turnController.CurrentPlayerTurn); }
private static void ReproduceMotion(Animotion motion) { motionController.SetUpMotion(motion); motionController.TryReproduceMotion(); }
private void ExecuteSpawnCombine(Kimboko actualCombiner, SpawnAbility spawnAbility, SpawnAbilityEventInfo spwInf) { CombineAbility combineAbility = (CombineAbility)actualCombiner.Abilities[ABILITYTYPE.COMBINE]; if (combineAbility == null) { if (debugOn) { Debug.Log("ERROR HABILIDAD COMBINE NULL"); } return; } Kimboko spawnedKimboko = GetNewKimboko(spwInf); CombineAbilityEventInfo cmbInfo = new CombineAbilityEventInfo(actualCombiner, spawnedKimboko, spwInf.spawnerPlayer, spwInf.spawnIndexID); spawnAbility.SetRequireGameData(spwInf); combineAbility.SetRequireGameData(cmbInfo); StartPerform(spawnAbility); if (spawnAbility.CanIExecute() == false) { if (debugOn) { Debug.Log("SPAWN ABILITY NO SE PUEDE EJECUTAR"); } return; } game.combineManager.StartPerform(combineAbility); // NO VOY A GENERAR ESTE CHEQUEO, YA QUE EL SPAWN GENERA AUTOMATICAMENTE LA COMBINACION //if (combineAbility.CanIExecute() == false) //{ // if (debugOn) Debug.Log("COMBINE ABILITY NO SE PUEDE EJECUTAR"); // return; //} // C - CombineSpawn(Kimboko actualCombiner, SpawnAbilityEventInfo spwInf) GameObject goKimboko = spawnManagerUI.GetKimbokoPrefab(); spawnedKimboko.SetGoAnimContainer(new GameObjectAnimatorContainer(goKimboko, goKimboko.GetComponent <Animator>())); ISpawnCombineCommand spawnCombineCmd = new ISpawnCombineCommand(spawnedKimboko, spwInf, actualCombiner, game); Invoker.AddNewCommand(spawnCombineCmd); Invoker.ExecuteCommands(); Vector3 spawnPosition = spwInf.spawnTile.GetRealWorldLocation(); List <GameObject> combinersGO = new List <GameObject>(); if (actualCombiner.UnitType == UNITTYPE.COMBINE) { KimbokoCombine kimbComb = (KimbokoCombine)actualCombiner; for (int i = 0; i < kimbComb.kimbokos.Count; i++) { combinersGO.Add(kimbComb.kimbokos[i].goAnimContainer.GetGameObject()); } } else { combinersGO.Add(actualCombiner.goAnimContainer.GetGameObject()); } //Motion combineSpawnMotion = spawnManagerUI.CombineSpawn(spawnPosition, goKimboko, combinersGO, game); //InvokerMotion.AddNewMotion(combineSpawnMotion); //InvokerMotion.StartExecution(spawnManagerUI); Animotion combineSpawnMotion = spawnManagerUI.CombineSpawnAnimotion(spawnPosition, goKimboko, combinersGO, game); InvokerAnimotion.AddNewMotion(combineSpawnMotion); InvokerAnimotion.StartExecution(spawnManagerUI); // D - Perform(spawnAbility); // Perform(combineAbility); Perform(spawnAbility); game.combineManager.Perform(combineAbility); // E - EndPerform(spawnAbility); // EndPerform(combineAbility); EndPerform(spawnAbility); game.combineManager.EndPerform(combineAbility); // F - spawnIndexID++; spawnIndexID++; }