private Motion SimpleAttackToCombineMotion(Animator attackerAnimator, List <Animator> damagedAnimator)
        {
            List <Motion> motions = new List <Motion>();
            // PLAY ATTACK ANIMATION
            Motion motionAttack = new AttackMotion(this, attackerAnimator, 1);

            motions.Add(motionAttack);
            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    // ATTACK SOUND
                    Motion motionAttackSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[0], true);
                    motions.Add(motionAttackSound);
                    // DAMAGE SOUND
                    Motion motionDamageSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[2], true);
                    motions.Add(motionDamageSound);
                }
            }
            // PLAY DAMAGE ANIMATION FOR ALL THE ENEMIES
            for (int i = 0; i < damagedAnimator.Count; i++)
            {
                Motion motionDamage = new DamageMotion(this, damagedAnimator[i], 1);
                motions.Add(motionDamage);
            }
            CombineMotion combineAttackMotion = new CombineMotion(this, 1, motions);

            return(combineAttackMotion);
        }
        private Motion SimpleAttackAndDamageMotion(Animator attackerAnimator, Animator damagedAnimator)
        {
            List <Motion> motions = new List <Motion>();
            // PLAY ATTACK ANIMATION
            Motion motionAttack = new AttackMotion(this, attackerAnimator, 1);

            motions.Add(motionAttack);
            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    // ATTACK SOUND
                    Motion motionAttackSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[0], true);
                    motions.Add(motionAttackSound);
                    // DAMAGE SOUND
                    Motion motionDamageSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[2], true);
                    motions.Add(motionDamageSound);
                }
            }
            // PLAY DAMAGE ANIMATION
            Motion motionDamage = new DamageMotion(this, damagedAnimator, 1);

            motions.Add(motionDamage);

            CombineMotion combineAttackMotion = new CombineMotion(this, 1, motions);

            return(combineAttackMotion);
        }
