Esempio n. 1
0
        public Animotion CombineMoveAnimotion(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 <Animotion> motionsCombineMove = new List <Animotion>();

            if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
            {
                AudioSourceParameter audioParemater  = new AudioSourceParameter(false, true);
                Animotion            motionMoveSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], audioParemater);
                motionsCombineMove.Add(motionMoveSound);
            }

            int index = 0;

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

                List <Animotion> extraMotionsCombineStopMove = new List <Animotion>();
                Animotion        motionTweenMove             = new MovePathTweenAnimotion(this, 1, entry.Key.transform, entry.Value);
                Animotion        motionIdlle = new IdlleAnimatedAnimotion(this, 2, entry.Key.GetComponent <Animator>());
                extraMotionsCombineStopMove.Add(motionTweenMove);
                extraMotionsCombineStopMove.Add(motionIdlle);

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

                    if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
                    {
                        StopSoundConfigureContainer stopSoundContainer = new StopSoundConfigureContainer(GameSoundManager.Instance.audioSource);
                        ConfigureAnimotion          stopSoundConfigure = new ConfigureAnimotion(stopSoundContainer, 2, true);
                        configurables.Add(stopSoundConfigure);
                    }
                    CombineAnimotion extraCombineMoveStopMotion = new CombineAnimotion(this, 1, extraMotionsCombineStopMove, configurables);
                    motionsCombineMove.Add(extraCombineMoveStopMotion);
                }
                else
                {
                    CombineAnimotion extraCombineMoveStopMotion = new CombineAnimotion(this, 1, extraMotionsCombineStopMove);
                    motionsCombineMove.Add(extraCombineMoveStopMotion);
                }

                index++;
            }

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

            return(combinMoveMotion);
        }
Esempio n. 2
0
        public Animotion MoveAnimotion(GameObject goKimbok, Vector3 endPosition)
        {
            List <Animotion> motionsMove = new List <Animotion>();
            Animator         animator    = goKimbok.GetComponent <Animator>();
            Animotion        motionMove  = new MoveAnimatedAnimotion(this, 1, animator);

            motionsMove.Add(motionMove);

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

            if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
            {
                AudioSourceParameter audioParemater  = new AudioSourceParameter(false, true);
                Animotion            motionMoveSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], audioParemater);
                motionsMove.Add(motionMoveSound);

                StopSoundConfigureContainer stopSoundContainer = new StopSoundConfigureContainer(GameSoundManager.Instance.audioSource);
                ConfigureAnimotion          stopSoundConfigure = new ConfigureAnimotion(stopSoundContainer, 2, true);
                configurables.Add(stopSoundConfigure);
            }

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

            Animotion motionTweenMove = new MoveTweenAnimotion(this, 1, goKimbok.transform, endPosition, 1);
            Animotion motionIdlle     = new IdlleAnimatedAnimotion(this, 2, animator);

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

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

            motionsMove.Add(combineStopMotion);

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

            return(combinMoveMotion);
        }
        public Animotion RearangePositionAfterCombineAnimotion(List <GameObject> kimbokos, Vector3 actualPosition, int reproductionOrder = 1)
        {
            List <Animotion>   motionsSpawnCombine = new List <Animotion>();
            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 && GameSoundManager.Instance.audioSource != null)
                {
                    AudioSourceParameter audioParameter  = new AudioSourceParameter(false, true);
                    Animotion            motionMoveSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], audioParameter);
                    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 <Animotion> motionsCombineSpawnMoveSquare = new List <Animotion>();
                    Animator         animatorAux = kimbokos[i].GetComponent <Animator>();
                    // LOS PONGO EN ESTADO MOVE PARA LA ANIMACION
                    Animotion motionMove = new MoveAnimatedAnimotion(this, 1, animatorAux);
                    motionsSpawnCombine.Add(motionMove);

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

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

                        if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
                        {
                            StopSoundConfigureContainer stopSoundContainer = new StopSoundConfigureContainer(GameSoundManager.Instance.audioSource);
                            ConfigureAnimotion          stopSoundConfigure = new ConfigureAnimotion(stopSoundContainer, 2, true);
                            configurables.Add(stopSoundConfigure);
                        }
                        CombineAnimotion combineStopMotion = new CombineAnimotion(this, 1, motionsCombineSpawnStopMoveSquare, configurables);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    else
                    {
                        CombineAnimotion combineStopMotion = new CombineAnimotion(this, 1, motionsCombineSpawnStopMoveSquare);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    CombineAnimotion combinSquarePositionMotion = new CombineAnimotion(this, 1, motionsCombineSpawnMoveSquare);
                    motionsSpawnCombine.Add(combinSquarePositionMotion);
                }
            }
            CombineAnimotion combinMoveMotion = new CombineAnimotion(this, reproductionOrder, motionsSpawnCombine);

            return(combinMoveMotion);
        }
        public Animotion MoveToSquarePositionAnimotion(List <GameObject> kimbokos, Vector3 actualPosition)
        {
            List <Animotion>   motionsSpawnCombine = new List <Animotion>();
            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 && GameSoundManager.Instance.audioSource != null)
                {
                    AudioSourceParameter audioParameter  = new AudioSourceParameter(false, true);
                    Animotion            motionMoveSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[4], audioParameter);
                    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 <Animotion> motionsCombineSpawnMoveSquare = new List <Animotion>();
                    Animotion        motionMove = new MoveAnimatedAnimotion(this, 1, animatorAux);
                    motionsCombineSpawnMoveSquare.Add(motionMove);

                    List <Animotion> motionsCombineSpawnStopMoveSquare = new List <Animotion>();
                    Animotion        motionTwMove = new MoveTweenAnimotion(this, 1, kimbokos[i].transform, squarePositions[i], 1);
                    Animotion        motionIdlle  = new IdlleAnimatedAnimotion(this, 2, animatorAux);
                    motionsCombineSpawnStopMoveSquare.Add(motionTwMove);
                    motionsCombineSpawnStopMoveSquare.Add(motionIdlle);

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

                        if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
                        {
                            StopSoundConfigureContainer stopSoundContainer = new StopSoundConfigureContainer(GameSoundManager.Instance.audioSource);
                            ConfigureAnimotion          stopSoundConfigure = new ConfigureAnimotion(stopSoundContainer, 2, true);
                            configurables.Add(stopSoundConfigure);
                        }
                        CombineAnimotion combineStopMotion = new CombineAnimotion(this, 1, motionsCombineSpawnStopMoveSquare, configurables);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    else
                    {
                        CombineAnimotion combineStopMotion = new CombineAnimotion(this, 1, motionsCombineSpawnStopMoveSquare);
                        motionsCombineSpawnMoveSquare.Add(combineStopMotion);
                    }
                    CombineAnimotion combinSquarePositionMotion = new CombineAnimotion(this, 1, motionsCombineSpawnMoveSquare);
                    motionsSpawnCombine.Add(combinSquarePositionMotion);
                }
            }
            CombineAnimotion repositionInSquareMotion = new CombineAnimotion(this, 1, motionsSpawnCombine);

            return(repositionInSquareMotion);
        }