private Animotion SimpleAttackToCombineAnimotion(Animator attackerAnimator, List <Animator> damagedAnimator)
        {
            List <Animotion> motions = new List <Animotion>();
            // PLAY ATTACK ANIMATION
            Animotion motionAttack = new AttackAnimatedAnimotion(this, 1, attackerAnimator);

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

            // PLAY DAMAGE ANIMATION FOR ALL THE ENEMIES
            for (int i = 0; i < damagedAnimator.Count; i++)
            {
                Animotion motionDamage = new DamageAnimatedAnimotion(this, 1, damagedAnimator[i]);
                motions.Add(motionDamage);
            }
            CombineAnimotion combineAttackMotion = new CombineAnimotion(this, 1, motions);

            return(combineAttackMotion);
        }
Пример #2
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);
        }
        private Animotion SimpleAttackToCombineWithShieldAnimotion(Animator attackerAnimator, List <Animator> damagedAnimator)
        {
            List <Animotion>          motions            = new List <Animotion>();
            List <ConfigurableMotion> configureAnimotion = new List <ConfigurableMotion>();
            // PLAY ATTACK ANIMATION
            Animotion motionAttack = new AttackAnimatedAnimotion(this, 1, attackerAnimator);

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

            // PLAY DAMAGE ANIMATION FOR ALL THE ENEMIES
            for (int i = 0; i < damagedAnimator.Count; i++)
            {
                // PLAY DAMAGE ANIMATION
                Animotion motionDamage = new DamageAnimatedAnimotion(this, 1, damagedAnimator[i]);
                motions.Add(motionDamage);

                // CREAMOS EL SHIELD
                GameObject shield = Instantiate(shieldPrefab, damagedAnimator[i].transform.position, Quaternion.identity);
                shield.SetActive(true);

                List <Animotion> shieldMotions      = new List <Animotion>();
                Animotion        motionShieldDamage = new ShieldAnimatedAnimotion(this, 1, shield.GetComponent <Animator>());
                shieldMotions.Add(motionShieldDamage);

                GameObjectDestroyConfigureContainer goDestroyContainer = new GameObjectDestroyConfigureContainer(shield);
                ConfigureAnimotion destroyGOConfigAnimotion            = new ConfigureAnimotion(goDestroyContainer, 2);
                configureAnimotion.Add(destroyGOConfigAnimotion);

                CombineAnimotion combineShieldMotion = new CombineAnimotion(this, 1, shieldMotions, configureAnimotion);
                motions.Add(combineShieldMotion);
            }

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

            return(combineAttackMotion);
        }
        private Animotion SimpleAttackAnimotion(Animator attackerAnimator)
        {
            List <Animotion> motions = new List <Animotion>();
            // PLAY ATTACK ANIMATION
            Animotion motionAttack = new AttackAnimatedAnimotion(this, 1, attackerAnimator);

            motions.Add(motionAttack);
            if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
            {
                AudioSourceParameter audioParameter = new AudioSourceParameter(true);
                // ATTACK SOUND
                Animotion motionAttackSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[0], audioParameter);
                motions.Add(motionAttackSound);
            }
            CombineAnimotion combineAttackMotion = new CombineAnimotion(this, 1, motions);

            return(combineAttackMotion);
        }
        private Animotion SimpleDamageAnimotion(Animator damagedAnimator)
        {
            List <Animotion> motions = new List <Animotion>();

            if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
            {
                AudioSourceParameter audioParameter = new AudioSourceParameter(true);
                // DAMAGE SOUND
                Animotion motionDamageSound = new SoundAnimotion(this, 1, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[2], audioParameter);
                motions.Add(motionDamageSound);
            }
            // PLAY DAMAGE ANIMATION
            Animotion motionDamage = new DamageAnimatedAnimotion(this, 1, damagedAnimator);

            motions.Add(motionDamage);

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

            return(combineAttackMotion);
        }
Пример #6
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);
        }
Пример #9
0
        public Animotion NormalSpawnAnimotion(Vector3 tileObjectRealWorldLocation, GameObject goKimbok)
        {
            List <Animotion>          motionsSpawn       = new List <Animotion>();
            List <ConfigurableMotion> configureAnimotion = new List <ConfigurableMotion>();

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

            // 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);
            PositionVector3ConfigureContainer posVectContainer = new PositionVector3ConfigureContainer(craneStartPosition, Crane.transform);
            ConfigureAnimotion posVectConfigure = new ConfigureAnimotion(posVectContainer, 1);

            configureAnimotion.Add(posVectConfigure);

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

            Vector3 craneSpawnPosition = CraneEnd.position;

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

            goKimbok.transform.position = craneSpawnPosition;

            // TWEEN DE LA CRANE A LA POSICION DE SPAWNEO
            Animotion motionTweenMove = new MoveTweenAnimotion(this, 2, Crane.transform, craneEndPostion, craneTweenSpeedVelocity);

            motionsSpawn.Add(motionTweenMove);

            ////C ANIMATION CRANESPAWNING
            Animotion motionCraneSpawn = new SpawnAnimatedAnimotion(this, 3, craneAnimator);

            motionsSpawn.Add(motionCraneSpawn);

            if (GameSoundManager.Instance != null && GameSoundManager.Instance.audioSource != null)
            {
                AudioSourceParameter audioParameter   = new AudioSourceParameter(true); // false
                Animotion            motionSpawnSound = new SoundAnimotion(this, 3, GameSoundManager.Instance.audioSource, GameSoundManager.Instance.audioClips[3], audioParameter);
                motionsSpawn.Add(motionSpawnSound);
            }

            PositionTransformConfigureContainer posTransformContainer = new PositionTransformConfigureContainer(goKimbok.transform, CraneEnd);
            ConfigureAnimotion posTransformConfigure = new ConfigureAnimotion(posTransformContainer, 4);

            configureAnimotion.Add(posTransformConfigure);

            GameObjectSetActiveConfigureContainer setActiveContainer = new GameObjectSetActiveConfigureContainer(goKimbok, true);
            ConfigureAnimotion setActiveConfigure = new ConfigureAnimotion(setActiveContainer, 4, true);

            configureAnimotion.Add(setActiveConfigure);


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

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

            motionsSpawn.Add(motionTweenBackCraneMove);

            // FINISH //



            SetTriggerAnimationCongifureContainer setIdlleKimbokoContainer = new SetTriggerAnimationCongifureContainer(goKimbok.GetComponent <Animator>(), "Idlle");
            ConfigureAnimotion idlleKimbokoConfigure = new ConfigureAnimotion(setIdlleKimbokoContainer, 7, true);

            configureAnimotion.Add(idlleKimbokoConfigure);
            SetTriggerAnimationCongifureContainer setIdlleCraneContainer = new SetTriggerAnimationCongifureContainer(craneAnimator, "Idlle");
            ConfigureAnimotion idlleCraneConfigure = new ConfigureAnimotion(setIdlleCraneContainer, 7, true);

            configureAnimotion.Add(idlleCraneConfigure);
            //Animotion motionIdlleKimboko = new IdlleAnimatedAnimotion(this, 7, goKimbok.GetComponent<Animator>());
            //motionsSpawn.Add(motionIdlleKimboko);

            //Animotion motionIdlleCrane = new IdlleAnimatedAnimotion(this, 7, craneAnimator);
            //motionsSpawn.Add(motionIdlleCrane);

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

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

            return(spawnMotion);
        }