Example #3
0
        public Motion CombineMoveMotion(Vector3 actualPosition, Vector3 endPosition, GameObject[] enemies)
        {
            UnitMovePositioner movePositioner = new UnitMovePositioner(4f);
            Dictionary <GameObject, Vector3[]> enmiesAndPathToMove = movePositioner.GetRoutePositions(enemies, movePositioner.GetPositionType(enemies.Length), endPosition, actualPosition);
            List <Motion> motionsCombineMove = new List <Motion>();

            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    Motion motionMoveSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], false, true);
                    motionsCombineMove.Add(motionMoveSound);
                }
            }

            int index = 0;

            foreach (KeyValuePair <GameObject, Vector3[]> entry in enmiesAndPathToMove)
            {
                AnimatedMotion motionMove = new MoveMotion(this, entry.Key.GetComponent <Animator>(), 1);
                motionsCombineMove.Add(motionMove);

                List <Motion> extraMotionsCombineStopMove = new List <Motion>();
                Motion        motionTweenMove             = new MovePathTweenMotion(this, entry.Key.transform, 1, entry.Value);
                Motion        motionIdlle = new IdlleMotion(this, entry.Key.GetComponent <Animator>(), 2, true);
                extraMotionsCombineStopMove.Add(motionTweenMove);
                extraMotionsCombineStopMove.Add(motionIdlle);

                // esto solo lo hago para detener el sonido de los pasos
                if (enmiesAndPathToMove.Count - 1 == index)
                {
                    List <Configurable> configurables = new List <Configurable>();

                    if (GameSoundManager.Instance != null)
                    {
                        if (GameSoundManager.Instance.audioSource != null)
                        {
                            AudioSourceGenericContainer audioContainer = new AudioSourceGenericContainer(GameSoundManager.Instance.audioSource);
                            StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform> stopSoundConfigureAnimotion
                                = new StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform>(audioContainer, 2);
                            configurables.Add(stopSoundConfigureAnimotion);
                        }
                    }
                    CombineMotion extraCombineMoveStopMotion = new CombineMotion(this, 1, extraMotionsCombineStopMove, configurables);
                    motionsCombineMove.Add(extraCombineMoveStopMotion);
                }
                else
                {
                    CombineMotion extraCombineMoveStopMotion = new CombineMotion(this, 1, extraMotionsCombineStopMove);
                    motionsCombineMove.Add(extraCombineMoveStopMotion);
                }

                index++;
            }

            CombineMotion combinMoveMotion = new CombineMotion(this, 1, motionsCombineMove);

            return(combinMoveMotion);
        }
        public Motion OnCardSendToGraveyard(RectTransform cardRect, int PlayerID)
        {
            Vector3 finalScale = new Vector3(0.2f, 0.2f, 1);

            List <Motion> motionsWaitToGraveyard = new List <Motion>();
            //RectTransform cardRect = cardUI.GetComponent<RectTransform>();
            Motion motionTweenScaleUp = new ScaleRectTweenMotion(this, cardRect, 1, finalScale, 1);

            motionsWaitToGraveyard.Add(motionTweenScaleUp);

            Vector3 finalCardPosition = playerOneGraveyardLogo.position;

            if (PlayerID == 0)
            {
                finalCardPosition = playerOneGraveyardLogo.position;
            }
            else
            {
                finalCardPosition = playerTwoGraveyardLogo.position;
            }

            Motion motionTweenSpawn = new SpawnCardTweenMotion(this, cardRect, 1, finalCardPosition, 2);

            motionsWaitToGraveyard.Add(motionTweenSpawn);

            // tengo que setear el parent
            List <Configurable> configurables = new List <Configurable>();

            RectTransform parentTransform = null;

            if (PlayerID == 0)
            {
                parentTransform = playerOneGraveyard;
            }
            else
            {
                parentTransform = playerTwoGraveyard;
            }

            SetParentConfigureAnimotion <Transform, Transform> cardHandSetParentConfigAnimotion =
                new SetParentConfigureAnimotion <Transform, Transform>(cardRect, parentTransform, 3);

            configurables.Add(cardHandSetParentConfigAnimotion);
            //SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform> blockRayCastConfigAnimotion
            //    = new SetCanvasGroupBlockRaycastConfigureAnimotion<MikzeerGame.CardUI, Transform>(cardUI, GameCreator.Instance.playerOneGraveyard, 4);
            //configurables.Add(blockRayCastConfigAnimotion);
            CombineMotion combineSendToGraveyardMotion = new CombineMotion(this, 1, motionsWaitToGraveyard, configurables);

            return(combineSendToGraveyardMotion);
        }
        private Motion AttackWithShieldMotion(Animator attackerAnimator, Animator damagedAnimator)
        {
            List <Motion>       motions            = new List <Motion>();
            List <Configurable> configureAnimotion = new List <Configurable>();
            // PLAY ATTACK ANIMATION
            Motion motionAttack = new AttackMotion(this, attackerAnimator, 1);

            motions.Add(motionAttack);
            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    // ATTACK SOUND
                    Motion motionAttackSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[0], true);
                    motions.Add(motionAttackSound);
                    // DAMAGE SOUND
                    Motion motionDamageSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[2], true);
                    motions.Add(motionDamageSound);
                }
            }

            // CREAMOS EL SHIELD
            GameObject shield = Instantiate(shieldPrefab, damagedAnimator.transform.position, Quaternion.identity);

            shield.SetActive(true);

            // PLAY DAMAGE ANIMATION
            Motion motionDamage = new DamageMotion(this, damagedAnimator, 1);

            motions.Add(motionDamage);

            List <Motion> shieldMotions      = new List <Motion>();
            Motion        motionShieldDamage = new ShieldMotion(this, shield.GetComponent <Animator>(), 1);

            shieldMotions.Add(motionShieldDamage);
            DestroyGOConfigureAnimotion <Transform, Transform> ShieldDestroyConfigAnimotion
                = new DestroyGOConfigureAnimotion <Transform, Transform>(shield.transform, 2);

            configureAnimotion.Add(ShieldDestroyConfigAnimotion);
            CombineMotion combineShieldMotion = new CombineMotion(this, 1, shieldMotions, configureAnimotion);

            motions.Add(combineShieldMotion);

            CombineMotion combineAttackMotion = new CombineMotion(this, 1, motions);

            return(combineAttackMotion);
        }
Example #6
0
        public Motion CombineSpawn(Vector3 tileObjectRealWorldLocation, GameObject goKimbok, List <GameObject> kimbokos, GameMachine game)
        {
            List <Motion> motionsSpawnCombine = new List <Motion>();

            // A - MOVEMOS A LOS KIMBOKOS QUE OCUPEN LA TILE A LOS COSTADOS
            motionsSpawnCombine.Add(game.combineManagerUI.MoveToSquarePosition(kimbokos, tileObjectRealWorldLocation));
            // B - Motion normalSpawnMotion
            motionsSpawnCombine.Add(NormalSpawn(tileObjectRealWorldLocation, goKimbok));
            // C - REPOSICIONAMOS A TODOS LOS KIMBOKO
            // AGREGO EL KIMBOKO SPAWNEADO A LA LISTA
            kimbokos.Add(goKimbok);
            motionsSpawnCombine.Add(game.combineManagerUI.RearangePositionAfterCombineMotion(kimbokos, tileObjectRealWorldLocation, 2));

            CombineMotion combinMoveMotion = new CombineMotion(this, 1, motionsSpawnCombine);

            return(combinMoveMotion);
        }
Example #7
0
        public Motion MoveMotion(GameObject goKimbok, Vector3 endPosition)
        {
            List <Motion> motionsMove = new List <Motion>();
            Animator      animator    = goKimbok.GetComponent <Animator>();
            Motion        motionMove  = new MoveMotion(this, animator, 1);

            motionsMove.Add(motionMove);

            List <Configurable> configurables = new List <Configurable>();

            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    Motion motionMoveSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], false, true);
                    motionsMove.Add(motionMoveSound);
                    AudioSourceGenericContainer audioContainer = new AudioSourceGenericContainer(GameSoundManager.Instance.audioSource);
                    StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform> stopSoundConfigureAnimotion =
                        new StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform>(audioContainer, 2);
                    configurables.Add(stopSoundConfigureAnimotion);
                }
            }

            List <Motion> motionsStopMove = new List <Motion>();

            Motion motionTweenMove = new MoveTweenMotion(this, goKimbok.transform, 1, endPosition, 1);
            Motion motionIdlle     = new IdlleMotion(this, animator, 2, true);

            motionsStopMove.Add(motionTweenMove);
            motionsStopMove.Add(motionIdlle);

            CombineMotion combineStopMotion = new CombineMotion(this, 1, motionsStopMove, configurables);

            motionsMove.Add(combineStopMotion);

            CombineMotion combinMoveMotion = new CombineMotion(this, 1, motionsMove);

            return(combinMoveMotion);
        }
        public Motion RearangePositionAfterCombineMotion(List <GameObject> kimbokos, Vector3 actualPosition, int reproductionOrder = 1)
        {
            List <Motion>      motionsSpawnCombine = new List <Motion>();
            UnitMovePositioner movePositioner      = new UnitMovePositioner(4f);

            //  - DESPUES ME DEBERIA FIJAR SI TENGO ENEMIGOS EN LA QUE SELECCIONE, Y SI TENGO DEBERIA AGREGAR EL COMANDO DE REPOSICIONARLOS
            if (kimbokos.Count > 1)
            {
                POSITIONTYPE positionTypeToRearrange = movePositioner.GetPositionType(kimbokos.Count);
                Vector3[]    finalRearrangePositions = movePositioner.GetPositions(actualPosition, positionTypeToRearrange);
                // SONIDO DE CUANDO SE MUEVEN PARA REPOSICIONARSE
                if (GameSoundManager.Instance != null)
                {
                    if (GameSoundManager.Instance.audioSource != null)
                    {
                        Motion motionMoveSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], false, true);
                        motionsSpawnCombine.Add(motionMoveSound);
                    }
                }

                // deberia recorrer la lista de unidades, y generar una move comand para posicionarse en el lugar que tiene cada una del cuadrado
                for (int i = 0; i < kimbokos.Count; i++)
                {
                    List <Motion> motionsCombineSpawnMoveSquare = new List <Motion>();
                    int           shortNameHash = Animator.StringToHash("Base Layer" + ".Idlle");
                    Animator      animatorAux   = kimbokos[i].GetComponent <Animator>();
                    // LOS PONGO EN ESTADO MOVE PARA LA ANIMACION
                    Motion motionMove = new MoveMotion(this, animatorAux, 1, false, shortNameHash);
                    //Motion motionMove = new MoveMotion(this, animatorAux, 1);
                    motionsSpawnCombine.Add(motionMove);

                    List <Motion> motionsCombineSpawnStopMoveSquare = new List <Motion>();
                    // LOS MUEVO DESDE DONDE ESTAN HASTA LA POSICION FINAL
                    Motion motionTwMove = new MoveTweenMotion(this, kimbokos[i].transform, 1, finalRearrangePositions[i], 1);
                    motionsCombineSpawnStopMoveSquare.Add(motionTwMove);
                    // LOS PONGO EN ESTADO IDLLE
                    Motion motionIdlle = new IdlleMotion(this, animatorAux, 2, true);
                    motionsCombineSpawnStopMoveSquare.Add(motionIdlle);

                    // esto solo lo hago para detener el sonido de los pasos
                    if (kimbokos.Count - 1 == i)
                    {
                        List <Configurable> configurables = new List <Configurable>();

                        if (GameSoundManager.Instance != null)
                        {
                            if (GameSoundManager.Instance.audioSource != null)
                            {
                                AudioSourceGenericContainer audioContainer = new AudioSourceGenericContainer(GameSoundManager.Instance.audioSource);
                                StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform> stopSoundConfigureAnimotion
                                    = new StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform>(audioContainer, 2);
                                configurables.Add(stopSoundConfigureAnimotion);
                            }
                        }
                        CombineMotion combineStopMotion = new CombineMotion(this, 1, motionsCombineSpawnStopMoveSquare, configurables);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    else
                    {
                        CombineMotion combineStopMotion = new CombineMotion(this, 1, motionsCombineSpawnStopMoveSquare);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    CombineMotion combinSquarePositionMotion = new CombineMotion(this, 1, motionsCombineSpawnMoveSquare);
                    motionsSpawnCombine.Add(combinSquarePositionMotion);
                }
            }
            CombineMotion combinMoveMotion = new CombineMotion(this, reproductionOrder, motionsSpawnCombine);

            return(combinMoveMotion);
        }
        public Motion MoveToSquarePosition(List <GameObject> kimbokos, Vector3 actualPosition)
        {
            List <Motion>      motionsSpawnCombine = new List <Motion>();
            UnitMovePositioner movePositioner      = new UnitMovePositioner(4f);

            // 2 - DESPUES ME DEBERIA FIJAR SI TENGO ENEMIGOS EN LA QUE SELECCIONE, Y SI TENGO DEBERIA AGREGAR EL COMANDO DE REPOSICIONARLOS
            if (kimbokos.Count > 0)
            {
                // AHORA TENGO QUE GENERAR EL CUADRADO DE POSICIONES PARA CADA UNA
                Vector3[] squarePositions = movePositioner.GetPositions(actualPosition, POSITIONTYPE.SQUARE);

                // SONIDO DE CUANDO SE MUEVEN PARA REPOSICIONARSE
                if (GameSoundManager.Instance != null)
                {
                    if (GameSoundManager.Instance.audioSource != null)
                    {
                        Motion motionMoveSound = new SoundMotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], false, true);
                        motionsSpawnCombine.Add(motionMoveSound);
                    }
                }
                // deberia recorrer la lista de unidades, y generar una move comand para posicionarse en el lugar que tiene cada una del cuadrado
                for (int i = 0; i < kimbokos.Count; i++)
                {
                    Animator animatorAux = kimbokos[i].GetComponent <Animator>();


                    List <Motion> motionsCombineSpawnMoveSquare = new List <Motion>();
                    Motion        motionMove = new MoveMotion(this, animatorAux, 1);
                    motionsCombineSpawnMoveSquare.Add(motionMove);

                    List <Motion> motionsCombineSpawnStopMoveSquare = new List <Motion>();
                    Motion        motionTwMove = new MoveTweenMotion(this, kimbokos[i].transform, 1, squarePositions[i], 1);
                    Motion        motionIdlle  = new IdlleMotion(this, animatorAux, 2, true);
                    motionsCombineSpawnStopMoveSquare.Add(motionTwMove);
                    motionsCombineSpawnStopMoveSquare.Add(motionIdlle);

                    // esto solo lo hago para detener el sonido de los pasos
                    if (kimbokos.Count - 1 == i)
                    {
                        List <Configurable> configurables = new List <Configurable>();

                        if (GameSoundManager.Instance != null)
                        {
                            if (GameSoundManager.Instance.audioSource != null)
                            {
                                AudioSourceGenericContainer audioContainer = new AudioSourceGenericContainer(GameSoundManager.Instance.audioSource);
                                StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform> stopSoundConfigureAnimotion
                                    = new StopSoundConfigureAnimotion <AudioSourceGenericContainer, Transform>(audioContainer, 2);
                                configurables.Add(stopSoundConfigureAnimotion);
                            }
                        }
                        CombineMotion combineStopMotion = new CombineMotion(this, 1, motionsCombineSpawnStopMoveSquare, configurables);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    else
                    {
                        CombineMotion combineStopMotion = new CombineMotion(this, 1, motionsCombineSpawnStopMoveSquare);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    CombineMotion combinSquarePositionMotion = new CombineMotion(this, 1, motionsCombineSpawnMoveSquare);
                    motionsSpawnCombine.Add(combinSquarePositionMotion);
                }
            }
            CombineMotion repositionInSquareMotion = new CombineMotion(this, 1, motionsSpawnCombine);

            return(repositionInSquareMotion);
        }
        public Motion CreateNewBoardMotion(Board2DManager board2D, Action OnBoardLoadComplete)
        {
            GameObject[,] tiles = new GameObject[board2D.columnsWidht, board2D.rowsHeight];
            int        index      = 1;
            GameObject tileParent = new GameObject("TileParent");

            List <Motion> motionsCreateBoard = new List <Motion>();

            for (int x = 0; x < board2D.columnsWidht; x++)
            {
                for (int y = 0; y < board2D.rowsHeight; y++)
                {
                    if (x == 0 || x == 1)
                    {
                        tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject;
                        tiles[x, y].transform.SetParent(tileParent.transform);
                        continue;
                    }
                    if (x == 9 || x == 10)
                    {
                        tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject;
                        tiles[x, y].transform.SetParent(tileParent.transform);
                        continue;
                    }

                    Vector3 thisTileFinalPosition = board2D.GetGridObject(x, y).GetRealWorldLocation();

                    tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject;
                    tiles[x, y].transform.position = new Vector3(thisTileFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y, 0);
                    tiles[x, y].transform.SetParent(tileParent.transform);

                    // TWEEN DE LA CRANE A LA POSICION DE SPAWNEO
                    Motion motionTweenMove = new MoveTweenMotion(this, tiles[x, y].transform, index, thisTileFinalPosition, 1);
                    motionsCreateBoard.Add(motionTweenMove);
                }
                index++;
            }

            // para las spawn tiles
            Vector2 yOffset = new Vector2(0, 10);
            Vector3 pOneNexusFinalPosition = board2D.GetPlayerNexusWorldPosition(true);

            tiles[0, 0].transform.position = new Vector3(pOneNexusFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y + yOffset.y, 0);
            Motion motionTweenNexusP1Move = new MoveTweenMotion(this, tiles[0, 0].transform, index, pOneNexusFinalPosition, 1);

            motionsCreateBoard.Add(motionTweenNexusP1Move);

            Vector3 pTwoNexusFinalPosition = board2D.GetPlayerNexusWorldPosition(false);

            tiles[9, 0].transform.position = new Vector3(pTwoNexusFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y + yOffset.y, 0);
            Motion motionTweenNexusP2Move = new MoveTweenMotion(this, tiles[9, 0].transform, index, pTwoNexusFinalPosition, 1);

            motionsCreateBoard.Add(motionTweenNexusP2Move);

            index++;

            List <Configurable>          configurables = new List <Configurable>();
            EventInvokerGenericContainer evenToInvoke  = new EventInvokerGenericContainer(OnBoardLoadComplete);
            InvokeEventConfigureAnimotion <EventInvokerGenericContainer, Transform> onBoardCompleteInvokeEvent =
                new InvokeEventConfigureAnimotion <EventInvokerGenericContainer, Transform>(evenToInvoke, index);

            configurables.Add(onBoardCompleteInvokeEvent);

            CombineMotion combinMoveMotion = new CombineMotion(this, 1, motionsCreateBoard, configurables);

            return(combinMoveMotion);
        }
        public Motion AddCard(GameObject createdCardGameObject, int PlayerID)
        {
            Vector3 normalScale = createdCardGameObject.transform.localScale;
            Vector3 startScale  = new Vector3(0.2f, 0.2f, 1);

            createdCardGameObject.transform.localScale = startScale;

            // hacerla animacion de instanciamiento a la mano y saliendo un poco de la pantalla
            List <Motion> motionsSpawn       = new List <Motion>();
            RectTransform cardRect           = createdCardGameObject.GetComponent <RectTransform>();
            Motion        motionTweenScaleUp = new ScaleRectTweenMotion(this, cardRect, 1, normalScale, 1);

            motionsSpawn.Add(motionTweenScaleUp);

            Vector3 finalCardPosition = Vector3.zero;

            if (PlayerID == 0)
            {
                if (cardHolderPlayerLeft.transform.childCount > 0)
                {
                    finalCardPosition = cardHolderPlayerLeft.GetChild(cardHolderPlayerLeft.childCount - 1).position;
                }
                else
                {
                    finalCardPosition = cardHolderPlayerLeft.position;
                }
            }
            else
            {
                if (cardHolderPlayerRight.transform.childCount > 0)
                {
                    finalCardPosition = cardHolderPlayerRight.GetChild(cardHolderPlayerRight.childCount - 1).position;
                }
                else
                {
                    finalCardPosition = cardHolderPlayerRight.position;
                }
            }

            Motion motionTweenSpawn = new SpawnCardTweenMotion(this, createdCardGameObject.transform, 1, finalCardPosition, 2);

            motionsSpawn.Add(motionTweenSpawn);

            // tengo que setear el parent
            List <Configurable> configurables = new List <Configurable>();

            SetParentConfigureAnimotion <Transform, Transform> cardHandSetParentConfigAnimotion = null;

            if (PlayerID == 0)
            {
                cardHandSetParentConfigAnimotion = new SetParentConfigureAnimotion <Transform, Transform>(createdCardGameObject.transform, cardHolderPlayerLeft, 3);
            }
            else
            {
                cardHandSetParentConfigAnimotion = new SetParentConfigureAnimotion <Transform, Transform>(createdCardGameObject.transform, cardHolderPlayerRight, 3);
            }
            configurables.Add(cardHandSetParentConfigAnimotion);

            CardInGameUINEW cardInGameUI = createdCardGameObject.GetComponent <CardInGameUINEW>();

            // activamos el canvas group para que pueda recibir raycast otra vez
            SetCanvasGroupBlockRaycastConfigureAnimotion <CardInGameUINEW, Transform> blockRayCastConfigAnimotion =
                new SetCanvasGroupBlockRaycastConfigureAnimotion <CardInGameUINEW, Transform>(cardInGameUI, null, 4);

            configurables.Add(blockRayCastConfigAnimotion);

            //Motion motionTimer = new TimeMotion(this, 2, 2f);
            //motionsWaitToGraveyard.Add(motionTimer);

            CombineMotion combineMoveMotion = new CombineMotion(this, 1, motionsSpawn, configurables);

            return(combineMoveMotion);
        }
Example #12
0
        public Motion NormalSpawn(Vector3 tileObjectRealWorldLocation, GameObject goKimbok)
        {
            List <Motion>       motionsSpawn       = new List <Motion>();
            List <Configurable> configureAnimotion = new List <Configurable>();

            // POSICION INICIAL Y FINAL DE LA GRUA PARA TWEENEAR
            Vector3 craneStartPosition;
            Vector3 craneEndPostion;

            //B TWEEN DESDE UNA POSICION ELEVADA SOBRE LA TILE DONDE SE INDICO SPAWNEAR HASTA MAS ABAJO ASI SE VE DESDE ARRIBA EN EL TABLERO SOBRE LA TILE
            craneStartPosition = new Vector3(tileObjectRealWorldLocation.x, craneStartPositionY, 0);
            ConfigurePositionAssistant cnfPosAssist = new ConfigurePositionAssistant(craneStartPosition);
            TransformPositioConfigureAnimotion <Transform, ConfigurePositionAssistant> CranePositionConfigAnimotion =
                new TransformPositioConfigureAnimotion <Transform, ConfigurePositionAssistant>(Crane.transform, cnfPosAssist, 0, true);

            configureAnimotion.Add(CranePositionConfigAnimotion);

            craneEndPostion = new Vector3(tileObjectRealWorldLocation.x, Helper.GetCameraTopBorderYWorldPostion().y);

            //A CRANE//GRUA SET ACTIVE = TRUE // INSTANCIAMOS KIMBOKO SET ACTIVE FALSE
            Crane.SetActive(true);

            goKimbok.transform.position = CraneEnd.position;
            // ACTIVAMOS AL KIMBOKO SINO NO PUEDE OBTENER EL CURRENT ANIMATOR STATE INFO
            goKimbok.SetActive(true);

            // TWEEN DE LA CRANE A LA POSICION DE SPAWNEO
            Motion motionTweenMove = new MoveTweenMotion(this, Crane.transform, 1, craneEndPostion, craneTweenSpeedVelocity);

            motionsSpawn.Add(motionTweenMove);

            ////C ANIMATION CRANESPAWNING
            Motion motionCraneSpawn = new SpawnMotion(this, craneAnimator, 2);

            motionsSpawn.Add(motionCraneSpawn);

            if (GameSoundManager.Instance != null)
            {
                if (GameSoundManager.Instance.audioSource != null)
                {
                    Motion motionSpawnSound = new SoundMotion(this, 2, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[3], false);
                    motionsSpawn.Add(motionSpawnSound);
                }
            }

            KimbokoPositioConfigureAnimotion <Transform, Transform> KimbokoPositionConfigAnimotion =
                new KimbokoPositioConfigureAnimotion <Transform, Transform>(goKimbok.transform, CraneEnd, 3);

            configureAnimotion.Add(KimbokoPositionConfigAnimotion);
            SetActiveConfigureAnimotion <Transform, Transform> KimbokoActiveConfigAnimotion =
                new SetActiveConfigureAnimotion <Transform, Transform>(goKimbok.transform, 3);

            configureAnimotion.Add(KimbokoActiveConfigAnimotion);

            ////E TWEEN DESDE LA PUNTA DEL CRANE HASTA EL PISO, DE LA MISMA DURACION QUE LA ANIMACION DE SPAWN
            Motion motionKimbokoTweenMove = new MoveTweenMotion(this, goKimbok.transform, 4, tileObjectRealWorldLocation, kimbokoTweenSpeedVelocity);

            motionsSpawn.Add(motionKimbokoTweenMove);
            //G TWEEN DE LA CRANE PARA QUE SALGA DEL MAPA
            Motion motionTweenBackCraneMove = new MoveTweenMotion(this, Crane.transform, 5, craneStartPosition, craneTweenSpeedVelocity);

            motionsSpawn.Add(motionTweenBackCraneMove);

            // FINISH //
            KimbokoIdlleConfigureAnimotion <Animator, Transform> kimbokoIdlleConfigureAnimotion =
                new KimbokoIdlleConfigureAnimotion <Animator, Transform>(goKimbok.GetComponent <Animator>(), 6);

            configureAnimotion.Add(kimbokoIdlleConfigureAnimotion);
            KimbokoIdlleConfigureAnimotion <Animator, Transform> craneIdlleConfigureAnimotion =
                new KimbokoIdlleConfigureAnimotion <Animator, Transform>(craneAnimator, 6);

            configureAnimotion.Add(craneIdlleConfigureAnimotion);

            CombineMotion spawnMotion = new CombineMotion(this, 1, motionsSpawn, configureAnimotion);

            // LO DESACTIVO PARA QUE NO MOLESTE EN ESCENA ANTES DE "SPAWNEARSE"
            goKimbok.SetActive(false);

            return(spawnMotion);
        }