From be31d50780f2a4e7411e1ae9211cf890b50a9944 Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 20 Nov 2018 21:10:49 +0200 Subject: [PATCH] Decompiled source code --- src/CloudRegionCode.cs | 14 + src/CloudRegionFlag.cs | 16 + src/Fie.AI/FieAIControllerBase.cs | 8 + src/Fie.AI/FieAIHateController.cs | 99 + src/Fie.AI/FieAITaskApplejackBackstep.cs | 64 + src/Fie.AI/FieAITaskApplejackEnemyTracking.cs | 35 + src/Fie.AI/FieAITaskApplejackIdle.cs | 85 + src/Fie.AI/FieAITaskApplejackJump.cs | 65 + src/Fie.AI/FieAITaskApplejackMelee.cs | 63 + src/Fie.AI/FieAITaskApplejackRope.cs | 60 + src/Fie.AI/FieAITaskApplejackStomp.cs | 60 + src/Fie.AI/FieAITaskApplejackYeehaw.cs | 58 + src/Fie.AI/FieAITaskBase.cs | 47 + src/Fie.AI/FieAITaskChangelingAlphaCharge.cs | 124 + src/Fie.AI/FieAITaskChangelingAlphaIdle.cs | 32 + src/Fie.AI/FieAITaskChangelingAlphaShout.cs | 85 + src/Fie.AI/FieAITaskChangelingBackstep.cs | 60 + src/Fie.AI/FieAITaskChangelingIdle.cs | 24 + src/Fie.AI/FieAITaskChangelingMelee.cs | 133 + src/Fie.AI/FieAITaskChangelingShoot.cs | 135 + src/Fie.AI/FieAITaskChangelingWait.cs | 37 + src/Fie.AI/FieAITaskCommonIdle.cs | 10 + src/Fie.AI/FieAITaskController.cs | 163 + ...ieAITaskEnemiesHoovesRacesEvadeBackWall.cs | 42 + src/Fie.AI/FieAITaskFlightlingAlphaShot.cs | 89 + src/Fie.AI/FieAITaskFlightlingFly.cs | 116 + src/Fie.AI/FieAITaskFlightlingFlyMove.cs | 43 + src/Fie.AI/FieAITaskFlightlingIdle.cs | 30 + src/Fie.AI/FieAITaskFlightlingShot.cs | 62 + src/Fie.AI/FieAITaskInterface.cs | 14 + src/Fie.AI/FieAITaskPoniesOwnerTracking.cs | 29 + src/Fie.AI/FieAITaskPoniesRescue.cs | 35 + src/Fie.AI/FieAITaskQueenChrysalisAirRaid.cs | 62 + src/Fie.AI/FieAITaskQueenChrysalisCrucible.cs | 61 + .../FieAITaskQueenChrysalisDoubleSlash.cs | 54 + src/Fie.AI/FieAITaskQueenChrysalisIdle.cs | 78 + src/Fie.AI/FieAITaskQueenChrysalisIgnite.cs | 68 + .../FieAITaskQueenChrysalisMeteoShower.cs | 63 + src/Fie.AI/FieAITaskQueenChrysalisShot.cs | 78 + .../FieAITaskQueenChrysalisTeleportation.cs | 74 + .../FieAITaskQueenChrysallisCallingMinion.cs | 54 + .../FieAITaskRainbowDashDoublePayback.cs | 61 + src/Fie.AI/FieAITaskRainbowDashEnemyEvade.cs | 37 + .../FieAITaskRainbowDashEnemyTracking.cs | 26 + src/Fie.AI/FieAITaskRainbowDashEvasion.cs | 64 + src/Fie.AI/FieAITaskRainbowDashIdle.cs | 95 + src/Fie.AI/FieAITaskRainbowDashJump.cs | 51 + src/Fie.AI/FieAITaskRainbowDashMelee.cs | 63 + src/Fie.AI/FieAITaskRainbowDashOmniSmash.cs | 67 + src/Fie.AI/FieAITaskRainbowDashRainblow.cs | 60 + src/Fie.AI/FieAITaskTwilightBase.cs | 21 + src/Fie.AI/FieAITaskTwilightBaseShot.cs | 79 + src/Fie.AI/FieAITaskTwilightEnemyEvade.cs | 44 + src/Fie.AI/FieAITaskTwilightForceField.cs | 50 + src/Fie.AI/FieAITaskTwilightIdle.cs | 90 + src/Fie.AI/FieAITaskTwilightJump.cs | 60 + src/Fie.AI/FieAITaskTwilightShinyArrow.cs | 54 + src/Fie.AI/FieAITaskTwilightSummonArrow.cs | 50 + src/Fie.Camera/FieCameraBase.cs | 311 ++ src/Fie.Camera/FieCameraOffset.cs | 72 + src/Fie.Camera/FieGameCamera.cs | 316 ++ .../FieGameCameraEverfreeVignette.cs | 38 + src/Fie.Camera/FieGameCameraTaskBase.cs | 23 + src/Fie.Camera/FieGameCameraTaskHorming.cs | 55 + src/Fie.Camera/FieGameCameraTaskLockOn.cs | 108 + src/Fie.Camera/FieGameCameraTaskStop.cs | 84 + src/Fie.Camera/FieSkillTreeCamera.cs | 81 + src/Fie.Camera/FieTitleCamera.cs | 6 + src/Fie.Camera/FieUICamera.cs | 91 + src/Fie.Core/FieBootstrap.cs | 22 + src/Fie.DebugUtility/FieDebugGameSceneBoot.cs | 67 + .../FieChangeling.cs | 133 + .../FieChangelingAnimationContainer.cs | 34 + .../FieEmitObjectChangelingBite.cs | 51 + .../FieEmitObjectChangelingBiteHitEffect.cs | 15 + .../FieEmitObjectChangelingHitEffectSmall.cs | 15 + .../FieEmitObjectChangelingShot.cs | 115 + .../FieEmitObjectChangelingVortex.cs | 54 + .../FieStateMachineChangelingArrival.cs | 97 + .../FieStateMachineChangelingBackstep.cs | 104 + .../FieStateMachineChangelingBaseAttack.cs | 27 + .../FieStateMachineChangelingMelee.cs | 119 + .../FieStateMachineChangelingShoot.cs | 77 + .../FieStateMachineChangelingVortex.cs | 96 + .../FieChangelingAlpha.cs | 82 + .../FieChangelingAlphaAnimationContainer.cs | 36 + .../FieEmitObjectChangelingAlphaBurst.cs | 40 + .../FieEmitObjectChangelingAlphaCharge.cs | 64 + ...ieEmitObjectChangelingAlphaChargeEffect.cs | 21 + ...ieEmitObjectChangelingAlphaChargeFinish.cs | 64 + ...eEmitObjectChangelingAlphaConcentration.cs | 70 + .../FieEmitObjectChangelingAlphaHitEffect.cs | 15 + ...itObjectChangelingAlphaReflectionEffect.cs | 18 + ...mitObjectChangelingAlphaReflectionShout.cs | 59 + .../FieEmitObjectChangelingAlphaShot.cs | 151 + .../FieEmitObjectChangelingAlphaShout.cs | 52 + .../FieStateMachineChangelingAlphaCharge.cs | 80 + ...StateMachineChangelingAlphaChargeFinish.cs | 152 + ...tateMachineChangelingAlphaConcentration.cs | 55 + .../FieStateMachineChangelingAlphaShoot.cs | 92 + .../FieStateMachineChangelingAlphaShout.cs | 119 + ...achineChangelingAlphaZeroDistanceCharge.cs | 152 + ...eStateMachineEnemiesChangelingAlphaMove.cs | 72 + .../FieEmitObjectFlightlingBurst.cs | 40 + .../FieEmitObjectFlightlingConcentration.cs | 70 + .../FieEmitObjectFlightlingShot.cs | 168 + .../FieFlightling.cs | 66 + .../FieFlightlingAnimationContainer.cs | 34 + .../FieStateMachineFlightlingConcentration.cs | 53 + .../FieStateMachineFlightlingFly.cs | 118 + .../FieStateMachineFlightlingFlyMove.cs | 86 + .../FieStateMachineFlightlingShoot.cs | 90 + ...bjectQueenChrysalisAirRaidConcentration.cs | 127 + ...ieEmitObjectQueenChrysalisAirRaidPreHit.cs | 35 + .../FieEmitObjectQueenChrysalisAirRiad.cs | 68 + ...ectQueenChrysalisCommonActivationEffect.cs | 15 + ...ieEmitObjectQueenChrysalisCrucibleBurst.cs | 55 + ...eEmitObjectQueenChrysalisCrucibleCircle.cs | 101 + ...mitObjectQueenChrysalisDoubleSlashFirst.cs | 56 + ...itObjectQueenChrysalisDoubleSlashSecond.cs | 56 + ...EmitObjectQueenChrysalisHitEffectBurned.cs | 49 + ...eEmitObjectQueenChrysalisHitEffectSmall.cs | 15 + .../FieEmitObjectQueenChrysalisHormingShot.cs | 173 + ...QueenChrysalisHormingShotActivateEffect.cs | 15 + .../FieEmitObjectQueenChrysalisHornEffect.cs | 62 + .../FieEmitObjectQueenChrysalisIgniteBurst.cs | 54 + ...EmitObjectQueenChrysalisIgniteCollision.cs | 56 + ...ObjectQueenChrysalisIgniteConcentration.cs | 127 + ...itObjectQueenChrysalisMeteorShowerBurst.cs | 45 + ...QueenChrysalisMeteorShowerConcentration.cs | 124 + ...ueenChrysalisMeteorShowerEmittingEffect.cs | 139 + ...tObjectQueenChrysalisMeteorShowerMeteor.cs | 155 + ...ieEmitObjectQueenChrysalisPenetrateShot.cs | 148 + ...eenChrysalisPenetrateShotActivateEffect.cs | 17 + ...tObjectQueenChrysalisPenetrateShotBurst.cs | 40 + ...mitObjectQueenChrysalisReflectionEffect.cs | 18 + ...jectQueenChrysalisShootingConcentration.cs | 127 + ...ectQueenChrysalisStaggerRecoveringBurst.cs | 70 + .../FieQueenChrysalis.cs | 302 ++ .../FieQueenChrysalisAnimationContainer.cs | 64 + .../FieQueenChrysalisEffectManager.cs | 74 + ...tateMachineEnemiesQueenChrysalisStagger.cs | 106 + ...ateMachineQueenChrysalisAirRaidFinished.cs | 109 + ...teMachineQueenChrysalisAirRiadAttacking.cs | 160 + ...tateMachineQueenChrysalisAirRiadPrepare.cs | 148 + ...FieStateMachineQueenChrysalisBaseAttack.cs | 27 + ...StateMachineQueenChrysalisCallingMinion.cs | 194 + .../FieStateMachineQueenChrysalisCrucible.cs | 171 + ...ieStateMachineQueenChrysalisDoubleSlash.cs | 150 + ...ieStateMachineQueenChrysalisHormingShot.cs | 120 + .../FieStateMachineQueenChrysalisIdle.cs | 43 + ...eStateMachineQueenChrysalisIgniteFailed.cs | 98 + ...StateMachineQueenChrysalisIgnitePrepare.cs | 159 + ...ieStateMachineQueenChrysalisIgniteStart.cs | 165 + ...StateMachineQueenChrysalisIgniteSucceed.cs | 106 + .../FieStateMachineQueenChrysalisJumpIdle.cs | 57 + ...hineQueenChrysalisMeteorShowerAttacking.cs | 191 + ...chineQueenChrysalisMeteorShowerFinished.cs | 92 + ...achineQueenChrysalisMeteorShowerPrepare.cs | 159 + ...StateMachineQueenChrysalisPenetrateShot.cs | 113 + .../FieStateMachineQueenChrysalisRift.cs | 125 + ...ieStateMachineQueenChrysalisStaggerFall.cs | 136 + ...StateMachineQueenChrysalisTeleportation.cs | 130 + ...ObjectChangelingForcesArrivalFireEffect.cs | 15 + ...ctChangelingForcesArrivalParticleEffect.cs | 68 + ...FieEmitObjectChangelingForcesDeadEffect.cs | 15 + .../FieEnemiesHoovesRaces.cs | 73 + .../FieStateMachineEnemiesHoovesRacesMove.cs | 92 + .../FieStateMachineEnemiesHoovesRacesRift.cs | 125 + ...ieStateMachineEnemiesHoovesRacesStagger.cs | 107 + ...ateMachineEnemiesHoovesRacesStaggerFall.cs | 99 + .../FieEnemiesAnimationContainer.cs | 12 + ...FieEnemiesHoovesRacesAnimationContainer.cs | 36 + src/Fie.Enemies/FieObjectEnemies.cs | 217 ++ .../FieStateMachineEnemiesAttackIdle.cs | 28 + src/Fie.Fader/FieFader.cs | 64 + src/Fie.Fader/FieFaderElementDecsenter.cs | 33 + src/Fie.Footstep/FieFootstepMaterial.cs | 45 + src/Fie.Footstep/FieFootstepPlayer.cs | 57 + src/Fie.LevelObject/FieLevelObjectGlowEyes.cs | 55 + .../FieLevelObjectGlowInsect.cs | 83 + src/Fie.LevelObject/FieLevelObjectGrass.cs | 33 + .../FieLevelObjectInfiniGrass.cs | 22 + .../FieLevelObjectOpeningCinematic.cs | 142 + .../FieLevelObjectTracePath.cs | 13 + src/Fie.Manager/FieActivityManager.cs | 136 + src/Fie.Manager/FieAcvitityQueue.cs | 20 + src/Fie.Manager/FieAudioManager.cs | 88 + src/Fie.Manager/FieCurrentGameManager.cs | 33 + src/Fie.Manager/FieDialogManager.cs | 143 + src/Fie.Manager/FieEnvironmentManager.cs | 334 ++ src/Fie.Manager/FieFaderManager.cs | 140 + src/Fie.Manager/FieGUIManager.cs | 326 ++ src/Fie.Manager/FieGameCameraManager.cs | 80 + src/Fie.Manager/FieGameCharacterManager.cs | 117 + .../FieInGameCharacterStatusManager.cs | 86 + src/Fie.Manager/FieInGameEnemyManager.cs | 111 + src/Fie.Manager/FieInGameStateManager.cs | 255 ++ src/Fie.Manager/FieInputManager.cs | 327 ++ src/Fie.Manager/FieLevelInfo.cs | 15 + .../FieLobbyGameCharacterGenerateManager.cs | 82 + src/Fie.Manager/FieManagerBase.cs | 34 + src/Fie.Manager/FieManagerBehaviour.cs | 49 + src/Fie.Manager/FieManagerExistSceneFlag.cs | 13 + src/Fie.Manager/FieManagerExists.cs | 15 + src/Fie.Manager/FieManagerFactory.cs | 172 + src/Fie.Manager/FieNetworkManager.cs | 549 +++ src/Fie.Manager/FieSaveData.cs | 25 + src/Fie.Manager/FieSaveManager.cs | 561 +++ src/Fie.Manager/FieSceneManager.cs | 175 + src/Fie.Manager/FieUserManager.cs | 510 +++ src/Fie.Manager/FieVibrationManager.cs | 82 + .../FieAbilitiesContainer.cs | 189 + .../FieAbilitiesCooldown.cs | 58 + src/Fie.Object.Abilities/FieAbilitiesSlot.cs | 13 + src/Fie.Object/FieAbilityActivationType.cs | 8 + src/Fie.Object/FieAbilityIDAttribute.cs | 15 + src/Fie.Object/FieAnimationContainerBase.cs | 41 + src/Fie.Object/FieAttribute.cs | 10 + src/Fie.Object/FieDamage.cs | 66 + src/Fie.Object/FieDamageSystem.cs | 646 ++++ src/Fie.Object/FieEmitObjectPoniesArrival.cs | 34 + .../FieEmitObjectPoniesGainedFriendship.cs | 16 + src/Fie.Object/FieEmitObjectPoniesRevive.cs | 16 + src/Fie.Object/FieEmittableObjectBase.cs | 581 +++ src/Fie.Object/FieEmotion.cs | 91 + src/Fie.Object/FieFriendshipdStats.cs | 51 + src/Fie.Object/FieGameCharacterBuildData.cs | 13 + src/Fie.Object/FieHealthStats.cs | 216 ++ .../FieInGamePreloadEnemyContainer.cs | 11 + src/Fie.Object/FieInputControllerBase.cs | 16 + src/Fie.Object/FieMoveForce.cs | 30 + src/Fie.Object/FieNetworkObjectBase.cs | 60 + src/Fie.Object/FieObjectBaseState.cs | 9 + src/Fie.Object/FieObjectFlipState.cs | 8 + src/Fie.Object/FieObjectGroundState.cs | 9 + src/Fie.Object/FieObjectInterface.cs | 23 + .../FiePlayableGameCharacterInterface.cs | 6 + src/Fie.Object/FiePlayerSpawnPoint.cs | 10 + .../FieSkeletonAnimationController.cs | 198 + src/Fie.Object/FieSkeletonAnimationObject.cs | 33 + src/Fie.Object/FieStateMachineAbilityBase.cs | 17 + .../FieStateMachineAbilityInterface.cs | 11 + src/Fie.Object/FieStateMachineAnyConsider.cs | 44 + src/Fie.Object/FieStateMachineCommonIdle.cs | 30 + .../FieStateMachineGameCharacterBase.cs | 93 + src/Fie.Object/FieStateMachineInterface.cs | 30 + src/Fie.Object/FieStateMachineManager.cs | 177 + src/Fie.Object/FieStateMachinePoniesIdle.cs | 43 + .../FieStateMachineStatusEffectPull.cs | 87 + src/Fie.Object/FieStatusEffectEntityBase.cs | 20 + src/Fie.Object/FieStatusEffectsBase.cs | 38 + .../FieStatusEffectsBuffAndDebuffToAttack.cs | 126 + ...tatusEffectsBuffAndDebuffToAttackEntity.cs | 16 + ...FieStatusEffectsBuffAndDebuffToDeffence.cs | 107 + ...tusEffectsBuffAndDebuffToDeffenceEntity.cs | 14 + src/Fie.Object/FieStatusEffectsGrab.cs | 12 + src/Fie.Object/FieStatusEffectsGrabEntity.cs | 9 + src/Fie.Object/FieStatusEffectsPull.cs | 12 + src/Fie.Object/FieStatusEffectsPullEntity.cs | 31 + src/Fie.Object/FieStatusEffectsRift.cs | 21 + src/Fie.Object/FieStatusEffectsRiftEntity.cs | 12 + src/Fie.Object/FieStatusEffectsTimeScaler.cs | 69 + .../FieStatusEffectsTimeScalerEntity.cs | 10 + src/Fie.Object/StateChangeDelegate.cs | 6 + src/Fie.Object/StatusEeffectType.cs | 12 + .../FieActivityManagerForPlaymaker.cs | 54 + .../FieFaderManagerForPlayMaker.cs | 45 + .../FieLanguageChangerForPlaymaker.cs | 20 + ...CharacterSelectUIControllerForPlayMaker.cs | 66 + ...eLobbyElementSelectUIButtonForPlaymaker.cs | 31 + ...eLobbyNameEntryUIControllerForPlayMaker.cs | 38 + .../FieLobbySelectableUIForPlaymaker.cs | 40 + .../FieNetworkManagerForPlaymaker.cs | 74 + .../FieResultActionForPlaymaker.cs | 15 + .../FieSceneManagerForPlaymaker.cs | 59 + .../FieTitleActionForPlaymaker.cs | 32 + .../FieTitleLoginActionForPlayMaker.cs | 40 + .../FieUIMouseEventForPlayMaker.cs | 99 + .../FieUIOptionWindowForPlayMaker.cs | 64 + src/Fie.Ponies.Applejack/FieApplejack.cs | 209 + .../FieApplejackAnimationContainer.cs | 65 + .../FieEmitObjectApplejackAirKick.cs | 73 + .../FieEmitObjectApplejackCharge.cs | 52 + .../FieEmitObjectApplejackChargeEffect.cs | 21 + .../FieEmitObjectApplejackHitEffectMiddle.cs | 16 + .../FieEmitObjectApplejackHitEffectSmall.cs | 16 + .../FieEmitObjectApplejackKick.cs | 64 + .../FieEmitObjectApplejackKickEffect.cs | 21 + .../FieEmitObjectApplejackKickEffect2.cs | 23 + .../FieEmitObjectApplejackKickRift.cs | 63 + .../FieEmitObjectApplejackPunch.cs | 50 + .../FieEmitObjectApplejackRope.cs | 329 ++ .../FieEmitObjectApplejackStomp.cs | 122 + .../FieEmitObjectApplejackYeehaw.cs | 88 + .../FieEmitObjectApplejackYeehawFriendly.cs | 46 + .../FieEmitObjectApplejackYeehawReflect.cs | 60 + .../FieEmitObjectApplejackYeehawRegen.cs | 96 + .../FieStateMachineApplejackBackstep.cs | 106 + .../FieStateMachineApplejackBaseAttack.cs | 78 + .../FieStateMachineApplejackCharge.cs | 113 + .../FieStateMachineApplejackEvasion.cs | 51 + .../FieStateMachineApplejackFireAir.cs | 153 + .../FieStateMachineApplejackFireAirDouble.cs | 158 + .../FieStateMachineApplejackFireKick.cs | 175 + .../FieStateMachineApplejackFireKickRift.cs | 181 + .../FieStateMachineApplejackFirePunch.cs | 167 + .../FieStateMachineApplejackFireRope.cs | 207 + .../FieStateMachineApplejackFlying.cs | 82 + .../FieStateMachineApplejackJump.cs | 137 + .../FieStateMachineApplejackRope.cs | 69 + .../FieStateMachineApplejackRopeAction.cs | 126 + .../FieStateMachineApplejackRopeActionAir.cs | 166 + .../FieStateMachineApplejackStomp.cs | 71 + .../FieStateMachineApplejackStompAction.cs | 137 + .../FieStateMachineApplejackStompJump.cs | 145 + .../FieStateMachineApplejackYeehaw.cs | 74 + .../FieStateMachineApplejackYeehawAction.cs | 140 + ...StateMachineApplejackYeehawActionMidAir.cs | 155 + .../FieEmitObjectRainbowDashAwesomeEffect.cs | 60 + .../FieEmitObjectRainbowDashBaseAttack1.cs | 67 + .../FieEmitObjectRainbowDashBaseAttack2.cs | 50 + .../FieEmitObjectRainbowDashBaseAttack3.cs | 85 + .../FieEmitObjectRainbowDashCloaking.cs | 64 + ...ainbowDashDoublePaybackActivationEffect.cs | 19 + ...RainbowDashDoublePaybackAttackingEffect.cs | 61 + ...ObjectRainbowDashDoublePaybackCollision.cs | 59 + ...ObjectRainbowDashDoublePaybackHitEffect.cs | 21 + .../FieEmitObjectRainbowDashEvasionEffect.cs | 70 + ...FieEmitObjectRainbowDashHitEffectMiddle.cs | 16 + .../FieEmitObjectRainbowDashHitEffectSmall.cs | 16 + .../FieEmitObjectRainbowDashHitEffectStab.cs | 16 + ...itObjectRainbowDashLoosingAwesomeEffect.cs | 19 + ...ectRainbowDashOmniSmashActivationEffect.cs | 19 + ...EmitObjectRainbowDashOmniSmashExplosion.cs | 96 + ...jectRainbowDashOmniSmashExplosionEffect.cs | 38 + ...EmitObjectRainbowDashOmniSmashFinishHit.cs | 65 + ...eEmitObjectRainbowDashOmniSmashFirstHit.cs | 54 + ...EmitObjectRainbowDashOmniSmashHitEffect.cs | 21 + ...tObjectRainbowDashOmniSmashImpactEffect.cs | 31 + ...bjectRainbowDashOmniSmashRainboomEffect.cs | 21 + ...EmitObjectRainbowDashOmniSmashSecondHit.cs | 99 + ...itObjectRainbowDashOmniSmashTrailEffect.cs | 57 + .../FieEmitObjectRainbowDashRainblowEntity.cs | 139 + ...itObjectRainbowDashRainblowEntityMidAir.cs | 139 + .../FieEmitObjectRainbowDashRainblowSeed.cs | 95 + .../FieEmitObjectRainbowDashStabAttack.cs | 111 + src/Fie.Ponies.RainbowDash/FieRainbowDash.cs | 361 ++ .../FieRainbowDashAnimationContainer.cs | 69 + .../FieRainbowDashTrailRotator.cs | 35 + .../FieStateMachineRainbowDashBaseAttack.cs | 63 + .../FieStateMachineRainbowDashBaseAttack1.cs | 197 + .../FieStateMachineRainbowDashBaseAttack2.cs | 204 + .../FieStateMachineRainbowDashBaseAttack3.cs | 183 + ...FieStateMachineRainbowDashDoublePayback.cs | 64 + ...achineRainbowDashDoublePaybackAttacking.cs | 286 ++ ...neRainbowDashDoublePaybackPrepareMidAir.cs | 180 + ...RainbowDashDoublePaybackPrepareOnGround.cs | 175 + .../FieStateMachineRainbowDashEvasion.cs | 68 + .../FieStateMachineRainbowDashEvasionBack.cs | 189 + .../FieStateMachineRainbowDashEvasionDown.cs | 174 + .../FieStateMachineRainbowDashEvasionFront.cs | 189 + .../FieStateMachineRainbowDashEvasionUp.cs | 170 + .../FieStateMachineRainbowDashFlying.cs | 136 + .../FieStateMachineRainbowDashJump.cs | 136 + .../FieStateMachineRainbowDashOmniSmash.cs | 57 + ...eStateMachineRainbowDashOmniSmashFinish.cs | 254 ++ ...FieStateMachineRainbowDashOmniSmashLoop.cs | 152 + ...ieStateMachineRainbowDashOmniSmashStart.cs | 175 + .../FieStateMachineRainbowDashRainblow.cs | 61 + ...ieStateMachineRainbowDashRainblowCloack.cs | 162 + .../FieStateMachineRainbowDashStabAttack.cs | 194 + .../FieEmitObjectRisingSunBaseShot.cs | 150 + .../FieEmitObjectRisingSunEmission.cs | 54 + .../FieEmitObjectRisingSunForceField.cs | 84 + ...EmitObjectRisingSunForceFieldEmitEffect.cs | 21 + .../FieEmitObjectRisingSunForceFieldEntity.cs | 114 + ...tObjectRisingSunForceFieldReflectEffect.cs | 18 + .../FieEmitObjectRisingSunHitEffectMiddle.cs | 40 + .../FieEmitObjectRisingSunHitEffectSmall.cs | 15 + .../FieEmitObjectRisingSunLaser.cs | 77 + .../FieEmitObjectRisingSunLaserChild.cs | 52 + .../FieEmitObjectRisingSunLaserDust.cs | 42 + .../FieEmitObjectRisingSunShinyArrow.cs | 166 + .../FieEmitObjectRisingSunSpellEffect.cs | 19 + .../FieEmitObjectRisingSunSummonArrow.cs | 100 + .../FieEmitObjectRisingSunSummonArrowChild.cs | 160 + src/Fie.Ponies.RisingSun/FieRisingSun.cs | 107 + .../FieRisingSunAnimationContainer.cs | 37 + .../FieRisingSunBigLaserUvOffset.cs | 16 + .../FieRisingSunForceFieldUvOffset.cs | 15 + .../FieStateMachineRisingSunBaseShot.cs | 64 + .../FieStateMachineRisingSunEmission.cs | 80 + .../FieStateMachineRisingSunFireBig.cs | 97 + .../FieStateMachineRisingSunFireSmall.cs | 72 + .../FieStateMachineRisingSunFlying.cs | 92 + .../FieStateMachineRisingSunJump.cs | 116 + .../FieStateMachineRisingSunShinyArrow.cs | 80 + .../FieStateMachineRisingSunSummonArrow.cs | 79 + .../FieStateMachineRisingSunTeleportation.cs | 142 + ...tateMachineRisingSunTeleportationEndAir.cs | 109 + ...eMachineRisingSunTeleportationEndGround.cs | 92 + .../FieEmitObjectTwilightBaseShot.cs | 156 + .../FieEmitObjectTwilightChargedEffect.cs | 15 + ...mitObjectTwilightExplosiveTeleportation.cs | 56 + .../FieEmitObjectTwilightForceField.cs | 84 + ...eEmitObjectTwilightForceFieldEmitEffect.cs | 21 + .../FieEmitObjectTwilightForceFieldEntity.cs | 252 ++ ...itObjectTwilightForceFieldReflectEffect.cs | 18 + .../FieEmitObjectTwilightHitEffectMiddle.cs | 15 + ...ieEmitObjectTwilightHitEffectSemiMiddle.cs | 15 + .../FieEmitObjectTwilightHitEffectSmall.cs | 15 + .../FieEmitObjectTwilightLaser.cs | 133 + .../FieEmitObjectTwilightLaserChild.cs | 69 + .../FieEmitObjectTwilightLaserDust.cs | 60 + .../FieEmitObjectTwilightShinyArrow.cs | 154 + .../FieEmitObjectTwilightSpellEffect.cs | 19 + ...tObjectTwilightStunningSummonArrowChild.cs | 168 + .../FieEmitObjectTwilightSummonArrow.cs | 128 + .../FieEmitObjectTwilightSummonArrowChild.cs | 168 + .../FieEmitObjectTwilightSummonTrap.cs | 54 + .../FieEmitObjectTwilightSummonTrapEntity.cs | 74 + .../FieEmitObjectTwilightTwinkleArrow.cs | 160 + .../FieStateMachineTwilightAttackIdle.cs | 51 + ...ieStateMachineTwilightBaseShotActivator.cs | 80 + ...FieStateMachineTwilightBaseShotCharging.cs | 59 + .../FieStateMachineTwilightBaseShotLevel1.cs | 58 + .../FieStateMachineTwilightBaseShotLevel2.cs | 56 + .../FieStateMachineTwilightBaseShotLevel3.cs | 54 + .../FieStateMachineTwilightFireSmall.cs | 73 + .../FieStateMachineTwilightFlying.cs | 93 + .../FieStateMachineTwilightForceField.cs | 78 + .../FieStateMachineTwilightJump.cs | 116 + .../FieStateMachineTwilightShinyArrow.cs | 69 + .../FieStateMachineTwilightSparklyCannon.cs | 66 + ...ateMachineTwilightSparklyCannonShooting.cs | 218 ++ .../FieStateMachineTwilightSummonArrow.cs | 86 + .../FieStateMachineTwilightTeleportation.cs | 179 + ...StateMachineTwilightTeleportationEndAir.cs | 109 + ...teMachineTwilightTeleportationEndGround.cs | 92 + src/Fie.Ponies.Twilight/FieTwilight.cs | 216 ++ .../FieTwilightAnimationContainer.cs | 39 + .../FieTwilightBigLaserUvOffset.cs | 16 + .../FieTwilightForceFieldUvOffset.cs | 15 + src/Fie.Ponies/FiePonies.cs | 632 +++ src/Fie.Ponies/FiePoniesAnimationContainer.cs | 59 + .../FieStateMachinePoniesAbilitySlot1.cs | 24 + .../FieStateMachinePoniesAbilitySlot2.cs | 24 + .../FieStateMachinePoniesAbilitySlot3.cs | 24 + .../FieStateMachinePoniesArrival.cs | 110 + .../FieStateMachinePoniesAttackIdle.cs | 35 + .../FieStateMachinePoniesBaseAttack.cs | 28 + src/Fie.Ponies/FieStateMachinePoniesDead.cs | 129 + .../FieStateMachinePoniesEvasion.cs | 26 + src/Fie.Ponies/FieStateMachinePoniesGallop.cs | 86 + .../FieStateMachinePoniesGrabbed.cs | 129 + src/Fie.Ponies/FieStateMachinePoniesJump.cs | 33 + .../FieStateMachinePoniesLanding.cs | 112 + src/Fie.Ponies/FieStateMachinePoniesMove.cs | 90 + src/Fie.Ponies/FieStateMachinePoniesRevive.cs | 98 + src/Fie.Ponies/FieStateMachinePoniesRift.cs | 125 + .../FieStateMachinePoniesStagger.cs | 112 + .../FieStateMachinePoniesStaggerFall.cs | 103 + ...FieStateMachinePoniesStaggerFallRecover.cs | 86 + .../FieStateMachineRisingSunInterface.cs | 8 + src/Fie.Portal/FieDeparturePortal.cs | 77 + src/Fie.Portal/FiePortalBase.cs | 177 + src/Fie.Portal/FieReturnPortal.cs | 35 + src/Fie.Portal/FieVisualizedPortal.cs | 70 + .../FieCommandBufferReflection.cs | 70 + src/Fie.Scene/FieSceneBase.cs | 20 + src/Fie.Scene/FieSceneBootstrap.cs | 10 + src/Fie.Scene/FieSceneLink.cs | 18 + src/Fie.Scene/FieSceneLobby.cs | 10 + src/Fie.Scene/FieSceneMap1_1.cs | 10 + src/Fie.Scene/FieSceneMap1_2.cs | 10 + src/Fie.Scene/FieSceneMap1_3.cs | 10 + src/Fie.Scene/FieSceneMap1_4.cs | 10 + src/Fie.Scene/FieSceneResult.cs | 10 + src/Fie.Scene/FieSceneSurvivalLevel.cs | 10 + src/Fie.Scene/FieSceneTitle.cs | 10 + src/Fie.Scene/FieSceneType.cs | 12 + src/Fie.Title/FieTitleAuthController.cs | 79 + src/Fie.Title/FieTitleCameraOrbit.cs | 231 ++ src/Fie.Title/FieTitleCameraRotator.cs | 29 + src/Fie.Title/FieTitleCameraScaler.cs | 21 + .../FieTitleElementsCicleScaleTilter.cs | 52 + src/Fie.Title/FieTitleElementsRotater.cs | 63 + .../FieTitleElementsScaleNormalizer.cs | 21 + src/Fie.Title/FieTitleElementsShooter.cs | 82 + .../FieTitleElementsTargetChanger.cs | 66 + src/Fie.Title/FieTitleOrbitalParticle.cs | 43 + src/Fie.Title/FieTitleVersionNumberDrawer.cs | 20 + src/Fie.UI/FieGameUIAbilitiesIconApplejack.cs | 6 + src/Fie.UI/FieGameUIAbilitiesIconBase.cs | 130 + src/Fie.UI/FieGameUIAbilitiesIconManager.cs | 89 + .../FieGameUIAbilitiesIconRainbowDash.cs | 6 + src/Fie.UI/FieGameUIAbilitiesIconRisingSun.cs | 6 + src/Fie.UI/FieGameUIAbilitiesIconTwilight.cs | 6 + src/Fie.UI/FieGameUIActivityWindow.cs | 112 + src/Fie.UI/FieGameUIActivityWindowManager.cs | 60 + src/Fie.UI/FieGameUIActivityWindowText.cs | 78 + src/Fie.UI/FieGameUIBase.cs | 69 + src/Fie.UI/FieGameUIComponentManagerBase.cs | 20 + src/Fie.UI/FieGameUIDamageCounter.cs | 195 + src/Fie.UI/FieGameUIDamageCounterManager.cs | 72 + src/Fie.UI/FieGameUIDialogCaption.cs | 33 + src/Fie.UI/FieGameUIDialogCaptionManager.cs | 90 + src/Fie.UI/FieGameUIEnemyLifeGauge.cs | 6 + src/Fie.UI/FieGameUIEnemyLifeGaugeManager.cs | 73 + src/Fie.UI/FieGameUIFriendshipGauge.cs | 134 + src/Fie.UI/FieGameUIGainedScore.cs | 53 + src/Fie.UI/FieGameUIGameOverWindow.cs | 132 + src/Fie.UI/FieGameUIGameOverWindowManager.cs | 51 + src/Fie.UI/FieGameUIHeaderFooter.cs | 50 + src/Fie.UI/FieGameUIHeaderFooterManager.cs | 72 + src/Fie.UI/FieGameUIIndicator.cs | 150 + src/Fie.UI/FieGameUIIndicatorManager.cs | 69 + src/Fie.UI/FieGameUILifeGaugeBase.cs | 227 ++ src/Fie.UI/FieGameUIPlayerLifeGauge.cs | 30 + src/Fie.UI/FieGameUIPlayerWindow.cs | 97 + src/Fie.UI/FieGameUIPlayerWindowManager.cs | 169 + src/Fie.UI/FieGameUISplitLine.cs | 10 + src/Fie.UI/FieGameUITargetIcon.cs | 372 ++ src/Fie.UI/FieLobbyCanvasGUICameraCapture.cs | 23 + .../FieLobbyCharacterSelectUIController.cs | 268 ++ src/Fie.UI/FieLobbyNameEntryUIController.cs | 22 + .../FieLobbySelectableUICharacterSelect.cs | 321 ++ ...eLobbySelectableUICharacterSelectButton.cs | 32 + src/Fie.UI/FieLobbySelectableUIController.cs | 426 +++ src/Fie.UI/FieLobbySelectableUIHeader.cs | 19 + src/Fie.UI/FieLobbySelectableUILevelSelect.cs | 76 + src/Fie.UI/FieResult.cs | 304 ++ src/Fie.UI/FieResultBar.cs | 191 + src/Fie.UI/FieResultLevelEffect.cs | 19 + src/Fie.UI/FieSkillTree.cs | 456 +++ src/Fie.UI/FieSkillTreeActivationEffect.cs | 28 + src/Fie.UI/FieSkillTreeBackButton.cs | 19 + src/Fie.UI/FieSkillTreeConfirmationUI.cs | 72 + src/Fie.UI/FieSkillTreeDetailCursorUI.cs | 31 + src/Fie.UI/FieSkillTreeDetailGuideUI.cs | 82 + src/Fie.UI/FieSkillTreeDetailWindow.cs | 181 + src/Fie.UI/FieSkillTreeEndPoint.cs | 177 + src/Fie.UI/FieSkillTreeExpAndLevelUI.cs | 37 + src/Fie.UI/FieSkillTreeHeaderUI.cs | 54 + .../FieSkillTreeReminingSkillPointsUI.cs | 19 + src/Fie.UI/FieSkillTreeRequirePointUI.cs | 90 + src/Fie.UI/FieSkillTreeRootObject.cs | 116 + src/Fie.UI/FieSkillTreeSelectablePoint.cs | 68 + src/Fie.UI/FieSkillTreeSkillGroupButton.cs | 43 + .../FieSkillTreeSkillGroupButtonRoot.cs | 40 + src/Fie.UI/FieUGUIUtilityGauge.cs | 138 + src/Fie.UI/FieUICameraCapture.cs | 25 + src/Fie.UI/FieUIConstant2DText.cs | 48 + src/Fie.UI/FieUIConstantText.cs | 29 + src/Fie.UI/FieUIDefaultSelective.cs | 10 + src/Fie.UI/FieUIGamePadEventSender.cs | 27 + src/Fie.UI/FieUIGamePadSelector.cs | 97 + src/Fie.UI/FieUILocalizedTextObjectBase.cs | 9 + src/Fie.UI/FieUIMouseEvent.cs | 133 + src/Fie.UI/FieUIOptionWindow.cs | 374 ++ src/Fie.UI/FieUIPlayerName.cs | 40 + src/Fie.UI/FieUISoundPlayer.cs | 49 + src/Fie.UI/FieUITextMeshProObject.cs | 34 + src/Fie.Utility.Debug/FieDrawTexture2D.cs | 290 ++ src/Fie.Utility/FieBgmBehaviour.cs | 32 + src/Fie.Utility/FieDeepClone.cs | 21 + src/Fie.Utility/FieParticlePlaygroundChain.cs | 65 + ...FieParticlePlaygroundPositionNormalizer.cs | 44 + src/Fie.Utility/FiePositionNormalizer.cs | 31 + src/Fie.Utility/FiePostProcessContainer.cs | 43 + src/Fie.Utility/FiePostProcessSegiDisabler.cs | 16 + src/Fie.Utility/FieRandom.cs | 31 + src/Fie.Utility/FieUtilAutoAudioTimeScaler.cs | 28 + .../FieUtilAutoPopcornFxActivator.cs | 31 + src/Fie.Utility/FieUtilBGM.cs | 34 + .../FieUtilCamperaParamToPopcornFX.cs | 53 + .../FieUtilPopcornFxForAnimation.cs | 19 + src/Fie.Utility/FieUtilRandomAudioPlayer.cs | 33 + src/Fie.Utility/FieUtilRotater.cs | 16 + src/Fie.Utility/FieUtilRotationLocker.cs | 13 + src/Fie.Utility/Lottery.cs | 66 + src/Fie.Utility/TweenTypesBase.cs | 28 + src/Fie.Utility/TweenTypesInOutSine.cs | 18 + src/Fie.Utility/TweenTypesInSine.cs | 13 + src/Fie.Utility/TweenTypesLinear.cs | 12 + src/Fie.Utility/TweenTypesOutSine.cs | 13 + src/Fie.Utility/Tweener.cs | 152 + src/Fie.Utility/Wiggler.cs | 122 + src/Fie.Voice/FieEmotionAnimationData.cs | 21 + src/Fie.Voice/FiePhonemeAnimationData.cs | 21 + src/Fie.Voice/FieVoiceController.cs | 352 ++ src/Fie.Voice/FieVoiceSpeaker.cs | 17 + src/Fie.Voice/Phoneme.cs | 16 + src/FieAudioSourceAnimationEvent.cs | 15 + src/FieBrobShadow.cs | 20 + src/FieCollider.cs | 87 + src/FieConstValues.cs | 940 +++++ src/FieDetector.cs | 491 +++ src/FieEmittableObjectManager.cs | 240 ++ src/FieEnemySpawner.cs | 131 + src/FieGameCharacter.cs | 1507 ++++++++ src/FieInput.cs | 43 + src/FieInputGamePadAndKeyboard.cs | 347 ++ src/FieLipSyncTest.cs | 34 + src/FieLobbyBootManager.cs | 20 + src/FieLocalizeUtility.cs | 73 + src/FieMasterData.cs | 116 + src/FieNetworkPlayerInstance.cs | 26 + src/FieOnetimeLight.cs | 59 + src/FiePhysicalForce.cs | 38 + src/FiePhysicalForceDynamic.cs | 28 + src/FiePrefabInfo.cs | 12 + src/FieRisingSunEffectManager.cs | 98 + src/FieSortingOrder.cs | 61 + src/FieTitleBootManager.cs | 16 + src/FieTwilightEffectManager.cs | 158 + src/FieWaveController.cs | 361 ++ src/FieWaveObject.cs | 10 + src/LoadBalancingPeer.cs | 484 +++ src/NetworkingPeer.cs | 3387 +++++++++++++++++ src/TwilightMagicSphere.cs | 16 + src/TwilightMagicSphereNormal.cs | 17 + src/ValueList.cs | 20 + 624 files changed, 59453 insertions(+) create mode 100644 src/CloudRegionCode.cs create mode 100644 src/CloudRegionFlag.cs create mode 100644 src/Fie.AI/FieAIControllerBase.cs create mode 100644 src/Fie.AI/FieAIHateController.cs create mode 100644 src/Fie.AI/FieAITaskApplejackBackstep.cs create mode 100644 src/Fie.AI/FieAITaskApplejackEnemyTracking.cs create mode 100644 src/Fie.AI/FieAITaskApplejackIdle.cs create mode 100644 src/Fie.AI/FieAITaskApplejackJump.cs create mode 100644 src/Fie.AI/FieAITaskApplejackMelee.cs create mode 100644 src/Fie.AI/FieAITaskApplejackRope.cs create mode 100644 src/Fie.AI/FieAITaskApplejackStomp.cs create mode 100644 src/Fie.AI/FieAITaskApplejackYeehaw.cs create mode 100644 src/Fie.AI/FieAITaskBase.cs create mode 100644 src/Fie.AI/FieAITaskChangelingAlphaCharge.cs create mode 100644 src/Fie.AI/FieAITaskChangelingAlphaIdle.cs create mode 100644 src/Fie.AI/FieAITaskChangelingAlphaShout.cs create mode 100644 src/Fie.AI/FieAITaskChangelingBackstep.cs create mode 100644 src/Fie.AI/FieAITaskChangelingIdle.cs create mode 100644 src/Fie.AI/FieAITaskChangelingMelee.cs create mode 100644 src/Fie.AI/FieAITaskChangelingShoot.cs create mode 100644 src/Fie.AI/FieAITaskChangelingWait.cs create mode 100644 src/Fie.AI/FieAITaskCommonIdle.cs create mode 100644 src/Fie.AI/FieAITaskController.cs create mode 100644 src/Fie.AI/FieAITaskEnemiesHoovesRacesEvadeBackWall.cs create mode 100644 src/Fie.AI/FieAITaskFlightlingAlphaShot.cs create mode 100644 src/Fie.AI/FieAITaskFlightlingFly.cs create mode 100644 src/Fie.AI/FieAITaskFlightlingFlyMove.cs create mode 100644 src/Fie.AI/FieAITaskFlightlingIdle.cs create mode 100644 src/Fie.AI/FieAITaskFlightlingShot.cs create mode 100644 src/Fie.AI/FieAITaskInterface.cs create mode 100644 src/Fie.AI/FieAITaskPoniesOwnerTracking.cs create mode 100644 src/Fie.AI/FieAITaskPoniesRescue.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisAirRaid.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisCrucible.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisDoubleSlash.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisIdle.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisIgnite.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisMeteoShower.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisShot.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysalisTeleportation.cs create mode 100644 src/Fie.AI/FieAITaskQueenChrysallisCallingMinion.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashDoublePayback.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashEnemyEvade.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashEnemyTracking.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashEvasion.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashIdle.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashJump.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashMelee.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashOmniSmash.cs create mode 100644 src/Fie.AI/FieAITaskRainbowDashRainblow.cs create mode 100644 src/Fie.AI/FieAITaskTwilightBase.cs create mode 100644 src/Fie.AI/FieAITaskTwilightBaseShot.cs create mode 100644 src/Fie.AI/FieAITaskTwilightEnemyEvade.cs create mode 100644 src/Fie.AI/FieAITaskTwilightForceField.cs create mode 100644 src/Fie.AI/FieAITaskTwilightIdle.cs create mode 100644 src/Fie.AI/FieAITaskTwilightJump.cs create mode 100644 src/Fie.AI/FieAITaskTwilightShinyArrow.cs create mode 100644 src/Fie.AI/FieAITaskTwilightSummonArrow.cs create mode 100644 src/Fie.Camera/FieCameraBase.cs create mode 100644 src/Fie.Camera/FieCameraOffset.cs create mode 100644 src/Fie.Camera/FieGameCamera.cs create mode 100644 src/Fie.Camera/FieGameCameraEverfreeVignette.cs create mode 100644 src/Fie.Camera/FieGameCameraTaskBase.cs create mode 100644 src/Fie.Camera/FieGameCameraTaskHorming.cs create mode 100644 src/Fie.Camera/FieGameCameraTaskLockOn.cs create mode 100644 src/Fie.Camera/FieGameCameraTaskStop.cs create mode 100644 src/Fie.Camera/FieSkillTreeCamera.cs create mode 100644 src/Fie.Camera/FieTitleCamera.cs create mode 100644 src/Fie.Camera/FieUICamera.cs create mode 100644 src/Fie.Core/FieBootstrap.cs create mode 100644 src/Fie.DebugUtility/FieDebugGameSceneBoot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieChangeling.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieChangelingAnimationContainer.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBite.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBiteHitEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingHitEffectSmall.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingVortex.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingArrival.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBackstep.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBaseAttack.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingMelee.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingShoot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingVortex.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlpha.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlphaAnimationContainer.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaCharge.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeFinish.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaHitEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionShout.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShout.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaCharge.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaChargeFinish.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShoot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShout.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaZeroDistanceCharge.cs create mode 100644 src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineEnemiesChangelingAlphaMove.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieFlightling.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieFlightlingAnimationContainer.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFly.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFlyMove.cs create mode 100644 src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingShoot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidPreHit.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRiad.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCommonActivationEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleCircle.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashFirst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashSecond.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectBurned.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectSmall.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShotActivateEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHornEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteCollision.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerMeteor.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotActivateEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisReflectionEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisShootingConcentration.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisStaggerRecoveringBurst.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalis.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisAnimationContainer.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisEffectManager.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineEnemiesQueenChrysalisStagger.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRaidFinished.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadAttacking.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadPrepare.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisBaseAttack.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCallingMinion.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCrucible.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisDoubleSlash.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisHormingShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIdle.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteFailed.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgnitePrepare.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteStart.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteSucceed.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisJumpIdle.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerAttacking.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerFinished.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerPrepare.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisPenetrateShot.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisRift.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisStaggerFall.cs create mode 100644 src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisTeleportation.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalFireEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalParticleEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesDeadEffect.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieEnemiesHoovesRaces.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesMove.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesRift.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStagger.cs create mode 100644 src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStaggerFall.cs create mode 100644 src/Fie.Enemies/FieEnemiesAnimationContainer.cs create mode 100644 src/Fie.Enemies/FieEnemiesHoovesRacesAnimationContainer.cs create mode 100644 src/Fie.Enemies/FieObjectEnemies.cs create mode 100644 src/Fie.Enemies/FieStateMachineEnemiesAttackIdle.cs create mode 100644 src/Fie.Fader/FieFader.cs create mode 100644 src/Fie.Fader/FieFaderElementDecsenter.cs create mode 100644 src/Fie.Footstep/FieFootstepMaterial.cs create mode 100644 src/Fie.Footstep/FieFootstepPlayer.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectGlowEyes.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectGlowInsect.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectGrass.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectInfiniGrass.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectOpeningCinematic.cs create mode 100644 src/Fie.LevelObject/FieLevelObjectTracePath.cs create mode 100644 src/Fie.Manager/FieActivityManager.cs create mode 100644 src/Fie.Manager/FieAcvitityQueue.cs create mode 100644 src/Fie.Manager/FieAudioManager.cs create mode 100644 src/Fie.Manager/FieCurrentGameManager.cs create mode 100644 src/Fie.Manager/FieDialogManager.cs create mode 100644 src/Fie.Manager/FieEnvironmentManager.cs create mode 100644 src/Fie.Manager/FieFaderManager.cs create mode 100644 src/Fie.Manager/FieGUIManager.cs create mode 100644 src/Fie.Manager/FieGameCameraManager.cs create mode 100644 src/Fie.Manager/FieGameCharacterManager.cs create mode 100644 src/Fie.Manager/FieInGameCharacterStatusManager.cs create mode 100644 src/Fie.Manager/FieInGameEnemyManager.cs create mode 100644 src/Fie.Manager/FieInGameStateManager.cs create mode 100644 src/Fie.Manager/FieInputManager.cs create mode 100644 src/Fie.Manager/FieLevelInfo.cs create mode 100644 src/Fie.Manager/FieLobbyGameCharacterGenerateManager.cs create mode 100644 src/Fie.Manager/FieManagerBase.cs create mode 100644 src/Fie.Manager/FieManagerBehaviour.cs create mode 100644 src/Fie.Manager/FieManagerExistSceneFlag.cs create mode 100644 src/Fie.Manager/FieManagerExists.cs create mode 100644 src/Fie.Manager/FieManagerFactory.cs create mode 100644 src/Fie.Manager/FieNetworkManager.cs create mode 100644 src/Fie.Manager/FieSaveData.cs create mode 100644 src/Fie.Manager/FieSaveManager.cs create mode 100644 src/Fie.Manager/FieSceneManager.cs create mode 100644 src/Fie.Manager/FieUserManager.cs create mode 100644 src/Fie.Manager/FieVibrationManager.cs create mode 100644 src/Fie.Object.Abilities/FieAbilitiesContainer.cs create mode 100644 src/Fie.Object.Abilities/FieAbilitiesCooldown.cs create mode 100644 src/Fie.Object.Abilities/FieAbilitiesSlot.cs create mode 100644 src/Fie.Object/FieAbilityActivationType.cs create mode 100644 src/Fie.Object/FieAbilityIDAttribute.cs create mode 100644 src/Fie.Object/FieAnimationContainerBase.cs create mode 100644 src/Fie.Object/FieAttribute.cs create mode 100644 src/Fie.Object/FieDamage.cs create mode 100644 src/Fie.Object/FieDamageSystem.cs create mode 100644 src/Fie.Object/FieEmitObjectPoniesArrival.cs create mode 100644 src/Fie.Object/FieEmitObjectPoniesGainedFriendship.cs create mode 100644 src/Fie.Object/FieEmitObjectPoniesRevive.cs create mode 100644 src/Fie.Object/FieEmittableObjectBase.cs create mode 100644 src/Fie.Object/FieEmotion.cs create mode 100644 src/Fie.Object/FieFriendshipdStats.cs create mode 100644 src/Fie.Object/FieGameCharacterBuildData.cs create mode 100644 src/Fie.Object/FieHealthStats.cs create mode 100644 src/Fie.Object/FieInGamePreloadEnemyContainer.cs create mode 100644 src/Fie.Object/FieInputControllerBase.cs create mode 100644 src/Fie.Object/FieMoveForce.cs create mode 100644 src/Fie.Object/FieNetworkObjectBase.cs create mode 100644 src/Fie.Object/FieObjectBaseState.cs create mode 100644 src/Fie.Object/FieObjectFlipState.cs create mode 100644 src/Fie.Object/FieObjectGroundState.cs create mode 100644 src/Fie.Object/FieObjectInterface.cs create mode 100644 src/Fie.Object/FiePlayableGameCharacterInterface.cs create mode 100644 src/Fie.Object/FiePlayerSpawnPoint.cs create mode 100644 src/Fie.Object/FieSkeletonAnimationController.cs create mode 100644 src/Fie.Object/FieSkeletonAnimationObject.cs create mode 100644 src/Fie.Object/FieStateMachineAbilityBase.cs create mode 100644 src/Fie.Object/FieStateMachineAbilityInterface.cs create mode 100644 src/Fie.Object/FieStateMachineAnyConsider.cs create mode 100644 src/Fie.Object/FieStateMachineCommonIdle.cs create mode 100644 src/Fie.Object/FieStateMachineGameCharacterBase.cs create mode 100644 src/Fie.Object/FieStateMachineInterface.cs create mode 100644 src/Fie.Object/FieStateMachineManager.cs create mode 100644 src/Fie.Object/FieStateMachinePoniesIdle.cs create mode 100644 src/Fie.Object/FieStateMachineStatusEffectPull.cs create mode 100644 src/Fie.Object/FieStatusEffectEntityBase.cs create mode 100644 src/Fie.Object/FieStatusEffectsBase.cs create mode 100644 src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttack.cs create mode 100644 src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttackEntity.cs create mode 100644 src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffence.cs create mode 100644 src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffenceEntity.cs create mode 100644 src/Fie.Object/FieStatusEffectsGrab.cs create mode 100644 src/Fie.Object/FieStatusEffectsGrabEntity.cs create mode 100644 src/Fie.Object/FieStatusEffectsPull.cs create mode 100644 src/Fie.Object/FieStatusEffectsPullEntity.cs create mode 100644 src/Fie.Object/FieStatusEffectsRift.cs create mode 100644 src/Fie.Object/FieStatusEffectsRiftEntity.cs create mode 100644 src/Fie.Object/FieStatusEffectsTimeScaler.cs create mode 100644 src/Fie.Object/FieStatusEffectsTimeScalerEntity.cs create mode 100644 src/Fie.Object/StateChangeDelegate.cs create mode 100644 src/Fie.Object/StatusEeffectType.cs create mode 100644 src/Fie.PlayMaker/FieActivityManagerForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieFaderManagerForPlayMaker.cs create mode 100644 src/Fie.PlayMaker/FieLanguageChangerForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieLobbyCharacterSelectUIControllerForPlayMaker.cs create mode 100644 src/Fie.PlayMaker/FieLobbyElementSelectUIButtonForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieLobbyNameEntryUIControllerForPlayMaker.cs create mode 100644 src/Fie.PlayMaker/FieLobbySelectableUIForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieNetworkManagerForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieResultActionForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieSceneManagerForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieTitleActionForPlaymaker.cs create mode 100644 src/Fie.PlayMaker/FieTitleLoginActionForPlayMaker.cs create mode 100644 src/Fie.PlayMaker/FieUIMouseEventForPlayMaker.cs create mode 100644 src/Fie.PlayMaker/FieUIOptionWindowForPlayMaker.cs create mode 100644 src/Fie.Ponies.Applejack/FieApplejack.cs create mode 100644 src/Fie.Ponies.Applejack/FieApplejackAnimationContainer.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackAirKick.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackCharge.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackChargeEffect.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectMiddle.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectSmall.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackKick.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect2.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickRift.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackPunch.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackRope.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackStomp.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehaw.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawFriendly.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawReflect.cs create mode 100644 src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawRegen.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackBackstep.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackBaseAttack.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackCharge.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackEvasion.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAir.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAirDouble.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKick.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKickRift.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFirePunch.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFireRope.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackFlying.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackJump.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackRope.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeAction.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeActionAir.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackStomp.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackStompAction.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackStompJump.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehaw.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawAction.cs create mode 100644 src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawActionMidAir.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashAwesomeEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack1.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack2.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack3.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashCloaking.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackActivationEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackAttackingEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackCollision.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackHitEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashEvasionEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectMiddle.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectSmall.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectStab.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashLoosingAwesomeEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashActivationEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosion.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosionEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFinishHit.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFirstHit.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashHitEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashImpactEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashRainboomEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashSecondHit.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashTrailEffect.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntity.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntityMidAir.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowSeed.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashStabAttack.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieRainbowDash.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieRainbowDashAnimationContainer.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieRainbowDashTrailRotator.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack1.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack2.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack3.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePayback.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackAttacking.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareMidAir.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareOnGround.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasion.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionBack.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionDown.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionFront.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionUp.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashFlying.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashJump.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmash.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashFinish.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashLoop.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashStart.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblow.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblowCloack.cs create mode 100644 src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashStabAttack.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunBaseShot.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunEmission.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceField.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEmitEffect.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEntity.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldReflectEffect.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectMiddle.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectSmall.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaser.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserChild.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserDust.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunShinyArrow.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSpellEffect.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrow.cs create mode 100644 src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrowChild.cs create mode 100644 src/Fie.Ponies.RisingSun/FieRisingSun.cs create mode 100644 src/Fie.Ponies.RisingSun/FieRisingSunAnimationContainer.cs create mode 100644 src/Fie.Ponies.RisingSun/FieRisingSunBigLaserUvOffset.cs create mode 100644 src/Fie.Ponies.RisingSun/FieRisingSunForceFieldUvOffset.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunBaseShot.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunEmission.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireBig.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireSmall.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFlying.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunJump.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunShinyArrow.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunSummonArrow.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportation.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndAir.cs create mode 100644 src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndGround.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightBaseShot.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightChargedEffect.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightExplosiveTeleportation.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceField.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEmitEffect.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEntity.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldReflectEffect.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectMiddle.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSemiMiddle.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSmall.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaser.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserChild.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserDust.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightShinyArrow.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightSpellEffect.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightStunningSummonArrowChild.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrow.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrowChild.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrap.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrapEntity.cs create mode 100644 src/Fie.Ponies.Twilight/FieEmitObjectTwilightTwinkleArrow.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightAttackIdle.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotActivator.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotCharging.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel1.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel2.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel3.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightFireSmall.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightFlying.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightForceField.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightJump.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightShinyArrow.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannon.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannonShooting.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightSummonArrow.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportation.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndAir.cs create mode 100644 src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndGround.cs create mode 100644 src/Fie.Ponies.Twilight/FieTwilight.cs create mode 100644 src/Fie.Ponies.Twilight/FieTwilightAnimationContainer.cs create mode 100644 src/Fie.Ponies.Twilight/FieTwilightBigLaserUvOffset.cs create mode 100644 src/Fie.Ponies.Twilight/FieTwilightForceFieldUvOffset.cs create mode 100644 src/Fie.Ponies/FiePonies.cs create mode 100644 src/Fie.Ponies/FiePoniesAnimationContainer.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesAbilitySlot1.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesAbilitySlot2.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesAbilitySlot3.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesArrival.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesAttackIdle.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesBaseAttack.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesDead.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesEvasion.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesGallop.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesGrabbed.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesJump.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesLanding.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesMove.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesRevive.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesRift.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesStagger.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesStaggerFall.cs create mode 100644 src/Fie.Ponies/FieStateMachinePoniesStaggerFallRecover.cs create mode 100644 src/Fie.Ponies/FieStateMachineRisingSunInterface.cs create mode 100644 src/Fie.Portal/FieDeparturePortal.cs create mode 100644 src/Fie.Portal/FiePortalBase.cs create mode 100644 src/Fie.Portal/FieReturnPortal.cs create mode 100644 src/Fie.Portal/FieVisualizedPortal.cs create mode 100644 src/Fie.PostEffect/FieCommandBufferReflection.cs create mode 100644 src/Fie.Scene/FieSceneBase.cs create mode 100644 src/Fie.Scene/FieSceneBootstrap.cs create mode 100644 src/Fie.Scene/FieSceneLink.cs create mode 100644 src/Fie.Scene/FieSceneLobby.cs create mode 100644 src/Fie.Scene/FieSceneMap1_1.cs create mode 100644 src/Fie.Scene/FieSceneMap1_2.cs create mode 100644 src/Fie.Scene/FieSceneMap1_3.cs create mode 100644 src/Fie.Scene/FieSceneMap1_4.cs create mode 100644 src/Fie.Scene/FieSceneResult.cs create mode 100644 src/Fie.Scene/FieSceneSurvivalLevel.cs create mode 100644 src/Fie.Scene/FieSceneTitle.cs create mode 100644 src/Fie.Scene/FieSceneType.cs create mode 100644 src/Fie.Title/FieTitleAuthController.cs create mode 100644 src/Fie.Title/FieTitleCameraOrbit.cs create mode 100644 src/Fie.Title/FieTitleCameraRotator.cs create mode 100644 src/Fie.Title/FieTitleCameraScaler.cs create mode 100644 src/Fie.Title/FieTitleElementsCicleScaleTilter.cs create mode 100644 src/Fie.Title/FieTitleElementsRotater.cs create mode 100644 src/Fie.Title/FieTitleElementsScaleNormalizer.cs create mode 100644 src/Fie.Title/FieTitleElementsShooter.cs create mode 100644 src/Fie.Title/FieTitleElementsTargetChanger.cs create mode 100644 src/Fie.Title/FieTitleOrbitalParticle.cs create mode 100644 src/Fie.Title/FieTitleVersionNumberDrawer.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconApplejack.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconBase.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconManager.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconRainbowDash.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconRisingSun.cs create mode 100644 src/Fie.UI/FieGameUIAbilitiesIconTwilight.cs create mode 100644 src/Fie.UI/FieGameUIActivityWindow.cs create mode 100644 src/Fie.UI/FieGameUIActivityWindowManager.cs create mode 100644 src/Fie.UI/FieGameUIActivityWindowText.cs create mode 100644 src/Fie.UI/FieGameUIBase.cs create mode 100644 src/Fie.UI/FieGameUIComponentManagerBase.cs create mode 100644 src/Fie.UI/FieGameUIDamageCounter.cs create mode 100644 src/Fie.UI/FieGameUIDamageCounterManager.cs create mode 100644 src/Fie.UI/FieGameUIDialogCaption.cs create mode 100644 src/Fie.UI/FieGameUIDialogCaptionManager.cs create mode 100644 src/Fie.UI/FieGameUIEnemyLifeGauge.cs create mode 100644 src/Fie.UI/FieGameUIEnemyLifeGaugeManager.cs create mode 100644 src/Fie.UI/FieGameUIFriendshipGauge.cs create mode 100644 src/Fie.UI/FieGameUIGainedScore.cs create mode 100644 src/Fie.UI/FieGameUIGameOverWindow.cs create mode 100644 src/Fie.UI/FieGameUIGameOverWindowManager.cs create mode 100644 src/Fie.UI/FieGameUIHeaderFooter.cs create mode 100644 src/Fie.UI/FieGameUIHeaderFooterManager.cs create mode 100644 src/Fie.UI/FieGameUIIndicator.cs create mode 100644 src/Fie.UI/FieGameUIIndicatorManager.cs create mode 100644 src/Fie.UI/FieGameUILifeGaugeBase.cs create mode 100644 src/Fie.UI/FieGameUIPlayerLifeGauge.cs create mode 100644 src/Fie.UI/FieGameUIPlayerWindow.cs create mode 100644 src/Fie.UI/FieGameUIPlayerWindowManager.cs create mode 100644 src/Fie.UI/FieGameUISplitLine.cs create mode 100644 src/Fie.UI/FieGameUITargetIcon.cs create mode 100644 src/Fie.UI/FieLobbyCanvasGUICameraCapture.cs create mode 100644 src/Fie.UI/FieLobbyCharacterSelectUIController.cs create mode 100644 src/Fie.UI/FieLobbyNameEntryUIController.cs create mode 100644 src/Fie.UI/FieLobbySelectableUICharacterSelect.cs create mode 100644 src/Fie.UI/FieLobbySelectableUICharacterSelectButton.cs create mode 100644 src/Fie.UI/FieLobbySelectableUIController.cs create mode 100644 src/Fie.UI/FieLobbySelectableUIHeader.cs create mode 100644 src/Fie.UI/FieLobbySelectableUILevelSelect.cs create mode 100644 src/Fie.UI/FieResult.cs create mode 100644 src/Fie.UI/FieResultBar.cs create mode 100644 src/Fie.UI/FieResultLevelEffect.cs create mode 100644 src/Fie.UI/FieSkillTree.cs create mode 100644 src/Fie.UI/FieSkillTreeActivationEffect.cs create mode 100644 src/Fie.UI/FieSkillTreeBackButton.cs create mode 100644 src/Fie.UI/FieSkillTreeConfirmationUI.cs create mode 100644 src/Fie.UI/FieSkillTreeDetailCursorUI.cs create mode 100644 src/Fie.UI/FieSkillTreeDetailGuideUI.cs create mode 100644 src/Fie.UI/FieSkillTreeDetailWindow.cs create mode 100644 src/Fie.UI/FieSkillTreeEndPoint.cs create mode 100644 src/Fie.UI/FieSkillTreeExpAndLevelUI.cs create mode 100644 src/Fie.UI/FieSkillTreeHeaderUI.cs create mode 100644 src/Fie.UI/FieSkillTreeReminingSkillPointsUI.cs create mode 100644 src/Fie.UI/FieSkillTreeRequirePointUI.cs create mode 100644 src/Fie.UI/FieSkillTreeRootObject.cs create mode 100644 src/Fie.UI/FieSkillTreeSelectablePoint.cs create mode 100644 src/Fie.UI/FieSkillTreeSkillGroupButton.cs create mode 100644 src/Fie.UI/FieSkillTreeSkillGroupButtonRoot.cs create mode 100644 src/Fie.UI/FieUGUIUtilityGauge.cs create mode 100644 src/Fie.UI/FieUICameraCapture.cs create mode 100644 src/Fie.UI/FieUIConstant2DText.cs create mode 100644 src/Fie.UI/FieUIConstantText.cs create mode 100644 src/Fie.UI/FieUIDefaultSelective.cs create mode 100644 src/Fie.UI/FieUIGamePadEventSender.cs create mode 100644 src/Fie.UI/FieUIGamePadSelector.cs create mode 100644 src/Fie.UI/FieUILocalizedTextObjectBase.cs create mode 100644 src/Fie.UI/FieUIMouseEvent.cs create mode 100644 src/Fie.UI/FieUIOptionWindow.cs create mode 100644 src/Fie.UI/FieUIPlayerName.cs create mode 100644 src/Fie.UI/FieUISoundPlayer.cs create mode 100644 src/Fie.UI/FieUITextMeshProObject.cs create mode 100644 src/Fie.Utility.Debug/FieDrawTexture2D.cs create mode 100644 src/Fie.Utility/FieBgmBehaviour.cs create mode 100644 src/Fie.Utility/FieDeepClone.cs create mode 100644 src/Fie.Utility/FieParticlePlaygroundChain.cs create mode 100644 src/Fie.Utility/FieParticlePlaygroundPositionNormalizer.cs create mode 100644 src/Fie.Utility/FiePositionNormalizer.cs create mode 100644 src/Fie.Utility/FiePostProcessContainer.cs create mode 100644 src/Fie.Utility/FiePostProcessSegiDisabler.cs create mode 100644 src/Fie.Utility/FieRandom.cs create mode 100644 src/Fie.Utility/FieUtilAutoAudioTimeScaler.cs create mode 100644 src/Fie.Utility/FieUtilAutoPopcornFxActivator.cs create mode 100644 src/Fie.Utility/FieUtilBGM.cs create mode 100644 src/Fie.Utility/FieUtilCamperaParamToPopcornFX.cs create mode 100644 src/Fie.Utility/FieUtilPopcornFxForAnimation.cs create mode 100644 src/Fie.Utility/FieUtilRandomAudioPlayer.cs create mode 100644 src/Fie.Utility/FieUtilRotater.cs create mode 100644 src/Fie.Utility/FieUtilRotationLocker.cs create mode 100644 src/Fie.Utility/Lottery.cs create mode 100644 src/Fie.Utility/TweenTypesBase.cs create mode 100644 src/Fie.Utility/TweenTypesInOutSine.cs create mode 100644 src/Fie.Utility/TweenTypesInSine.cs create mode 100644 src/Fie.Utility/TweenTypesLinear.cs create mode 100644 src/Fie.Utility/TweenTypesOutSine.cs create mode 100644 src/Fie.Utility/Tweener.cs create mode 100644 src/Fie.Utility/Wiggler.cs create mode 100644 src/Fie.Voice/FieEmotionAnimationData.cs create mode 100644 src/Fie.Voice/FiePhonemeAnimationData.cs create mode 100644 src/Fie.Voice/FieVoiceController.cs create mode 100644 src/Fie.Voice/FieVoiceSpeaker.cs create mode 100644 src/Fie.Voice/Phoneme.cs create mode 100644 src/FieAudioSourceAnimationEvent.cs create mode 100644 src/FieBrobShadow.cs create mode 100644 src/FieCollider.cs create mode 100644 src/FieConstValues.cs create mode 100644 src/FieDetector.cs create mode 100644 src/FieEmittableObjectManager.cs create mode 100644 src/FieEnemySpawner.cs create mode 100644 src/FieGameCharacter.cs create mode 100644 src/FieInput.cs create mode 100644 src/FieInputGamePadAndKeyboard.cs create mode 100644 src/FieLipSyncTest.cs create mode 100644 src/FieLobbyBootManager.cs create mode 100644 src/FieLocalizeUtility.cs create mode 100644 src/FieMasterData.cs create mode 100644 src/FieNetworkPlayerInstance.cs create mode 100644 src/FieOnetimeLight.cs create mode 100644 src/FiePhysicalForce.cs create mode 100644 src/FiePhysicalForceDynamic.cs create mode 100644 src/FiePrefabInfo.cs create mode 100644 src/FieRisingSunEffectManager.cs create mode 100644 src/FieSortingOrder.cs create mode 100644 src/FieTitleBootManager.cs create mode 100644 src/FieTwilightEffectManager.cs create mode 100644 src/FieWaveController.cs create mode 100644 src/FieWaveObject.cs create mode 100644 src/LoadBalancingPeer.cs create mode 100644 src/NetworkingPeer.cs create mode 100644 src/TwilightMagicSphere.cs create mode 100644 src/TwilightMagicSphereNormal.cs create mode 100644 src/ValueList.cs diff --git a/src/CloudRegionCode.cs b/src/CloudRegionCode.cs new file mode 100644 index 0000000..9454808 --- /dev/null +++ b/src/CloudRegionCode.cs @@ -0,0 +1,14 @@ +public enum CloudRegionCode +{ + eu = 0, + us = 1, + asia = 2, + jp = 3, + au = 5, + usw = 6, + sa = 7, + cae = 8, + kr = 9, + @in = 10, + none = 4 +} diff --git a/src/CloudRegionFlag.cs b/src/CloudRegionFlag.cs new file mode 100644 index 0000000..a2d876c --- /dev/null +++ b/src/CloudRegionFlag.cs @@ -0,0 +1,16 @@ +using System; + +[Flags] +public enum CloudRegionFlag +{ + eu = 0x1, + us = 0x2, + asia = 0x4, + jp = 0x8, + au = 0x10, + usw = 0x20, + sa = 0x40, + cae = 0x80, + kr = 0x100, + @in = 0x200 +} diff --git a/src/Fie.AI/FieAIControllerBase.cs b/src/Fie.AI/FieAIControllerBase.cs new file mode 100644 index 0000000..a2e19b0 --- /dev/null +++ b/src/Fie.AI/FieAIControllerBase.cs @@ -0,0 +1,8 @@ +using Fie.Object; + +namespace Fie.AI +{ + public class FieAIControllerBase : FieInputControllerBase + { + } +} diff --git a/src/Fie.AI/FieAIHateController.cs b/src/Fie.AI/FieAIHateController.cs new file mode 100644 index 0000000..bc56b07 --- /dev/null +++ b/src/Fie.AI/FieAIHateController.cs @@ -0,0 +1,99 @@ +using Fie.Object; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAIHateController : FieAIControllerBase + { + private float MAXIMUM_STACKED_HATE = 6f; + + private Dictionary _hateCorutine = new Dictionary(); + + private Dictionary _hateList = new Dictionary(); + + private void Start() + { + _ownerCharacter.damageSystem.damagedEvent += delegate(FieGameCharacter attacker, FieDamage damage) + { + if (!(attacker == null) && damage != null && PhotonNetwork.isMasterClient) + { + AddHate(attacker, damage.hate); + } + }; + } + + private void AddHate(FieGameCharacter attaker, float hate) + { + if (!(attaker == null)) + { + int instanceID = attaker.GetInstanceID(); + if (_hateCorutine.ContainsKey(instanceID)) + { + StopCoroutine(_hateCorutine[instanceID]); + } + if (!_hateList.ContainsKey(instanceID)) + { + _hateList[instanceID] = hate; + } + else + { + _hateList[instanceID] = Mathf.Min(_hateList[instanceID] + hate, MAXIMUM_STACKED_HATE); + } + _hateCorutine[instanceID] = CalculateHateCoroutine(instanceID); + StartCoroutine(_hateCorutine[instanceID]); + } + } + + private void Update() + { + updateLockonTargetByHate(); + } + + private void updateLockonTargetByHate() + { + if (_hateList.Count > 0) + { + bool flag = false; + int instanceId = 0; + float num = 0f; + foreach (KeyValuePair hate in _hateList) + { + if (num < hate.Value) + { + instanceId = hate.Key; + flag = true; + } + num = Mathf.Max(num, hate.Value); + } + if (flag) + { + _ownerCharacter.detector.ChangeLockonTargetByInstanceID(instanceId); + } + } + } + + private IEnumerator CalculateHateCoroutine(int attackerInstanceId) + { + if (_hateList.ContainsKey(attackerInstanceId)) + { + Dictionary hateList; + int key; + (hateList = _hateList)[key = attackerInstanceId] = hateList[key] - Time.deltaTime; + if (!(_hateList[attackerInstanceId] <= 0f)) + { + yield return (object)0; + /*Error: Unable to find new state assignment for yield return*/; + } + _hateList.Remove(attackerInstanceId); + } + if (_hateCorutine.ContainsKey(attackerInstanceId)) + { + _hateCorutine.Remove(attackerInstanceId); + } + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackBackstep.cs b/src/Fie.AI/FieAITaskApplejackBackstep.cs new file mode 100644 index 0000000..d3988bc --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackBackstep.cs @@ -0,0 +1,64 @@ +using Fie.Object; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackBackstep : FieAITaskBase + { + private enum StepState + { + STATE_PREPARE, + STATE_STEP + } + + private const float ATTACK_DISTANCE = 15f; + + private bool _isEndState; + + private StepState _stepState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = false; + _stepState = StepState.STATE_PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.groundState != 0) + { + return true; + } + switch (_stepState) + { + case StepState.STATE_PREPARE: + { + Vector3 directionalVec = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)); + manager.ownerCharacter.RequestToChangeState(directionalVec, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineApplejackEvasion || currentStateMachine is FieStateMachineApplejackBackstep || currentStateMachine is FieStateMachineApplejackCharge) + { + currentStateMachine.stateChangeEvent += delegate + { + _isEndState = true; + }; + _stepState = StepState.STATE_STEP; + } + else + { + _isEndState = true; + } + break; + } + case StepState.STATE_STEP: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackEnemyTracking.cs b/src/Fie.AI/FieAITaskApplejackEnemyTracking.cs new file mode 100644 index 0000000..ddb1e35 --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackEnemyTracking.cs @@ -0,0 +1,35 @@ +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackEnemyTracking : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position); + if (!(num > 2f)) + { + Vector3 position = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position; + float y = position.y; + Vector3 position2 = manager.ownerCharacter.transform.position; + if (y > position2.y + 5f && manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieStateMachineApplejackRope)] = 100; + return true; + } + return true; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackIdle.cs b/src/Fie.AI/FieAITaskApplejackIdle.cs new file mode 100644 index 0000000..03f1d0c --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackIdle.cs @@ -0,0 +1,85 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackIdle : FieAITaskBase + { + private FieGameCharacter injuryCharacter; + + public override void Initialize(FieAITaskController manager) + { + if (Random.Range(0f, 100f) > 50f) + { + FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter(); + if (randomEnemyGameCharacter != null) + { + manager.ownerCharacter.detector.ChangeLockonTargetByInstanceID(randomEnemyGameCharacter.GetInstanceID()); + } + } + injuryCharacter = FieManagerBehaviour.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter); + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.groundState != 0) + { + return false; + } + if (manager.ownerCharacter.damageSystem.isDead) + { + if (manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 3) + { + (manager.ownerCharacter as FiePonies).TryToRevive(); + } + return true; + } + if (injuryCharacter != null && manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 2) + { + nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100; + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, FieManagerBehaviour.I.gameOwnerCharacter.transform.position); + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + if (num > 2.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + return false; + } + float num2 = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position); + if (num2 > 4.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (num2 > 2.5f) + { + nextStateWeightList[typeof(FieAITaskApplejackEnemyTracking)] = 500; + if (manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskApplejackRope)] = 500; + } + return true; + } + if (manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f && manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskApplejackStomp)] = (int)Mathf.Max(1000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 100f); + nextStateWeightList[typeof(FieAITaskApplejackYeehaw)] = (int)Mathf.Max(2000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 500f); + return true; + } + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 200; + if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding) + { + nextStateWeightList[typeof(FieAITaskApplejackJump)] = 200; + } + nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 200; + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackJump.cs b/src/Fie.AI/FieAITaskApplejackJump.cs new file mode 100644 index 0000000..21df177 --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackJump.cs @@ -0,0 +1,65 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackJump : FieAITaskBase + { + public const float JUMPING_MAXIMUM_TIME = 3f; + + public const float JUMPING_THRESHOLD_TIME = 0.3f; + + private float _lifeCount; + + private float _jumpCount; + + private bool _isJump; + + public override void Initialize(FieAITaskController manager) + { + _lifeCount = 0f; + _jumpCount = 0f; + _isJump = false; + } + + public override bool Task(FieAITaskController manager) + { + _lifeCount += Time.deltaTime; + if (_lifeCount >= 3f) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (_isJump) + { + if (manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f && manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskApplejackRope)] = 100; + nextStateWeightList[typeof(FieAITaskApplejackStomp)] = 100; + } + else + { + nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 100; + } + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineApplejackFlying)) + { + return true; + } + _jumpCount += Time.deltaTime; + if (_jumpCount > 0.3f) + { + _isJump = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackMelee.cs b/src/Fie.AI/FieAITaskApplejackMelee.cs new file mode 100644 index 0000000..3a72b9e --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackMelee.cs @@ -0,0 +1,63 @@ +using Fie.Object; +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackMelee : FieAITaskBase + { + public const float MELEE_TIME_MAX = 3f; + + public const float MELEE_TIME_MIN = 1.5f; + + private bool _isEnd; + + private float _lifeCount; + + private float _meleeCount; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + _lifeCount = 0f; + _meleeCount = Random.Range(1.5f, 3f); + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + _lifeCount += Time.deltaTime; + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position); + if (num > 45f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (_lifeCount >= _meleeCount) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackRope.cs b/src/Fie.AI/FieAITaskApplejackRope.cs new file mode 100644 index 0000000..e67efaf --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackRope.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackRope : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (!_isAssigned) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineApplejackRopeAction) && !(currentStateMachine is FieStateMachineApplejackRopeActionAir)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 100; + _isEnd = true; + }; + _isAssigned = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackStomp.cs b/src/Fie.AI/FieAITaskApplejackStomp.cs new file mode 100644 index 0000000..fb2e256 --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackStomp.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackStomp : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (!_isAssigned) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineApplejackStompAction)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100; + _isEnd = true; + }; + _isAssigned = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskApplejackYeehaw.cs b/src/Fie.AI/FieAITaskApplejackYeehaw.cs new file mode 100644 index 0000000..a0ca864 --- /dev/null +++ b/src/Fie.AI/FieAITaskApplejackYeehaw.cs @@ -0,0 +1,58 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Applejack; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskApplejackYeehaw : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (!_isAssigned) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineApplejackYeehawAction) + { + currentStateMachine.stateChangeEvent += delegate + { + _isEnd = true; + }; + _isAssigned = true; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskBase.cs b/src/Fie.AI/FieAITaskBase.cs new file mode 100644 index 0000000..229dc11 --- /dev/null +++ b/src/Fie.AI/FieAITaskBase.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.AI +{ + public abstract class FieAITaskBase : FieAITaskInterface + { + protected delegate bool TaskDelegate(FieAITaskController manager); + + protected float currentTime; + + public Dictionary nextStateWeightList = new Dictionary(); + + protected event TaskDelegate taskEvent; + + public FieAITaskBase() + { + taskEvent += Task; + } + + public virtual bool TaskExec(FieAITaskController manager) + { + if (this.taskEvent == null) + { + return true; + } + currentTime += Time.deltaTime; + return this.taskEvent(manager); + } + + public virtual void Initialize(FieAITaskController manager) + { + } + + public virtual void Terminate(FieAITaskController manager) + { + } + + public abstract bool Task(FieAITaskController manager); + + public Dictionary GetWeight() + { + return nextStateWeightList; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingAlphaCharge.cs b/src/Fie.AI/FieAITaskChangelingAlphaCharge.cs new file mode 100644 index 0000000..3f835d7 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingAlphaCharge.cs @@ -0,0 +1,124 @@ +using Fie.Enemies.HoovesRaces.ChangelingAlpha; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingAlphaCharge : FieAITaskBase + { + private enum MeleeState + { + STATE_PREPARE, + STATE_MELEE + } + + private const float HORMING_SEC_MAX = 2f; + + private const float HORMING_SEC_MIN = 1.5f; + + private const float ATTACK_DISTANCE = 2.75f; + + public float _currentHormingCount; + + private bool _isFirstCheck = true; + + private bool _isEndState; + + private MeleeState _meleeState; + + public override void Initialize(FieAITaskController manager) + { + _currentHormingCount = 0f; + _isFirstCheck = true; + _isEndState = false; + _meleeState = MeleeState.STATE_PREPARE; + if (manager.ownerCharacter != null) + { + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + } + + public override void Terminate(FieAITaskController manager) + { + if (manager.ownerCharacter != null) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEndState) + { + return true; + } + _currentHormingCount += Time.deltaTime; + if (!(manager.ownerCharacter.detector.lockonTargetObject != null)) + { + return true; + } + switch (_meleeState) + { + case MeleeState.STATE_PREPARE: + { + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position); + if (num > 2.75f) + { + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + } + else if (_isFirstCheck) + { + Vector3 vector2 = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector2.y = vector2.z; + vector2.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector2.normalized, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineChangelingAlphaZeroDistanceCharge)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + }; + _meleeState = MeleeState.STATE_MELEE; + } + else + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine2 is FieStateMachineChangelingAlphaChargeFinish)) + { + return true; + } + currentStateMachine2.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + }; + _meleeState = MeleeState.STATE_MELEE; + } + _isFirstCheck = false; + break; + } + case MeleeState.STATE_MELEE: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingAlphaIdle.cs b/src/Fie.AI/FieAITaskChangelingAlphaIdle.cs new file mode 100644 index 0000000..1409c0d --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingAlphaIdle.cs @@ -0,0 +1,32 @@ +using Fie.Enemies.HoovesRaces; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingAlphaIdle : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return false; + } + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(); + if (frontAndBackPoint.backDistance > 0f) + { + nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100; + return true; + } + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineEnemiesHoovesRacesStagger) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + return true; + } + nextStateWeightList[typeof(FieAITaskChangelingAlphaShout)] = (int)Mathf.Max(2000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 1000f); + nextStateWeightList[typeof(FieAITaskFlightlingAlphaShot)] = (int)Mathf.Max(1000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 400f); + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingAlphaShout.cs b/src/Fie.AI/FieAITaskChangelingAlphaShout.cs new file mode 100644 index 0000000..bc27998 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingAlphaShout.cs @@ -0,0 +1,85 @@ +using Fie.Enemies.HoovesRaces.ChangelingAlpha; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingAlphaShout : FieAITaskBase + { + private enum ShoutState + { + PREPARE, + CONCENTRATE, + DO, + DELAY + } + + private const float SHOUT_TIME = 0.8f; + + private float timeCount; + + private ShoutState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + timeCount = 0f; + _state = ShoutState.PREPARE; + _isEndState = false; + if (manager.ownerCharacter != null) + { + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + } + + public override void Terminate(FieAITaskController manager) + { + if (manager.ownerCharacter != null) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + } + + public override bool Task(FieAITaskController manager) + { + timeCount += Time.deltaTime; + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case ShoutState.PREPARE: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _state = ShoutState.CONCENTRATE; + break; + case ShoutState.CONCENTRATE: + if (!(timeCount >= 0.8f)) + { + break; + } + _state = ShoutState.DO; + goto case ShoutState.DO; + case ShoutState.DO: + nextStateWeightList[typeof(FieAITaskChangelingAlphaCharge)] = 100; + return true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingBackstep.cs b/src/Fie.AI/FieAITaskChangelingBackstep.cs new file mode 100644 index 0000000..ebedc0d --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingBackstep.cs @@ -0,0 +1,60 @@ +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskChangelingBackstep : FieAITaskBase + { + private enum StepState + { + STATE_PREPARE, + STATE_STEP + } + + private const float ATTACK_DISTANCE = 1.5f; + + public const float EXECUTABLE_INTERVAL = 0.5f; + + private bool _isEndState; + + private StepState _stepState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = false; + _stepState = StepState.STATE_PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingBackstep)) < 0.5f) + { + return true; + } + switch (_stepState) + { + case StepState.STATE_PREPARE: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineChangelingBackstep) + { + currentStateMachine.stateChangeEvent += delegate + { + _isEndState = true; + }; + _stepState = StepState.STATE_STEP; + } + break; + } + case StepState.STATE_STEP: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingIdle.cs b/src/Fie.AI/FieAITaskChangelingIdle.cs new file mode 100644 index 0000000..2dfd4b1 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingIdle.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingIdle : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return false; + } + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(); + if (frontAndBackPoint.backDistance > 0f) + { + nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100; + return true; + } + nextStateWeightList[typeof(FieAITaskChangelingMelee)] = (int)Mathf.Max(1000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 400f); + nextStateWeightList[typeof(FieAITaskChangelingShoot)] = (int)Mathf.Max(1000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 400f); + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingMelee.cs b/src/Fie.AI/FieAITaskChangelingMelee.cs new file mode 100644 index 0000000..18bce93 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingMelee.cs @@ -0,0 +1,133 @@ +using Fie.Enemies.HoovesRaces; +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingMelee : FieAITaskBase + { + private enum MeleeState + { + STATE_PREPARE, + STATE_MELEE + } + + private const float HORMING_SEC_MAX = 2f; + + private const float HORMING_SEC_MIN = 1.5f; + + private const float SHOOT_THLESHOLD_HEIGHT = 1.5f; + + public const float VORTEX_DISTANCE = 2f; + + public const float ATTACK_DISTANCE = 2.5f; + + public float _hormingCount; + + public float _currentHormingCount; + + private bool _isFirstCheck = true; + + private bool _isEndState; + + private MeleeState _meleeState; + + public override void Initialize(FieAITaskController manager) + { + _currentHormingCount = 0f; + _isFirstCheck = true; + _isEndState = false; + _meleeState = MeleeState.STATE_PREPARE; + _hormingCount = Random.Range(1.5f, 2f); + } + + public override bool Task(FieAITaskController manager) + { + _currentHormingCount += Time.deltaTime; + if (manager.ownerCharacter.groundState != 0) + { + return true; + } + if (_currentHormingCount > _hormingCount) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + return true; + } + if (!(manager.ownerCharacter.detector.lockonTargetObject != null)) + { + return true; + } + switch (_meleeState) + { + case MeleeState.STATE_PREPARE: + { + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position); + if (num > 2.5f) + { + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + Vector3 position = manager.ownerCharacter.detector.lockonTargetObject.transform.position; + float y = position.y; + Vector3 position2 = manager.ownerCharacter.position; + if (Mathf.Abs(y - position2.y) > 1.5f && manager.getExecutedTaskInterval(typeof(FieAITaskChangelingShoot)) > 1f) + { + manager.ResetQueueTask(); + if (num < 2.5f) + { + manager.AddQueueTask(); + } + manager.AddQueueTask(); + _isEndState = true; + return true; + } + } + else if (num < 2f && _isFirstCheck) + { + Vector3 vector2 = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector2.y = vector2.z; + vector2.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector2.normalized, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineChangelingVortex)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + }; + _meleeState = MeleeState.STATE_MELEE; + } + else + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine2 is FieStateMachineChangelingMelee)) + { + return true; + } + currentStateMachine2.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + }; + _meleeState = MeleeState.STATE_MELEE; + } + _isFirstCheck = false; + break; + } + case MeleeState.STATE_MELEE: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingShoot.cs b/src/Fie.AI/FieAITaskChangelingShoot.cs new file mode 100644 index 0000000..7f4d5e3 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingShoot.cs @@ -0,0 +1,135 @@ +using Fie.Enemies.HoovesRaces; +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingShoot : FieAITaskBase + { + private enum ShootState + { + STATE_RANGE_CALIBRATION, + STATE_PREPARE, + STATE_SHOOT + } + + private const int SHOT_COUNT_MIN = 2; + + private const int SHOT_COUNT_MAX = 2; + + private const float RUNAWAY_SEC_MAX = 2f; + + private const float RUNAWAY_SEC_MIN = 1.5f; + + public const float SHOOT_DISTANCE = 2.5f; + + public const float EXECUTABLE_INTERVAL = 1f; + + private int _maxShotCount; + + private int _shotCount; + + private bool _isEndState; + + public float _runAwayCount; + + public float _currentRunAwayCount; + + private ShootState _shootState; + + public FieAITaskChangelingShoot() + { + _maxShotCount = Random.Range(2, 3); + } + + public override void Initialize(FieAITaskController manager) + { + _maxShotCount = 0; + _shotCount = 0; + _isEndState = false; + _currentRunAwayCount = 0f; + _shootState = ShootState.STATE_RANGE_CALIBRATION; + _runAwayCount = Random.Range(1.5f, 2f); + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.groundState != 0) + { + return true; + } + if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingShoot)) < 1f) + { + manager.AddQueueTask(); + return true; + } + if (!(manager.ownerCharacter.detector.lockonTargetObject != null)) + { + return true; + } + switch (_shootState) + { + case ShootState.STATE_RANGE_CALIBRATION: + { + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position); + if (num < 2.5f) + { + _currentRunAwayCount += Time.deltaTime; + if (_currentRunAwayCount > _runAwayCount) + { + manager.AddQueueTask(); + manager.AddQueueTask(); + return true; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector.y = (vector.z = 0f); + vector *= -1f; + vector.Normalize(); + if (vector.y > 0.5f) + { + vector.y = 0.5f; + vector.Normalize(); + } + manager.ownerCharacter.RequestToChangeState(vector, 1f, FieGameCharacter.StateMachineType.Base); + } + else + { + _shootState = ShootState.STATE_PREPARE; + } + break; + } + case ShootState.STATE_PREPARE: + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineChangelingShoot)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + _shotCount++; + if (_shotCount < _maxShotCount) + { + _shootState = ShootState.STATE_PREPARE; + } + else + { + _isEndState = true; + } + }; + _shootState = ShootState.STATE_SHOOT; + break; + } + case ShootState.STATE_SHOOT: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskChangelingWait.cs b/src/Fie.AI/FieAITaskChangelingWait.cs new file mode 100644 index 0000000..ed9f1c3 --- /dev/null +++ b/src/Fie.AI/FieAITaskChangelingWait.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskChangelingWait : FieAITaskBase + { + private const float EXECUTABLE_INTERVAL = 5f; + + public const float WAIT_SEC_MAX = 1f; + + public const float WAIT_SEC_MIN = 0.5f; + + public float _waitCount; + + public float _currentWaitCount; + + public override void Initialize(FieAITaskController manager) + { + _currentWaitCount = 0f; + _waitCount = Random.Range(0.5f, 1f); + } + + public override bool Task(FieAITaskController manager) + { + if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingWait)) < 5f) + { + return true; + } + _currentWaitCount += Time.deltaTime; + if (_currentWaitCount >= _waitCount) + { + return true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskCommonIdle.cs b/src/Fie.AI/FieAITaskCommonIdle.cs new file mode 100644 index 0000000..67ef499 --- /dev/null +++ b/src/Fie.AI/FieAITaskCommonIdle.cs @@ -0,0 +1,10 @@ +namespace Fie.AI +{ + public class FieAITaskCommonIdle : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskController.cs b/src/Fie.AI/FieAITaskController.cs new file mode 100644 index 0000000..c7709ca --- /dev/null +++ b/src/Fie.AI/FieAITaskController.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskController : FieAIControllerBase + { + public struct FieAIFrontAndBackPoint + { + public float frontDistance; + + public float backDistance; + + public Vector3 frontPoint; + + public Vector3 backPoint; + } + + public Dictionary taskExecuteTimeList = new Dictionary(); + + private Dictionary taskCache = new Dictionary(); + + private Queue preQueueTaskList = new Queue(); + + private FieAITaskBase currentTask; + + public void Start() + { + currentTask = getStartAI(); + } + + public void Update() + { + if (!(base.ownerCharacter == null) && PhotonNetwork.isMasterClient && currentTask.TaskExec(this)) + { + currentTask.Terminate(this); + taskExecuteTimeList[currentTask.GetType()] = Time.time; + if (preQueueTaskList.Count > 0) + { + currentTask = preQueueTaskList.Dequeue(); + } + else + { + currentTask = getNextTask(currentTask.GetWeight()); + } + if (currentTask != null) + { + currentTask.nextStateWeightList.Clear(); + currentTask.Initialize(this); + } + } + } + + public void resetTask() + { + currentTask = getStartAI(); + } + + private FieAITaskBase getTaskInstanceFromCache(Type type) + { + if (!taskCache.ContainsKey(type)) + { + FieAITaskBase fieAITaskBase = Activator.CreateInstance(type) as FieAITaskBase; + if (fieAITaskBase == null || !fieAITaskBase.GetType().IsSubclassOf(typeof(FieAITaskBase))) + { + return null; + } + taskCache[type] = fieAITaskBase; + } + return taskCache[type]; + } + + private FieAITaskBase getNextTask(Dictionary weightList) + { + if (weightList.Count == 1) + { + using (Dictionary.Enumerator enumerator = weightList.GetEnumerator()) + { + if (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + if (current.Key.IsSubclassOf(typeof(FieAITaskBase))) + { + return getTaskInstanceFromCache(current.Key); + } + } + } + } + else if (weightList.Count > 1) + { + int num = 0; + foreach (KeyValuePair weight in weightList) + { + num += weight.Value; + } + if (num > 0) + { + int num2 = UnityEngine.Random.Range(0, num); + int num3 = 1; + foreach (KeyValuePair weight2 in weightList) + { + num3 += weight2.Value; + if (num2 <= num3 - 1) + { + if (!weight2.Key.IsSubclassOf(typeof(FieAITaskBase))) + { + break; + } + return getTaskInstanceFromCache(weight2.Key); + } + } + } + } + return getStartAI(); + } + + private FieAITaskBase getStartAI() + { + return getTaskInstanceFromCache(base.ownerCharacter.getDefaultAITask()); + } + + public float getExecutedTaskInterval(Type taskType) + { + if (!taskExecuteTimeList.ContainsKey(taskType)) + { + return 3.40282347E+38f; + } + return Time.time - taskExecuteTimeList[taskType]; + } + + public void ResetQueueTask() + { + preQueueTaskList.Clear(); + } + + public void AddQueueTask() where T : FieAITaskBase + { + preQueueTaskList.Enqueue(getTaskInstanceFromCache(typeof(T))); + } + + public FieAIFrontAndBackPoint GetFrontAndBackPoint(float rayLength = 2f) + { + FieAIFrontAndBackPoint result = default(FieAIFrontAndBackPoint); + if (base.ownerCharacter == null) + { + return result; + } + int layerMask = 1049088; + if (Physics.Raycast(base.ownerCharacter.centerTransform.position, base.ownerCharacter.flipDirectionVector, out RaycastHit hitInfo, rayLength, layerMask)) + { + result.frontPoint = hitInfo.point; + result.frontDistance = Vector3.Distance(hitInfo.point, base.ownerCharacter.centerTransform.position); + } + if (Physics.Raycast(base.ownerCharacter.centerTransform.position, -base.ownerCharacter.flipDirectionVector, out hitInfo, rayLength, layerMask)) + { + result.backPoint = hitInfo.point; + result.backDistance = Vector3.Distance(hitInfo.point, base.ownerCharacter.centerTransform.position); + } + return result; + } + } +} diff --git a/src/Fie.AI/FieAITaskEnemiesHoovesRacesEvadeBackWall.cs b/src/Fie.AI/FieAITaskEnemiesHoovesRacesEvadeBackWall.cs new file mode 100644 index 0000000..fc89553 --- /dev/null +++ b/src/Fie.AI/FieAITaskEnemiesHoovesRacesEvadeBackWall.cs @@ -0,0 +1,42 @@ +using Fie.Enemies.HoovesRaces; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskEnemiesHoovesRacesEvadeBackWall : FieAITaskBase + { + public bool _isEnd; + + public Vector3 _backPoint; + + public Vector3 _directionalVec; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(); + _backPoint = frontAndBackPoint.backPoint; + if (frontAndBackPoint.backDistance <= 0f) + { + _isEnd = true; + } + _directionalVec = manager.ownerCharacter.centerTransform.position - _backPoint; + _directionalVec.y = (_directionalVec.z = 0f); + _directionalVec.Normalize(); + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null || manager.ownerCharacter.groundState != 0 || _isEnd) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(_directionalVec, 1f, FieGameCharacter.StateMachineType.Base); + if (Vector3.Distance(manager.ownerCharacter.centerTransform.position, _backPoint) > 2f) + { + return true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskFlightlingAlphaShot.cs b/src/Fie.AI/FieAITaskFlightlingAlphaShot.cs new file mode 100644 index 0000000..51d3959 --- /dev/null +++ b/src/Fie.AI/FieAITaskFlightlingAlphaShot.cs @@ -0,0 +1,89 @@ +using Fie.Enemies.HoovesRaces.ChangelingAlpha; +using Fie.Object; +using System; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskFlightlingAlphaShot : FieAITaskBase + { + private enum ShotState + { + PREPARE, + CONCENTRATE, + DO, + DELAY + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private float _timeCount; + + private ShotState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + _timeCount = 0f; + _state = ShotState.PREPARE; + _isEndState = false; + } + + public override bool Task(FieAITaskController manager) + { + _timeCount += Time.deltaTime; + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case ShotState.PREPARE: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineChangelingAlphaConcentration) + { + currentStateMachine.stateChangeEvent += delegate(Type fromType, Type toType) + { + if (toType != typeof(FieStateMachineChangelingAlphaShoot)) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + _isEndState = true; + } + }; + } + if (!(_timeCount >= 2f)) + { + break; + } + _state = ShotState.DO; + goto case ShotState.DO; + } + case ShotState.DO: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _timeCount = 0f; + _state = ShotState.DELAY; + break; + case ShotState.DELAY: + if (_timeCount >= 1.25f) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskFlightlingFly.cs b/src/Fie.AI/FieAITaskFlightlingFly.cs new file mode 100644 index 0000000..9a54fec --- /dev/null +++ b/src/Fie.AI/FieAITaskFlightlingFly.cs @@ -0,0 +1,116 @@ +using Fie.Enemies.HoovesRaces.Flightling; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskFlightlingFly : FieAITaskBase + { + private enum FlightState + { + PREPARE, + SET_ARTITUDE, + DO + } + + public const float HORMING_DISTANCE = 4f; + + private const int FLY_COUNT = 2; + + private const float MAXIMUM_FLYING_COUNT = 3f; + + private const float FLYING_DURATION = 0.75f; + + private const float FLY_VECTOR_RANGE_X_MAX = 0.5f; + + private const float FLY_VECTOR_RANGE_X_MIN = 0.1f; + + private float _lifeCount; + + private int _flyingCount; + + private bool _isEndState; + + private FlightState _state; + + public override void Initialize(FieAITaskController manager) + { + _lifeCount = 0f; + _flyingCount = 0; + _isEndState = false; + _state = FlightState.PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > 3f) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + switch (_state) + { + case FlightState.PREPARE: + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Base); + _state = FlightState.SET_ARTITUDE; + break; + case FlightState.SET_ARTITUDE: + { + if (_flyingCount >= 2) + { + nextStateWeightList[typeof(FieAITaskFlightlingShot)] = 100; + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position); + if (num > 4f && manager.ownerCharacter.groundState != 0) + { + nextStateWeightList[typeof(FieAITaskFlightlingFlyMove)] = 100; + return true; + } + FieStateMachineFlightlingFly fieStateMachineFlightlingFly2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachineFlightlingFly; + if (fieStateMachineFlightlingFly2 == null) + { + return true; + } + Vector3 vector = Vector3.down; + if (manager.ownerCharacter.groundState != 0) + { + float num2 = Random.Range(0.1f, 0.5f); + if (Random.Range(0, 100) >= 50) + { + num2 *= -1f; + } + vector += new Vector3(num2, 0f, 0f); + } + vector.Normalize(); + Vector3 vector2 = fieStateMachineFlightlingFly2.calcArtitude(manager.ownerCharacter, vector); + if (!(vector2 != Vector3.zero)) + { + return true; + } + fieStateMachineFlightlingFly2.setNextPosition(manager.ownerCharacter.position, vector2, 0.75f); + _flyingCount++; + _state = FlightState.DO; + break; + } + case FlightState.DO: + { + FieStateMachineFlightlingFly fieStateMachineFlightlingFly = manager.ownerCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachineFlightlingFly; + if (fieStateMachineFlightlingFly != null && fieStateMachineFlightlingFly.isEndMoving()) + { + _state = FlightState.SET_ARTITUDE; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskFlightlingFlyMove.cs b/src/Fie.AI/FieAITaskFlightlingFlyMove.cs new file mode 100644 index 0000000..b4a62fe --- /dev/null +++ b/src/Fie.AI/FieAITaskFlightlingFlyMove.cs @@ -0,0 +1,43 @@ +using Fie.Enemies.HoovesRaces.Flightling; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskFlightlingFlyMove : FieAITaskBase + { + private enum FlightState + { + PREPARE, + SET_ARTITUDE, + DO + } + + public override bool Task(FieAITaskController manager) + { + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position); + if (!(num >= 4f)) + { + nextStateWeightList[typeof(FieAITaskFlightlingFly)] = 100; + return true; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskFlightlingIdle.cs b/src/Fie.AI/FieAITaskFlightlingIdle.cs new file mode 100644 index 0000000..b2f5957 --- /dev/null +++ b/src/Fie.AI/FieAITaskFlightlingIdle.cs @@ -0,0 +1,30 @@ +using Fie.Enemies.HoovesRaces; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskFlightlingIdle : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return false; + } + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(); + if (frontAndBackPoint.backDistance > 0f) + { + nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100; + return true; + } + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineEnemiesHoovesRacesStagger) + { + nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100; + return true; + } + nextStateWeightList[typeof(FieAITaskFlightlingFly)] = 100; + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskFlightlingShot.cs b/src/Fie.AI/FieAITaskFlightlingShot.cs new file mode 100644 index 0000000..832e59c --- /dev/null +++ b/src/Fie.AI/FieAITaskFlightlingShot.cs @@ -0,0 +1,62 @@ +using Fie.Enemies.HoovesRaces.Flightling; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskFlightlingShot : FieAITaskBase + { + private enum ShotState + { + PREPARE, + CONCENTRATE, + DO + } + + private const float CONCENTRATE_TIME = 1.5f; + + private float timeCount; + + private ShotState _state; + + public override void Initialize(FieAITaskController manager) + { + timeCount = 0f; + _state = ShotState.PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + timeCount += Time.deltaTime; + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case ShotState.PREPARE: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _state = ShotState.CONCENTRATE; + break; + case ShotState.CONCENTRATE: + if (timeCount >= 1.5f) + { + _state = ShotState.DO; + } + break; + case ShotState.DO: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + return true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskInterface.cs b/src/Fie.AI/FieAITaskInterface.cs new file mode 100644 index 0000000..00b0aa2 --- /dev/null +++ b/src/Fie.AI/FieAITaskInterface.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace Fie.AI +{ + public interface FieAITaskInterface + { + bool TaskExec(FieAITaskController manager); + + bool Task(FieAITaskController manager); + + Dictionary GetWeight(); + } +} diff --git a/src/Fie.AI/FieAITaskPoniesOwnerTracking.cs b/src/Fie.AI/FieAITaskPoniesOwnerTracking.cs new file mode 100644 index 0000000..7959bd5 --- /dev/null +++ b/src/Fie.AI/FieAITaskPoniesOwnerTracking.cs @@ -0,0 +1,29 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskPoniesOwnerTracking : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (FieManagerBehaviour.I.gameOwnerCharacter == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, FieManagerBehaviour.I.gameOwnerCharacter.transform.position); + if (!(num > 2.5f)) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Base); + return true; + } + Vector3 vector = FieManagerBehaviour.I.gameOwnerCharacter.transform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskPoniesRescue.cs b/src/Fie.AI/FieAITaskPoniesRescue.cs new file mode 100644 index 0000000..c187e09 --- /dev/null +++ b/src/Fie.AI/FieAITaskPoniesRescue.cs @@ -0,0 +1,35 @@ +using Fie.Manager; +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskPoniesRescue : FieAITaskBase + { + private FieGameCharacter injuryCharacter; + + public override void Initialize(FieAITaskController manager) + { + injuryCharacter = (injuryCharacter = FieManagerBehaviour.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter)); + } + + public override bool Task(FieAITaskController manager) + { + if (injuryCharacter == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, injuryCharacter.transform.position); + if (!(num > 2.5f)) + { + (manager.ownerCharacter as FiePonies).TryToRevive(); + return true; + } + Vector3 vector = FieManagerBehaviour.I.gameOwnerCharacter.transform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisAirRaid.cs b/src/Fie.AI/FieAITaskQueenChrysalisAirRaid.cs new file mode 100644 index 0000000..8b61108 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisAirRaid.cs @@ -0,0 +1,62 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisAirRaid : FieAITaskBase + { + private enum AirRaidState + { + START, + ATTACKING + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private AirRaidState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = false; + _state = AirRaidState.START; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case AirRaidState.START: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _state = AirRaidState.ATTACKING; + break; + case AirRaidState.ATTACKING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisAirRiadPrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisAirRiadAttacking) && !(currentStateMachine is FieStateMachineQueenChrysalisAirRaidFinished)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisCrucible.cs b/src/Fie.AI/FieAITaskQueenChrysalisCrucible.cs new file mode 100644 index 0000000..d91e59a --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisCrucible.cs @@ -0,0 +1,61 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisCrucible : FieAITaskBase + { + private enum CrucibleState + { + START, + DOING + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private CrucibleState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = false; + _state = CrucibleState.START; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + switch (_state) + { + case CrucibleState.START: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineQueenChrysalisCrucible) + { + currentStateMachine.stateChangeEvent += delegate + { + _isEndState = true; + }; + } + else + { + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisDoubleSlash.cs b/src/Fie.AI/FieAITaskQueenChrysalisDoubleSlash.cs new file mode 100644 index 0000000..727b70b --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisDoubleSlash.cs @@ -0,0 +1,54 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisDoubleSlash : FieAITaskBase + { + private enum MeleeState + { + STATE_PREPARE, + STATE_MELEE + } + + private bool _isEndState; + + private MeleeState _meleeState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = true; + _meleeState = MeleeState.STATE_PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + if (!(manager.ownerCharacter.detector.lockonTargetObject != null)) + { + return true; + } + switch (_meleeState) + { + case MeleeState.STATE_PREPARE: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + _meleeState = MeleeState.STATE_MELEE; + break; + } + case MeleeState.STATE_MELEE: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisDoubleSlash)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + return true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisIdle.cs b/src/Fie.AI/FieAITaskQueenChrysalisIdle.cs new file mode 100644 index 0000000..334b7ef --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisIdle.cs @@ -0,0 +1,78 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisIdle : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + FieQueenChrysalis fieQueenChrysalis = manager.ownerCharacter as FieQueenChrysalis; + if (fieQueenChrysalis == null) + { + return true; + } + if (fieQueenChrysalis.canAbleToCallMinion) + { + nextStateWeightList[typeof(FieAITaskQueenChrysallisCallingMinion)] = 100; + return true; + } + if (manager.ownerCharacter.groundState == FieObjectGroundState.Flying) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisAirRaid)] = 100; + if (fieQueenChrysalis.detector.lockonTargetObject != null) + { + float num = Vector3.Distance(fieQueenChrysalis.detector.lockonTargetObject.centerTransform.position, fieQueenChrysalis.centerTransform.position); + if (num < 1.25f) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 500; + } + else + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 100; + } + } + } + else + { + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(); + if (frontAndBackPoint.backDistance > 0f) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 100; + return true; + } + if (fieQueenChrysalis.detector.lockonTargetObject != null) + { + float num2 = Vector3.Distance(fieQueenChrysalis.detector.lockonTargetObject.centerTransform.position, fieQueenChrysalis.centerTransform.position); + if (num2 > 5f) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 100; + return true; + } + if (num2 > 3f) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 200; + nextStateWeightList[typeof(FieAITaskQueenChrysalisShot)] = 200; + nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 100; + nextStateWeightList[typeof(FieAITaskQueenChrysalisCrucible)] = 250; + nextStateWeightList[typeof(FieAITaskQueenChrysalisIgnite)] = 200; + } + else + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 50; + nextStateWeightList[typeof(FieAITaskQueenChrysalisShot)] = 50; + nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 400; + nextStateWeightList[typeof(FieAITaskQueenChrysalisCrucible)] = 200; + nextStateWeightList[typeof(FieAITaskQueenChrysalisIgnite)] = 150; + } + } + } + if (fieQueenChrysalis.healthStats.shield <= 0f) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisMeteoShower)] = 50 + (int)(100f * (fieQueenChrysalis.healthStats.hitPoint / fieQueenChrysalis.healthStats.maxHitPoint)); + } + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisIgnite.cs b/src/Fie.AI/FieAITaskQueenChrysalisIgnite.cs new file mode 100644 index 0000000..e0980b9 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisIgnite.cs @@ -0,0 +1,68 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisIgnite : FieAITaskBase + { + private enum IgniteState + { + IGNITE, + IGNITE_ATTACKING, + DELAY + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private float timeCount; + + private IgniteState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + timeCount = 0f; + _state = IgniteState.IGNITE; + _isEndState = false; + } + + public override bool Task(FieAITaskController manager) + { + timeCount += Time.deltaTime; + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case IgniteState.IGNITE: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _state = IgniteState.IGNITE_ATTACKING; + break; + case IgniteState.IGNITE_ATTACKING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisIgniteStart) && !(currentStateMachine is FieStateMachineQueenChrysalisIgnitePrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisIgniteFailed) && !(currentStateMachine is FieStateMachineQueenChrysalisIgniteSucceed)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisMeteoShower.cs b/src/Fie.AI/FieAITaskQueenChrysalisMeteoShower.cs new file mode 100644 index 0000000..0edc658 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisMeteoShower.cs @@ -0,0 +1,63 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisMeteoShower : FieAITaskBase + { + private enum ShotState + { + PREPARE, + ATTACKING + } + + private float timeCount; + + private ShotState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + timeCount = 0f; + _state = ShotState.PREPARE; + _isEndState = false; + } + + public override bool Task(FieAITaskController manager) + { + timeCount += Time.deltaTime; + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case ShotState.PREPARE: + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + _state = ShotState.ATTACKING; + break; + case ShotState.ATTACKING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerPrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerAttacking) && !(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerFinished)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisShot.cs b/src/Fie.AI/FieAITaskQueenChrysalisShot.cs new file mode 100644 index 0000000..4da7967 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisShot.cs @@ -0,0 +1,78 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; +using System; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisShot : FieAITaskBase + { + private enum ShotState + { + SHOOT, + SHOOTING, + DELAY + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private ShotState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + _state = ShotState.SHOOT; + _isEndState = false; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case ShotState.SHOOT: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine2 is FieStateMachineQueenChrysalisHormingShot) + { + currentStateMachine2.stateChangeEvent += delegate(Type fromType, Type toType) + { + if (toType != typeof(FieStateMachineQueenChrysalisPenetrateShot)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + }; + } + _state = ShotState.SHOOTING; + break; + } + case ShotState.SHOOTING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisHormingShot) && !(currentStateMachine is FieStateMachineQueenChrysalisPenetrateShot)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysalisTeleportation.cs b/src/Fie.AI/FieAITaskQueenChrysalisTeleportation.cs new file mode 100644 index 0000000..9065097 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysalisTeleportation.cs @@ -0,0 +1,74 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysalisTeleportation : FieAITaskBase + { + private enum TeleportationState + { + TLEREPORT, + TELEPORTING, + DELAY + } + + private const float CONCENTRATE_TIME = 2f; + + private const float SHOOTING_DELAY = 1.25f; + + private TeleportationState _state; + + private bool _isEndState; + + public override void Initialize(FieAITaskController manager) + { + _state = TeleportationState.TLEREPORT; + _isEndState = false; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEndState) + { + return true; + } + if (!(manager.ownerCharacter != null)) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + switch (_state) + { + case TeleportationState.TLEREPORT: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine2 is FieStateMachineQueenChrysalisTeleportation) + { + currentStateMachine2.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + }; + } + _state = TeleportationState.TELEPORTING; + break; + } + case TeleportationState.TELEPORTING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisTeleportation)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskQueenChrysallisCallingMinion.cs b/src/Fie.AI/FieAITaskQueenChrysallisCallingMinion.cs new file mode 100644 index 0000000..2d3aad8 --- /dev/null +++ b/src/Fie.AI/FieAITaskQueenChrysallisCallingMinion.cs @@ -0,0 +1,54 @@ +using Fie.Enemies.HoovesRaces.QueenChrysalis; +using Fie.Object; + +namespace Fie.AI +{ + public class FieAITaskQueenChrysallisCallingMinion : FieAITaskBase + { + private enum CallingState + { + CALLING_PREPARE, + CALLING + } + + private bool _isEndState; + + private CallingState _meleeState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = true; + _meleeState = CallingState.CALLING_PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + if (!(manager.ownerCharacter.detector.lockonTargetObject != null)) + { + return true; + } + switch (_meleeState) + { + case CallingState.CALLING_PREPARE: + { + manager.ownerCharacter.RequestToChangeState(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + _meleeState = CallingState.CALLING; + break; + } + case CallingState.CALLING: + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineQueenChrysalisCallingMinion)) + { + nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100; + _isEndState = true; + return true; + } + break; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashDoublePayback.cs b/src/Fie.AI/FieAITaskRainbowDashDoublePayback.cs new file mode 100644 index 0000000..d7b35ca --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashDoublePayback.cs @@ -0,0 +1,61 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashDoublePayback : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (!_isAssigned) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineRainbowDashDoublePaybackPrepareOnGround) && !(currentStateMachine is FieStateMachineRainbowDashDoublePaybackPrepareMidAir)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 100; + nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 100; + _isEnd = true; + }; + _isAssigned = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashEnemyEvade.cs b/src/Fie.AI/FieAITaskRainbowDashEnemyEvade.cs new file mode 100644 index 0000000..6eaa294 --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashEnemyEvade.cs @@ -0,0 +1,37 @@ +using Fie.Ponies; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashEnemyEvade : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position); + if (!(num < 3f)) + { + if (manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashDoublePayback)] = 100; + return true; + } + if (manager.ownerCharacter.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 100; + return true; + } + return true; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(-vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashEnemyTracking.cs b/src/Fie.AI/FieAITaskRainbowDashEnemyTracking.cs new file mode 100644 index 0000000..524803b --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashEnemyTracking.cs @@ -0,0 +1,26 @@ +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashEnemyTracking : FieAITaskBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position); + if (!(num > 2f)) + { + return true; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashEvasion.cs b/src/Fie.AI/FieAITaskRainbowDashEvasion.cs new file mode 100644 index 0000000..c14cf87 --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashEvasion.cs @@ -0,0 +1,64 @@ +using Fie.Object; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashEvasion : FieAITaskBase + { + private enum StepState + { + STATE_PREPARE, + STATE_STEP + } + + private const float ATTACK_DISTANCE = 15f; + + private bool _isEndState; + + private StepState _stepState; + + public override void Initialize(FieAITaskController manager) + { + _isEndState = false; + _stepState = StepState.STATE_PREPARE; + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.groundState != 0) + { + return true; + } + switch (_stepState) + { + case StepState.STATE_PREPARE: + { + Vector3 directionalVec = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)); + manager.ownerCharacter.RequestToChangeState(directionalVec, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineRainbowDashEvasion || currentStateMachine is FieStateMachineRainbowDashEvasionBack || currentStateMachine is FieStateMachineRainbowDashEvasionFront || currentStateMachine is FieStateMachineRainbowDashEvasionUp || currentStateMachine is FieStateMachineRainbowDashEvasionDown) + { + currentStateMachine.stateChangeEvent += delegate + { + _isEndState = true; + }; + _stepState = StepState.STATE_STEP; + } + else + { + _isEndState = true; + } + break; + } + case StepState.STATE_STEP: + if (_isEndState) + { + return true; + } + break; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashIdle.cs b/src/Fie.AI/FieAITaskRainbowDashIdle.cs new file mode 100644 index 0000000..35689f6 --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashIdle.cs @@ -0,0 +1,95 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashIdle : FieAITaskBase + { + private FieGameCharacter injuryCharacter; + + public override void Initialize(FieAITaskController manager) + { + if (Random.Range(0f, 100f) > 50f) + { + FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter(); + if (randomEnemyGameCharacter != null) + { + manager.ownerCharacter.detector.ChangeLockonTargetByInstanceID(randomEnemyGameCharacter.GetInstanceID()); + } + } + injuryCharacter = FieManagerBehaviour.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter); + } + + public override bool Task(FieAITaskController manager) + { + FieRainbowDash fieRainbowDash = manager.ownerCharacter as FieRainbowDash; + if (fieRainbowDash.damageSystem.isDead) + { + if (fieRainbowDash.friendshipStats.getCurrentFriendshipPoint() >= 3) + { + fieRainbowDash.TryToRevive(); + } + return true; + } + if (injuryCharacter != null && fieRainbowDash.friendshipStats.getCurrentFriendshipPoint() >= 2) + { + nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100; + return true; + } + float num = Vector3.Distance(fieRainbowDash.transform.position, FieManagerBehaviour.I.gameOwnerCharacter.transform.position); + if (fieRainbowDash.detector.lockonTargetObject == null) + { + if (num > 2.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + return false; + } + float num2 = Vector3.Distance(fieRainbowDash.transform.position, fieRainbowDash.detector.lockonTargetObject.position); + if (num2 > 4.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (fieRainbowDash.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashDoublePayback)] = 500; + } + if (fieRainbowDash.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 500; + } + if (num2 > 2.5f) + { + if (fieRainbowDash.healthStats.shield > 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyTracking)] = 500; + } + else + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 500; + } + if (fieRainbowDash.awesomeCount > 0) + { + nextStateWeightList[typeof(FieAITaskRainbowDashOmniSmash)] = 200 * fieRainbowDash.awesomeCount; + } + return true; + } + if (fieRainbowDash.healthStats.shield <= 0f) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 500; + return true; + } + nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 200; + if (fieRainbowDash.groundState == FieObjectGroundState.Grounding) + { + nextStateWeightList[typeof(FieAITaskRainbowDashJump)] = 200; + } + nextStateWeightList[typeof(FieAITaskRainbowDashMelee)] = 200; + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashJump.cs b/src/Fie.AI/FieAITaskRainbowDashJump.cs new file mode 100644 index 0000000..1eb2b89 --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashJump.cs @@ -0,0 +1,51 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashJump : FieAITaskBase + { + public const float JUMPING_MAXIMUM_TIME = 3f; + + public const float JUMPING_THRESHOLD_TIME = 0.3f; + + private float _lifeCount; + + private float _jumpCount; + + private bool _isJump; + + public override void Initialize(FieAITaskController manager) + { + _lifeCount = 0f; + _jumpCount = 0f; + _isJump = false; + } + + public override bool Task(FieAITaskController manager) + { + _lifeCount += Time.deltaTime; + if (_lifeCount >= 3f) + { + return true; + } + if (_isJump) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (currentStateMachine is FieStateMachineRainbowDashFlying) + { + _jumpCount += Time.deltaTime; + if (_jumpCount > 0.3f) + { + _isJump = true; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashMelee.cs b/src/Fie.AI/FieAITaskRainbowDashMelee.cs new file mode 100644 index 0000000..b3c39d3 --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashMelee.cs @@ -0,0 +1,63 @@ +using Fie.Object; +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashMelee : FieAITaskBase + { + public const float MELEE_TIME_MAX = 1.5f; + + public const float MELEE_TIME_MIN = 0.5f; + + private bool _isEnd; + + private float _lifeCount; + + private float _meleeCount; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + _lifeCount = 0f; + _meleeCount = Random.Range(0.5f, 1.5f); + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + _lifeCount += Time.deltaTime; + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position); + if (num > 45f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (_lifeCount >= _meleeCount) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashOmniSmash.cs b/src/Fie.AI/FieAITaskRainbowDashOmniSmash.cs new file mode 100644 index 0000000..dc2ec8f --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashOmniSmash.cs @@ -0,0 +1,67 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashOmniSmash : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + FieRainbowDash fieRainbowDash = manager.ownerCharacter as FieRainbowDash; + if (fieRainbowDash == null) + { + return true; + } + if (!_isAssigned) + { + if (fieRainbowDash.awesomeCount <= 0) + { + return true; + } + fieRainbowDash.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + _isAssigned = true; + } + else + { + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineRainbowDashOmniSmash) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashFinish) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashLoop) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashStart)) + { + return true; + } + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskRainbowDashRainblow.cs b/src/Fie.AI/FieAITaskRainbowDashRainblow.cs new file mode 100644 index 0000000..28d6efe --- /dev/null +++ b/src/Fie.AI/FieAITaskRainbowDashRainblow.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.RainbowDash; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskRainbowDashRainblow : FieAITaskBase + { + private bool _isAssigned; + + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isAssigned = false; + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (!_isAssigned) + { + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineRainbowDashRainblow) && !(currentStateMachine is FieStateMachineRainbowDashRainblowCloack)) + { + return true; + } + currentStateMachine.stateChangeEvent += delegate + { + nextStateWeightList[typeof(FieAITaskRainbowDashMelee)] = 100; + _isEnd = true; + }; + _isAssigned = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightBase.cs b/src/Fie.AI/FieAITaskTwilightBase.cs new file mode 100644 index 0000000..f0118db --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightBase.cs @@ -0,0 +1,21 @@ +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public abstract class FieAITaskTwilightBase : FieAITaskBase + { + protected bool AdjustDirectionByBasicMovement(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject.flipDirectionVector != manager.ownerCharacter.flipDirectionVector) + { + return false; + } + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + manager.ownerCharacter.RequestToChangeState(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base); + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightBaseShot.cs b/src/Fie.AI/FieAITaskTwilightBaseShot.cs new file mode 100644 index 0000000..c93e8e9 --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightBaseShot.cs @@ -0,0 +1,79 @@ +using Fie.Object; +using Fie.Ponies; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightBaseShot : FieAITaskTwilightBase + { + public const float SHOOTING_TIME_MAX = 1.5f; + + public const float SHOOTING_TIME_MIN = 0.5f; + + private bool _isEnd; + + private float _lifeCount; + + private float _meleeCount; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + _lifeCount = 0f; + _meleeCount = Random.Range(0.5f, 1.5f); + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + + private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + _lifeCount += Time.deltaTime; + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position); + if (num > 4.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (_lifeCount >= _meleeCount) + { + return true; + } + if (manager.ownerCharacter.healthStats.shield <= 0f) + { + return true; + } + if (AdjustDirectionByBasicMovement(manager)) + { + return false; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightEnemyEvade.cs b/src/Fie.AI/FieAITaskTwilightEnemyEvade.cs new file mode 100644 index 0000000..5d7c42c --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightEnemyEvade.cs @@ -0,0 +1,44 @@ +using Fie.Ponies; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightEnemyEvade : FieAITaskTwilightBase + { + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position); + FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(3f); + bool flag = false; + Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position; + vector.y = vector.z; + vector.z = 0f; + if (num < 1.5f) + { + if (Random.Range(0, 100) > 50) + { + flag = ((byte)((flag ? 1 : 0) | 1) != 0); + } + if (frontAndBackPoint.backDistance > 0f) + { + flag = ((byte)((flag ? 1 : 0) | 1) != 0); + } + manager.ownerCharacter.RequestToChangeState((!flag) ? (-vector) : vector, 1f, FieGameCharacter.StateMachineType.Base); + } + else if (num < 3f) + { + if (frontAndBackPoint.backDistance > 0f) + { + flag = ((byte)((flag ? 1 : 0) | 1) != 0); + } + manager.ownerCharacter.RequestToChangeState((!flag) ? (-vector) : vector, 1f, FieGameCharacter.StateMachineType.Base); + } + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightForceField.cs b/src/Fie.AI/FieAITaskTwilightForceField.cs new file mode 100644 index 0000000..ad490e2 --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightForceField.cs @@ -0,0 +1,50 @@ +using Fie.Object; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightForceField : FieAITaskTwilightBase + { + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + + private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightIdle.cs b/src/Fie.AI/FieAITaskTwilightIdle.cs new file mode 100644 index 0000000..e196f2e --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightIdle.cs @@ -0,0 +1,90 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightIdle : FieAITaskTwilightBase + { + private FieGameCharacter injuryCharacter; + + public override void Initialize(FieAITaskController manager) + { + if (Random.Range(0f, 100f) > 50f) + { + FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter(); + if (randomEnemyGameCharacter != null) + { + manager.ownerCharacter.detector.ChangeLockonTargetByInstanceID(randomEnemyGameCharacter.GetInstanceID()); + } + } + injuryCharacter = FieManagerBehaviour.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter); + } + + public override bool Task(FieAITaskController manager) + { + FieTwilight fieTwilight = manager.ownerCharacter as FieTwilight; + if (fieTwilight.damageSystem.isDead) + { + if (fieTwilight.friendshipStats.getCurrentFriendshipPoint() >= 3) + { + fieTwilight.TryToRevive(); + } + return true; + } + if (injuryCharacter != null && fieTwilight.friendshipStats.getCurrentFriendshipPoint() >= 2) + { + nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100; + return true; + } + float num = Vector3.Distance(fieTwilight.transform.position, FieManagerBehaviour.I.gameOwnerCharacter.transform.position); + if (fieTwilight.detector.lockonTargetObject == null) + { + if (num > 2.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + return false; + } + float num2 = Vector3.Distance(fieTwilight.transform.position, fieTwilight.detector.lockonTargetObject.position); + if (num2 > 4.5f) + { + nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100; + return true; + } + if (num2 > 2.5f) + { + if (manager.ownerCharacter.groundState != FieObjectGroundState.Flying) + { + nextStateWeightList[typeof(FieAITaskTwilightJump)] = 500; + } + if (fieTwilight.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieStateMachineTwilightSparklyCannon)] = 100; + } + if (fieTwilight.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskTwilightSummonArrow)] = 100; + } + if (fieTwilight.abilitiesContainer.GetCooltime() <= 0f) + { + nextStateWeightList[typeof(FieAITaskTwilightForceField)] = 100; + } + if (fieTwilight.healthStats.shield > fieTwilight.healthStats.maxShield * 0.3f) + { + nextStateWeightList[typeof(FieAITaskTwilightBaseShot)] = 100; + } + else + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + } + return true; + } + nextStateWeightList.Clear(); + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightJump.cs b/src/Fie.AI/FieAITaskTwilightJump.cs new file mode 100644 index 0000000..63b5384 --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightJump.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightJump : FieAITaskBase + { + public const float JUMPING_MAXIMUM_TIME = 3f; + + public const float JUMPING_THRESHOLD_TIME = 0.3f; + + private float _lifeCount; + + private float _jumpCount; + + private bool _isJump; + + public override void Initialize(FieAITaskController manager) + { + _lifeCount = 0f; + _jumpCount = 0f; + _isJump = false; + } + + public override bool Task(FieAITaskController manager) + { + if (manager.ownerCharacter.groundState == FieObjectGroundState.Flying) + { + return true; + } + _lifeCount += Time.deltaTime; + if (_lifeCount >= 3f) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (_isJump) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base); + FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine(); + if (!(currentStateMachine is FieStateMachineTwilightFlying)) + { + return true; + } + _jumpCount += Time.deltaTime; + if (_jumpCount > 0.3f) + { + _isJump = true; + } + return false; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightShinyArrow.cs b/src/Fie.AI/FieAITaskTwilightShinyArrow.cs new file mode 100644 index 0000000..e76ddcf --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightShinyArrow.cs @@ -0,0 +1,54 @@ +using Fie.Object; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightShinyArrow : FieAITaskTwilightBase + { + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + + private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + if (AdjustDirectionByBasicMovement(manager)) + { + return false; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return true; + } + } +} diff --git a/src/Fie.AI/FieAITaskTwilightSummonArrow.cs b/src/Fie.AI/FieAITaskTwilightSummonArrow.cs new file mode 100644 index 0000000..b3a137a --- /dev/null +++ b/src/Fie.AI/FieAITaskTwilightSummonArrow.cs @@ -0,0 +1,50 @@ +using Fie.Object; +using Fie.Ponies.Twilight; +using UnityEngine; + +namespace Fie.AI +{ + public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase + { + private bool _isEnd; + + public override void Initialize(FieAITaskController manager) + { + _isEnd = false; + manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent; + } + + public override void Terminate(FieAITaskController manager) + { + manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent; + manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + + private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + private void healthSystem_staggerEvent(FieDamage damageObject) + { + nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; + _isEnd = true; + } + + public override bool Task(FieAITaskController manager) + { + if (_isEnd) + { + return true; + } + if (manager.ownerCharacter.detector.lockonTargetObject == null) + { + return true; + } + manager.ownerCharacter.RequestToChangeState(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack); + return true; + } + } +} diff --git a/src/Fie.Camera/FieCameraBase.cs b/src/Fie.Camera/FieCameraBase.cs new file mode 100644 index 0000000..d218a69 --- /dev/null +++ b/src/Fie.Camera/FieCameraBase.cs @@ -0,0 +1,311 @@ +using AmplifyBloom; +using Fie.Manager; +using Fie.PostEffect; +using System; +using UnityEngine; +using UnityEngine.PostProcessing; +using UnityStandardAssets.ImageEffects; + +namespace Fie.Camera +{ + [RequireComponent(typeof(UnityEngine.Camera))] + public abstract class FieCameraBase : MonoBehaviour + { + public PostProcessingProfile PostProcessingProfileForLev2; + + public PostProcessingProfile PostProcessingProfileForLev3; + + public PostProcessingProfile PostProcessingProfileForLev4; + + public PostProcessingProfile PostProcessingProfileForLev5; + + private FieGameCharacter _cameraOwner; + + private UnityEngine.Camera _camera; + + public UnityEngine.Camera camera => _camera; + + public FieGameCharacter cameraOwner + { + get + { + if (_cameraOwner == null) + { + _cameraOwner = FieManagerBehaviour.I.gameOwnerCharacter; + } + return _cameraOwner; + } + } + + protected virtual void Awake() + { + _camera = GetComponent(); + if (_camera == null) + { + throw new Exception("this component require UnityEngine.Camera. but didn't."); + } + } + + protected virtual void Start() + { + CalibratePostEffects(); + } + + public void CalibratePostEffects() + { + int qualityLevel = QualitySettings.GetQualityLevel(); + PostProcessingBehaviour component = GetComponent(); + AmplifyBloomEffect component2 = GetComponent(); + UltimateBloom component3 = GetComponent(); + SSREffect component4 = GetComponent(); + PKFxRenderingPlugin component5 = GetComponent(); + SunShafts component6 = GetComponent(); + SEGI component7 = GetComponent(); + VolumetricFog component8 = GetComponent(); + FieCommandBufferReflection component9 = GetComponent(); + switch (qualityLevel) + { + default: + if (component != null) + { + component.enabled = false; + } + if (component2 != null) + { + component2.enabled = false; + } + if (component3 != null) + { + component3.enabled = false; + } + if (component4 != null) + { + component4.enabled = false; + } + if (component5 != null) + { + component5.m_EnableDistortion = false; + } + if (component5 != null) + { + component5.m_EnableSoftParticles = false; + } + if (component6 != null) + { + component6.enabled = false; + } + if (component7 != null) + { + component7.enabled = false; + } + if (component8 != null) + { + component8.enabled = false; + } + if (component9 != null) + { + component9.enabled = false; + } + Shader.globalMaximumLOD = 800; + break; + case 1: + if (component2 != null) + { + component2.enabled = false; + } + if (component3 != null) + { + component3.enabled = false; + } + if (component4 != null) + { + component4.enabled = false; + } + if (component5 != null) + { + component5.m_EnableDistortion = false; + } + if (component5 != null) + { + component5.m_EnableSoftParticles = false; + } + if (component6 != null) + { + component6.enabled = true; + } + if (component7 != null) + { + component7.enabled = false; + } + if (component8 != null) + { + component8.enabled = false; + } + if (component9 != null) + { + component9.enabled = false; + } + if (component != null) + { + component.profile = PostProcessingProfileForLev2; + } + Shader.globalMaximumLOD = 800; + break; + case 2: + if (component2 != null) + { + component2.enabled = true; + } + if (component3 != null) + { + component3.enabled = true; + } + if (component4 != null) + { + component4.enabled = false; + } + if (component5 != null) + { + component5.m_EnableDistortion = true; + } + if (component5 != null) + { + component5.m_EnableSoftParticles = true; + } + if (component6 != null) + { + component6.enabled = true; + } + if (component7 != null) + { + component7.enabled = false; + } + if (component != null) + { + component.profile = PostProcessingProfileForLev3; + } + if (component8 != null) + { + component8.enabled = false; + } + if (component9 != null) + { + component9.enabled = true; + } + if (component2 != null) + { + component2.BloomDownsampleCount = 3; + } + Shader.globalMaximumLOD = 1500; + break; + case 3: + if (component2 != null) + { + component2.enabled = true; + } + if (component3 != null) + { + component3.enabled = true; + } + if (component4 != null) + { + component4.enabled = true; + } + if (component5 != null) + { + component5.m_EnableDistortion = true; + } + if (component5 != null) + { + component5.m_EnableSoftParticles = true; + } + if (component6 != null) + { + component6.enabled = true; + } + if (component7 != null) + { + component7.enabled = false; + } + if (component != null) + { + component.profile = PostProcessingProfileForLev4; + } + if (component8 != null) + { + component8.enabled = true; + } + if (component9 != null) + { + component9.enabled = true; + } + if (component2 != null) + { + component2.BloomDownsampleCount = 5; + } + Shader.globalMaximumLOD = 1500; + break; + case 4: + if (component2 != null) + { + component2.enabled = true; + } + if (component3 != null) + { + component3.enabled = true; + } + if (component4 != null) + { + component4.enabled = true; + } + if (component5 != null) + { + component5.m_EnableDistortion = true; + } + if (component5 != null) + { + component5.m_EnableSoftParticles = true; + } + if (component6 != null) + { + component6.enabled = true; + } + if (component7 != null) + { + component7.enabled = true; + } + if (component != null) + { + component.profile = PostProcessingProfileForLev5; + } + if (component8 != null) + { + component8.enabled = true; + } + if (component9 != null) + { + component9.enabled = true; + } + if (component2 != null) + { + component2.BloomDownsampleCount = 5; + } + Shader.globalMaximumLOD = 1500; + break; + } + } + + public virtual void setCameraOwner(FieGameCharacter owner) + { + if (!(owner == null)) + { + _cameraOwner = owner; + } + } + + public bool isCameraOwner(FieGameCharacter character) + { + return character.GetInstanceID() == _cameraOwner.GetInstanceID(); + } + } +} diff --git a/src/Fie.Camera/FieCameraOffset.cs b/src/Fie.Camera/FieCameraOffset.cs new file mode 100644 index 0000000..e42c6dc --- /dev/null +++ b/src/Fie.Camera/FieCameraOffset.cs @@ -0,0 +1,72 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieCameraOffset + { + public struct FieCameraOffsetParam + { + public Vector3 position; + + public Vector3 angle; + + public float fov; + + public FieCameraOffsetParam(Vector3 position, Vector3 angle, float v) + { + this.position = position; + this.angle = angle; + fov = v; + } + + public static FieCameraOffsetParam operator *(FieCameraOffsetParam a, float b) + { + return new FieCameraOffsetParam(a.position * b, a.angle * b, a.fov * b); + } + } + + private Tweener _startTweener = new Tweener(); + + private Tweener _endTweener = new Tweener(); + + private FieCameraOffsetParam _offset; + + private float stayDuration; + + public FieCameraOffset(FieCameraOffsetParam offset, float startDuration, float stayDuration, float endDuration) + { + _offset = offset; + _startTweener.InitTweener(startDuration, 0f, 1f); + _endTweener.InitTweener(endDuration, 1f, 0f); + this.stayDuration = stayDuration; + } + + public bool isEnd() + { + if (_startTweener.IsEnd() && _endTweener.IsEnd()) + { + return true; + } + return false; + } + + public FieCameraOffsetParam updateParams(float deltaTime) + { + if (!_startTweener.IsEnd()) + { + return _offset * _startTweener.UpdateParameterFloat(deltaTime); + } + if (stayDuration > 0f) + { + stayDuration -= deltaTime; + return _offset * 1f; + } + if (!_endTweener.IsEnd()) + { + return _offset * _endTweener.UpdateParameterFloat(deltaTime); + } + return _offset * 0f; + } + } +} diff --git a/src/Fie.Camera/FieGameCamera.cs b/src/Fie.Camera/FieGameCamera.cs new file mode 100644 index 0000000..b00a3ee --- /dev/null +++ b/src/Fie.Camera/FieGameCamera.cs @@ -0,0 +1,316 @@ +using CinemaDirector; +using Colorful; +using Fie.Manager; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieGameCamera : FieCameraBase + { + private const float CALC_MAXHP_RATE = 0.6f; + + private const float MAX_GRAYSCALE_AMOUNT = 0.4f; + + private const float MAX_VIGNETTE = 20f; + + private const float MAX_CHROMATIC = -20f; + + private const float MAX_DRY_LEVEL = -1000f; + + private const float MAX_DECAY_TIME = 2f; + + private const float MAX_DECAY_RATIO = 1f; + + private const float MAX_ROOM_HF = -1000f; + + private const float MAX_ROOM_LF = -500f; + + private const float MAX_REVERB_LEVEL = 100f; + + private const float MAX_REVERB_DELAY = 0.1f; + + private float _maxHp; + + private float _currentHp; + + private float _currentAnimatinoHp; + + private Tweener _transitionAlphaTweener = new Tweener(); + + private Tweener _damageTweener = new Tweener(); + + public Quaternion nowCameraTargetRotation = Quaternion.identity; + + public Quaternion lastCameraTargetRotation = Quaternion.identity; + + public Quaternion beforeTaskChangedTargetRotation = Quaternion.identity; + + public Vector3 nowCameraTargetPos = Vector3.zero; + + public Vector3 lastCameraTargetPos = Vector3.zero; + + public Vector3 beforeTaskChangedTargetPos = Vector3.zero; + + public Vector3 tagetMakerScreenPos = Vector3.zero; + + private float _initCameraFov; + + private float _lastCameraFov; + + private float _transitionAlpha = 1f; + + private Vector3 _wiggleRange = Vector3.zero; + + private Wiggler _cameraWiggler; + + private FieCameraOffset _cameraOffset; + + private FieCameraOffset.FieCameraOffsetParam currentOffsetParam = default(FieCameraOffset.FieCameraOffsetParam); + + private FieGameCameraTaskBase nowTaskObject; + + [SerializeField] + private Grayscale _colorCorrectionEffect; + + [SerializeField] + private ContrastVignette _vignetteEffect; + + [SerializeField] + private AudioReverbFilter _reverbFilter; + + [SerializeField] + private bool _isEnableDOF = true; + + public Cutscene _mainCameraCutScene; + + public float transitionAlpha + { + get + { + if (_transitionAlphaTweener == null || _transitionAlphaTweener.IsEnd()) + { + return 1f; + } + return _transitionAlpha; + } + private set + { + _transitionAlpha = value; + } + } + + protected override void Awake() + { + base.Awake(); + base.camera.transparencySortMode = TransparencySortMode.Orthographic; + _cameraWiggler = new Wiggler(Vector3.zero, 0f, 1, Vector3.zero); + _transitionAlphaTweener.InitTweener(0.1f, 0f, 1f); + _lastCameraFov = (_initCameraFov = base.camera.fieldOfView); + InitTargetMakerScreenPos(); + } + + protected override void Start() + { + FiePostProcessContainer[] array = UnityEngine.Object.FindObjectsOfType(); + if (array != null || array.Length > 0) + { + FiePostProcessContainer[] array2 = array; + foreach (FiePostProcessContainer fiePostProcessContainer in array2) + { + fiePostProcessContainer.AttachPostProcessEffect(base.gameObject); + } + } + base.Start(); + if (array != null || array.Length > 0) + { + FiePostProcessContainer[] array3 = array; + foreach (FiePostProcessContainer fiePostProcessContainer2 in array3) + { + fiePostProcessContainer2.PostHook(base.gameObject); + } + } + FieManagerBehaviour.I.RetryEvent += I_RetryEvent; + } + + private void I_RetryEvent() + { + SetCameraTask(); + } + + public void InitTargetMakerScreenPos() + { + tagetMakerScreenPos = new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f, 0f); + } + + public void AddTargetMakerScreenPos(Vector3 additionalScreenVector) + { + SetTargetMakerScreenPos(tagetMakerScreenPos + additionalScreenVector); + } + + public void SetTargetMakerScreenPos(Vector3 newScreenPosition) + { + tagetMakerScreenPos.x = Mathf.Clamp(newScreenPosition.x, (float)Screen.width * 0.05f, (float)Screen.width * 0.95f); + tagetMakerScreenPos.y = Mathf.Clamp(newScreenPosition.y, (float)Screen.height * 0.1f, (float)Screen.height * 0.9f); + } + + public override void setCameraOwner(FieGameCharacter owner) + { + base.setCameraOwner(owner); + if (base.cameraOwner != null) + { + base.cameraOwner.detector.targetChangedEvent += Detector_targetChangeEvent; + base.cameraOwner.detector.completelyMissedEvent += Detector_completelyMissedEvent; + _currentHp = (_currentAnimatinoHp = base.cameraOwner.healthStats.hitPoint); + _maxHp = base.cameraOwner.healthStats.maxHitPoint; + } + } + + private void OnDestroy() + { + if (base.cameraOwner != null) + { + base.cameraOwner.detector.targetChangedEvent -= Detector_targetChangeEvent; + base.cameraOwner.detector.completelyMissedEvent -= Detector_completelyMissedEvent; + } + } + + public void SetCameraTask(float transitionTime = 0f) where T : FieGameCameraTaskBase, new() + { + if (nowTaskObject == null) + { + lastCameraTargetPos = (nowCameraTargetPos = base.transform.position); + lastCameraTargetRotation = (nowCameraTargetRotation = base.transform.rotation); + } + else + { + nowTaskObject.Terminate(this); + } + nowTaskObject = new T(); + nowTaskObject.Initialize(this); + if (transitionTime > 0f) + { + _transitionAlphaTweener.InitTweener(transitionTime, 0f, 1f); + } + beforeTaskChangedTargetPos = lastCameraTargetPos; + beforeTaskChangedTargetRotation = lastCameraTargetRotation; + } + + public FieGameCameraTaskBase GetCameraTask() + { + return nowTaskObject; + } + + private void Detector_targetChangeEvent(FieGameCharacter fromCharacter, FieGameCharacter toCharacter) + { + if (nowTaskObject != null) + { + nowTaskObject.TargetChanged(this, fromCharacter, toCharacter); + } + } + + private void Detector_completelyMissedEvent(FieGameCharacter targetCharacter) + { + if (nowTaskObject != null) + { + nowTaskObject.TargetChanged(this, null, null); + } + } + + private void LateUpdate() + { + if (nowTaskObject != null) + { + nowTaskObject.CameraUpdate(this); + if (_currentHp != base.cameraOwner.healthStats.hitPoint) + { + _damageTweener.InitTweener(0.5f, _currentHp, base.cameraOwner.healthStats.hitPoint); + _currentHp = base.cameraOwner.healthStats.hitPoint; + } + if (!_damageTweener.IsEnd()) + { + setDamageEffect(_damageTweener.UpdateParameterFloat(Time.deltaTime), _maxHp); + } + if (_cameraWiggler != null) + { + _wiggleRange = _cameraWiggler.UpdateWiggler(Time.deltaTime); + } + if (!_transitionAlphaTweener.IsEnd()) + { + transitionAlpha = _transitionAlphaTweener.UpdateParameterFloat(Time.deltaTime); + } + lastCameraTargetPos = Vector3.Lerp(beforeTaskChangedTargetPos, nowCameraTargetPos, transitionAlpha); + lastCameraTargetRotation = Quaternion.Lerp(beforeTaskChangedTargetRotation, nowCameraTargetRotation, transitionAlpha); + if (_cameraOffset != null) + { + updateCameraOffset(_cameraOffset); + } + base.transform.position = lastCameraTargetPos + _wiggleRange + currentOffsetParam.position; + base.transform.rotation = lastCameraTargetRotation * Quaternion.Euler(currentOffsetParam.angle); + base.camera.fieldOfView = _lastCameraFov + currentOffsetParam.fov; + } + } + + private void updateCameraOffset(FieCameraOffset offset) + { + if (!offset.isEnd()) + { + currentOffsetParam = offset.updateParams(Time.deltaTime); + } + } + + private void setDamageEffect(float nowHp, float maxHp) + { + if (!(maxHp <= 0f)) + { + float num = Mathf.Max(0f, nowHp - (maxHp - nowHp) * 1f); + float num2 = Mathf.Min(num / maxHp, 1f); + if (_colorCorrectionEffect != null) + { + _colorCorrectionEffect.Amount = 0.4f - 0.4f * num2; + } + if (_vignetteEffect != null) + { + _vignetteEffect.Darkness = 20f - 20f * num2; + } + if (_reverbFilter != null) + { + _reverbFilter.dryLevel = -1000f - -1000f * num2; + _reverbFilter.decayTime = 2f - 2f * num2; + _reverbFilter.decayHFRatio = 1f - 1f * num2; + _reverbFilter.roomHF = 1000f * num2; + _reverbFilter.roomLF = 500f * num2; + _reverbFilter.reverbLevel = 100f - 100f * num2; + _reverbFilter.reverbDelay = 0.1f - 0.1f * num2; + } + } + } + + public void setWiggler(Wiggler.WiggleTemplate template) + { + _cameraWiggler = new Wiggler(base.transform.rotation * Vector3.forward, template); + } + + public void setWiggler(float totalTime, int wiggleCount, Vector3 wiggleScale) + { + _cameraWiggler = new Wiggler(base.transform.rotation * Vector3.forward, totalTime, wiggleCount, wiggleScale); + } + + public void setOffsetTransition(FieGameCharacter callCharacter, FieCameraOffset offset, bool isOwnerOnly = true) + { + if (!(callCharacter == null) && offset != null && (!isOwnerOnly || isCameraOwner(callCharacter))) + { + _cameraOffset = offset; + } + } + + public bool existsTargetEnemy() + { + if (base.cameraOwner.detector.lockonTargetObject != null) + { + return true; + } + return false; + } + } +} diff --git a/src/Fie.Camera/FieGameCameraEverfreeVignette.cs b/src/Fie.Camera/FieGameCameraEverfreeVignette.cs new file mode 100644 index 0000000..b845205 --- /dev/null +++ b/src/Fie.Camera/FieGameCameraEverfreeVignette.cs @@ -0,0 +1,38 @@ +using Colorful; +using Fie.LevelObject; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieGameCameraEverfreeVignette : MonoBehaviour + { + [SerializeField] + private float maximumVignetteDistance = 20f; + + [SerializeField] + private float minimumVignetteDistance = 10f; + + private FastVignette _vignette; + + private FieGameCamera _gameCmaera; + + private FieLevelObjectGlowInsect _insect; + + private void Start() + { + _vignette = base.gameObject.GetComponent(); + _gameCmaera = base.gameObject.GetComponent(); + _insect = UnityEngine.Object.FindObjectOfType(); + } + + private void Update() + { + if (!(_vignette == null) && !(_gameCmaera == null) && !(_gameCmaera.cameraOwner == null)) + { + Vector3 vector = _gameCmaera.camera.WorldToScreenPoint(_gameCmaera.cameraOwner.centerTransform.position); + _vignette.Center = new Vector2(vector.x / (float)Screen.width, vector.y / (float)Screen.height); + _vignette.Darkness = 100f * Mathf.Clamp((Vector3.Distance(_gameCmaera.cameraOwner.centerTransform.position, _insect.transform.position) - minimumVignetteDistance) / maximumVignetteDistance, 0f, 1f); + } + } + } +} diff --git a/src/Fie.Camera/FieGameCameraTaskBase.cs b/src/Fie.Camera/FieGameCameraTaskBase.cs new file mode 100644 index 0000000..95162b6 --- /dev/null +++ b/src/Fie.Camera/FieGameCameraTaskBase.cs @@ -0,0 +1,23 @@ +namespace Fie.Camera +{ + public abstract class FieGameCameraTaskBase + { + public virtual void Initialize(FieGameCamera gameCamera) + { + } + + public virtual void Terminate(FieGameCamera gameCamera) + { + } + + public virtual void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter) + { + } + + public virtual void TargetMissed(FieGameCamera gameCamera) + { + } + + public abstract void CameraUpdate(FieGameCamera gameCamera); + } +} diff --git a/src/Fie.Camera/FieGameCameraTaskHorming.cs b/src/Fie.Camera/FieGameCameraTaskHorming.cs new file mode 100644 index 0000000..5425d97 --- /dev/null +++ b/src/Fie.Camera/FieGameCameraTaskHorming.cs @@ -0,0 +1,55 @@ +using Fie.Manager; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieGameCameraTaskHorming : FieGameCameraTaskBase + { + private Vector3 _hormingAncher = Vector3.zero; + + private float latestHormingDistance; + + private float targetHightOffset; + + private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f; + + public override void Initialize(FieGameCamera gameCamera) + { + _hormingAncher = gameCamera.nowCameraTargetPos; + } + + public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter) + { + gameCamera.SetCameraTask(0.75f); + } + + public override void CameraUpdate(FieGameCamera gameCamera) + { + if (!(gameCamera.cameraOwner == null)) + { + Vector3 defaultCameraOffset = FieManagerBehaviour.I.getDefaultCameraOffset(); + Vector3 groundPosition = gameCamera.cameraOwner.groundPosition; + float x = groundPosition.x + defaultCameraOffset.x; + Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition; + float y = groundPosition2.y + defaultCameraOffset.y; + Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition; + gameCamera.nowCameraTargetPos = new Vector3(x, y, groundPosition3.z + defaultCameraOffset.z); + Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition; + Vector3 a = new Vector3(0f, groundPosition4.y, 0f); + Vector3 position = gameCamera.cameraOwner.transform.position; + float b = -4.5f * Vector3.Distance(a, new Vector3(0f, position.y, 0f)); + targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime); + gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f)); + float num = Vector3.Distance(new Vector3(_hormingAncher.x, gameCamera.nowCameraTargetPos.y, gameCamera.nowCameraTargetPos.z), gameCamera.nowCameraTargetPos); + if (num < latestHormingDistance) + { + gameCamera.SetCameraTask(1f); + } + else + { + latestHormingDistance = num; + } + } + } + } +} diff --git a/src/Fie.Camera/FieGameCameraTaskLockOn.cs b/src/Fie.Camera/FieGameCameraTaskLockOn.cs new file mode 100644 index 0000000..0663eac --- /dev/null +++ b/src/Fie.Camera/FieGameCameraTaskLockOn.cs @@ -0,0 +1,108 @@ +using Fie.Manager; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieGameCameraTaskLockOn : FieGameCameraTaskBase + { + public const float DEFAULT_LOCKON_TRASITION_TIME = 0.75f; + + private const float MAXIMUM_LOCKON_DISTANCE = 6f; + + private Vector3 _hormingAncher = Vector3.zero; + + private float latestHormingDistance; + + private float targetHightOffset; + + public bool isCameraHorming = true; + + private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f; + + public override void Initialize(FieGameCamera gameCamera) + { + _hormingAncher = gameCamera.nowCameraTargetPos; + } + + public override void Terminate(FieGameCamera gameCamera) + { + gameCamera.InitTargetMakerScreenPos(); + } + + public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter) + { + if (isCameraHorming) + { + gameCamera.SetCameraTask(0.75f); + } + } + + public override void TargetMissed(FieGameCamera gameCamera) + { + gameCamera.SetCameraTask(1f); + } + + public override void CameraUpdate(FieGameCamera gameCamera) + { + if (!(gameCamera.cameraOwner == null)) + { + if (isCameraHorming) + { + if (gameCamera.cameraOwner.detector.lockonTargetObject == null || gameCamera.cameraOwner.detector.lockonTargetObject.transform == null) + { + gameCamera.SetCameraTask(1f); + } + else + { + float num = 0f; + float num2 = Vector3.Distance(gameCamera.cameraOwner.detector.lockonTargetObject.centerTransform.position, gameCamera.cameraOwner.centerTransform.position); + if (num2 > 6f) + { + num = Mathf.Min((num2 - 6f) * 1f, 2f); + } + Vector3 vector = Vector3.Lerp(gameCamera.cameraOwner.transform.position, gameCamera.cameraOwner.detector.lockonTargetObject.position, 0.5f); + Vector3 defaultCameraOffset = FieManagerBehaviour.I.getDefaultCameraOffset(); + Vector3 nowCameraTargetPos = gameCamera.nowCameraTargetPos; + float x = vector.x + defaultCameraOffset.x; + Vector3 groundPosition = gameCamera.cameraOwner.groundPosition; + float y = groundPosition.y + defaultCameraOffset.y; + Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition; + gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos, new Vector3(x, y, groundPosition2.z + defaultCameraOffset.z - num), 3f * Time.deltaTime); + gameCamera.tagetMakerScreenPos = gameCamera.camera.WorldToScreenPoint(gameCamera.cameraOwner.detector.lockonTargetObject.centerTransform.position); + Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition; + Vector3 a = new Vector3(0f, groundPosition3.y, 0f); + Vector3 position = gameCamera.cameraOwner.transform.position; + float b = -4.5f * Vector3.Distance(a, new Vector3(0f, position.y, 0f)); + targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime); + gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f)); + } + } + else + { + Vector3 vector2 = gameCamera.camera.ScreenToWorldPoint(gameCamera.tagetMakerScreenPos); + Vector3 position2 = gameCamera.cameraOwner.transform.position; + vector2.z = position2.z; + float num3 = 0f; + float num4 = Vector3.Distance(vector2, gameCamera.cameraOwner.centerTransform.position); + if (num4 > 6f) + { + num3 = Mathf.Min((num4 - 6f) * 1f, 4f); + } + Vector3 vector3 = Vector3.Lerp(gameCamera.cameraOwner.transform.position, vector2, 0.5f); + Vector3 defaultCameraOffset2 = FieManagerBehaviour.I.getDefaultCameraOffset(); + Vector3 nowCameraTargetPos2 = gameCamera.nowCameraTargetPos; + float x2 = vector3.x + defaultCameraOffset2.x; + Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition; + float y2 = groundPosition4.y + defaultCameraOffset2.y; + Vector3 groundPosition5 = gameCamera.cameraOwner.groundPosition; + gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos2, new Vector3(x2, y2, groundPosition5.z + defaultCameraOffset2.z - num3), 4f * Time.deltaTime); + Vector3 groundPosition6 = gameCamera.cameraOwner.groundPosition; + float b2 = -4.5f * Vector3.Distance(new Vector3(0f, groundPosition6.y, 0f), new Vector3(0f, vector2.y, 0f)); + targetHightOffset = Mathf.Lerp(targetHightOffset, b2, 2f * Time.deltaTime); + gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour.I.getDefaultCameraRotation() + new Vector3(targetHightOffset * 0.5f, 0f, 0f)); + float num5 = latestHormingDistance = Vector3.Distance(new Vector3(_hormingAncher.x, gameCamera.nowCameraTargetPos.y, gameCamera.nowCameraTargetPos.z), gameCamera.nowCameraTargetPos); + } + } + } + } +} diff --git a/src/Fie.Camera/FieGameCameraTaskStop.cs b/src/Fie.Camera/FieGameCameraTaskStop.cs new file mode 100644 index 0000000..9f81e23 --- /dev/null +++ b/src/Fie.Camera/FieGameCameraTaskStop.cs @@ -0,0 +1,84 @@ +using Fie.Manager; +using UnityEngine; + +namespace Fie.Camera +{ + public class FieGameCameraTaskStop : FieGameCameraTaskBase + { + private const float CAMERA_MAX_HORIZONTAL_DISTANCE = 3.5f; + + private const float CAMERA_MAX_FORWARD_DISTANCE = 7f; + + private const float CAMERA_MAX_VIRTICAL_DISTANCE = 1.5f; + + private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f; + + private Vector3 initedPos = Vector3.zero; + + private Quaternion initedRotation = Quaternion.identity; + + private float targetHightOffset; + + public override void Initialize(FieGameCamera gameCamera) + { + Vector3 defaultCameraOffset = FieManagerBehaviour.I.getDefaultCameraOffset(); + Vector3 defaultCameraRotation = FieManagerBehaviour.I.getDefaultCameraRotation(); + if (gameCamera.cameraOwner != null) + { + Vector3 groundPosition = gameCamera.cameraOwner.groundPosition; + float x = groundPosition.x + defaultCameraOffset.x; + Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition; + float y = groundPosition2.y + defaultCameraOffset.y; + Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition; + gameCamera.nowCameraTargetPos = new Vector3(x, y, groundPosition3.z + defaultCameraOffset.z); + gameCamera.nowCameraTargetRotation = Quaternion.Euler(defaultCameraRotation); + } + initedPos = gameCamera.nowCameraTargetPos; + initedRotation = gameCamera.nowCameraTargetRotation; + } + + public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter) + { + gameCamera.SetCameraTask(0.75f); + } + + public override void CameraUpdate(FieGameCamera gameCamera) + { + if (!(gameCamera.cameraOwner == null)) + { + Vector3 a = new Vector3(gameCamera.nowCameraTargetPos.x, 0f, 0f); + Vector3 groundPosition = gameCamera.cameraOwner.groundPosition; + float num = Vector3.Distance(a, new Vector3(groundPosition.x, 0f, 0f)); + Vector3 a2 = new Vector3(0f, 0f, gameCamera.nowCameraTargetPos.z); + Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition; + float num2 = Vector3.Distance(a2, new Vector3(0f, 0f, groundPosition2.z)); + if (num > 3.5f || num2 > 7f) + { + gameCamera.SetCameraTask(1f); + } + else + { + Vector3 vector = gameCamera.camera.WorldToScreenPoint(gameCamera.cameraOwner.guiPointTransform.position); + if (vector.x <= 0f || vector.y <= 0f || vector.x > (float)Screen.width || vector.y > (float)Screen.height) + { + gameCamera.SetCameraTask(1f); + } + else + { + Vector3 defaultCameraOffset = FieManagerBehaviour.I.getDefaultCameraOffset(); + Vector3 nowCameraTargetPos = gameCamera.nowCameraTargetPos; + float x = initedPos.x; + Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition; + gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos, new Vector3(x, groundPosition3.y + defaultCameraOffset.y, initedPos.z), 0.5f * Time.deltaTime); + Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition; + Vector3 a3 = new Vector3(0f, groundPosition4.y, 0f); + Vector3 position = gameCamera.cameraOwner.transform.position; + float b = -4.5f * Vector3.Distance(a3, new Vector3(0f, position.y, 0f)); + targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime); + gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f)); + } + } + } + } + } +} diff --git a/src/Fie.Camera/FieSkillTreeCamera.cs b/src/Fie.Camera/FieSkillTreeCamera.cs new file mode 100644 index 0000000..7197412 --- /dev/null +++ b/src/Fie.Camera/FieSkillTreeCamera.cs @@ -0,0 +1,81 @@ +using Fie.Utility; +using System.Collections; +using UnityEngine; + +namespace Fie.Camera +{ + [RequireComponent(typeof(UnityEngine.Camera))] + public class FieSkillTreeCamera : MonoBehaviour + { + private Matrix4x4 ortho; + + private Matrix4x4 perspective; + + public float fov = 60f; + + public float near = 0.3f; + + public float far = 1000f; + + public float orthographicSize = 50f; + + private float aspect; + + private bool orthoOn; + + private Tweener _transitionTweener = new Tweener(); + + private UnityEngine.Camera _camera; + + public UnityEngine.Camera camera => _camera; + + public void Awake() + { + _camera = base.gameObject.GetComponent(); + aspect = (float)Screen.width / (float)Screen.height; + perspective = _camera.projectionMatrix; + ortho = Matrix4x4.Ortho((0f - orthographicSize) * aspect, orthographicSize * aspect, 0f - orthographicSize, orthographicSize, near, far); + orthoOn = false; + } + + public void SetViewMode(bool isOrtho) + { + if (isOrtho) + { + BlendToMatrix(ortho, 0.5f); + } + else + { + BlendToMatrix(perspective, 1f); + } + } + + public static Matrix4x4 MatrixLerp(Matrix4x4 from, Matrix4x4 to, float time) + { + Matrix4x4 result = default(Matrix4x4); + for (int i = 0; i < 16; i++) + { + result[i] = Mathf.Lerp(from[i], to[i], time); + } + return result; + } + + private IEnumerator LerpFromTo(Matrix4x4 src, Matrix4x4 dest, float duration) + { + _transitionTweener.InitTweener(duration, 0f, 1f); + if (!_transitionTweener.IsEnd()) + { + _camera.projectionMatrix = MatrixLerp(src, dest, _transitionTweener.UpdateParameterFloat(Time.deltaTime)); + yield return (object)1; + /*Error: Unable to find new state assignment for yield return*/; + } + _camera.projectionMatrix = dest; + } + + public Coroutine BlendToMatrix(Matrix4x4 targetMatrix, float duration) + { + StopAllCoroutines(); + return StartCoroutine(LerpFromTo(_camera.projectionMatrix, targetMatrix, duration)); + } + } +} diff --git a/src/Fie.Camera/FieTitleCamera.cs b/src/Fie.Camera/FieTitleCamera.cs new file mode 100644 index 0000000..8acb935 --- /dev/null +++ b/src/Fie.Camera/FieTitleCamera.cs @@ -0,0 +1,6 @@ +namespace Fie.Camera +{ + public sealed class FieTitleCamera : FieCameraBase + { + } +} diff --git a/src/Fie.Camera/FieUICamera.cs b/src/Fie.Camera/FieUICamera.cs new file mode 100644 index 0000000..83c1b55 --- /dev/null +++ b/src/Fie.Camera/FieUICamera.cs @@ -0,0 +1,91 @@ +using UnityEngine; + +namespace Fie.Camera +{ + public class FieUICamera : FieCameraBase + { + public delegate void ScreenResizeEvent(); + + private int _latestWidth; + + private int _latestHeight; + + private FieGameCamera _gameCamera; + + private Vector3 leftTopInWorldPosition; + + private Vector3 leftBottomInWorldPosition; + + private Vector3 rightTopInWorldPosition; + + private Vector3 rightBottomInWorldPosition; + + private float _screenHeight; + + private float _screenWidth; + + private float _uiWorldHeight; + + private float _uiWorldWidth; + + public event ScreenResizeEvent screenResizeEvent; + + protected override void Start() + { + base.Start(); + InitializeUICameraResolution(); + } + + private void LateUpdate() + { + if (Screen.height != _latestHeight || Screen.width != _latestWidth) + { + InitializeUICameraResolution(); + } + } + + private void InitializeUICameraResolution() + { + _screenHeight = (float)Screen.height; + _screenWidth = (float)Screen.width; + leftBottomInWorldPosition = base.camera.ScreenToWorldPoint(Vector3.zero); + leftTopInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(0f, _screenHeight)); + rightBottomInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(_screenWidth, 0f)); + rightTopInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(_screenWidth, _screenHeight)); + _uiWorldHeight = Vector3.Distance(leftBottomInWorldPosition, leftTopInWorldPosition); + _uiWorldWidth = Vector3.Distance(leftBottomInWorldPosition, rightBottomInWorldPosition); + _latestHeight = Screen.height; + _latestWidth = Screen.width; + if (this.screenResizeEvent != null) + { + this.screenResizeEvent(); + } + } + + public void setGameCamera(FieGameCamera gameChamera) + { + _gameCamera = gameChamera; + } + + public Vector3 getPositionInUICameraWorld(Vector3 inGamePosition) + { + if (_gameCamera == null) + { + Debug.Log("game camera didn't assign to ui camera."); + return Vector3.zero; + } + Vector3 vector = _gameCamera.camera.WorldToScreenPoint(inGamePosition); + return new Vector3(leftBottomInWorldPosition.x + _uiWorldWidth * (vector.x / _screenWidth), leftBottomInWorldPosition.y + _uiWorldHeight * (vector.y / _screenHeight)); + } + + public bool isOnScreen(Vector3 worldPosition, ref Vector3 screenPosition) + { + screenPosition = _gameCamera.camera.WorldToScreenPoint(worldPosition); + if (screenPosition.x < 0f || screenPosition.x > (float)Screen.width || screenPosition.y < 0f || screenPosition.y > (float)Screen.height) + { + return false; + } + return true; + } + } +} diff --git a/src/Fie.Core/FieBootstrap.cs b/src/Fie.Core/FieBootstrap.cs new file mode 100644 index 0000000..bf1e543 --- /dev/null +++ b/src/Fie.Core/FieBootstrap.cs @@ -0,0 +1,22 @@ +using Fie.Manager; +using Fie.Scene; +using UnityEngine; + +namespace Fie.Core +{ + public class FieBootstrap : MonoBehaviour + { + private static bool _isBootedFromBootStrap; + + public static bool isBootedFromBootStrap => _isBootedFromBootStrap; + + private void Start() + { + FieManagerFactory.I.StartUp(); + FieManagerBehaviour.I.LoadScene(new FieSceneTitle(), allowSceneActivation: true, FieFaderManager.FadeType.OUT_TO_WHITE, FieFaderManager.FadeType.IN_FROM_WHITE, 1.5f); + _isBootedFromBootStrap = true; + FieManagerBehaviour.I.ChangeMixerVolume(0f, 0.5f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.Voice, FieAudioManager.FieAudioMixerType.SE); + UnityEngine.Object.Destroy(base.gameObject); + } + } +} diff --git a/src/Fie.DebugUtility/FieDebugGameSceneBoot.cs b/src/Fie.DebugUtility/FieDebugGameSceneBoot.cs new file mode 100644 index 0000000..b51caf5 --- /dev/null +++ b/src/Fie.DebugUtility/FieDebugGameSceneBoot.cs @@ -0,0 +1,67 @@ +using Fie.Core; +using Fie.Manager; +using Fie.Scene; +using GameDataEditor; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.DebugUtility +{ + public class FieDebugGameSceneBoot : MonoBehaviour + { + [Range(1f, 3f)] + [SerializeField] + private int playerNum = 1; + + [SerializeField] + private List _debugCharacters = new List(); + + [SerializeField] + private List _debugCharactersIntelligenceTypes = new List(); + + [SerializeField] + private List _debugCharactersNames = new List(); + + [SerializeField] + private List _debugSkills = new List(); + + private void Awake() + { + if (!FieBootstrap.isBootedFromBootStrap && _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count && _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count && _debugCharacters.Count == _debugCharactersNames.Count) + { + PhotonNetwork.offlineMode = true; + PhotonNetwork.InstantiateInRoomOnly = false; + FieManagerFactory.I.currentSceneType = FieSceneType.INGAME; + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.nowPlayerNum = playerNum; + FieManagerBehaviour.I.StartUp(); + List list = FieMasterData.FindMasterDataList(delegate(GDESkillTreeData data) + { + if (_debugSkills.Contains((FieConstValues.FieSkill)data.ID)) + { + return true; + } + return false; + }); + for (int i = 0; i < playerNum; i++) + { + _debugCharacters[i].intelligenceType = _debugCharactersIntelligenceTypes[i]; + if (list != null && list.Count > 0) + { + FieSaveManager.debugSkills = list; + } + FieManagerBehaviour.I.SetUserName(i, _debugCharactersNames[i]); + FieManagerBehaviour.I.SetUserCharacterPrefab(i, _debugCharacters[i]); + } + } + } + + private void Start() + { + FieManagerBehaviour.I.StartUp(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieChangeling.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieChangeling.cs new file mode 100644 index 0000000..d400a48 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieChangeling.cs @@ -0,0 +1,133 @@ +using Fie.AI; +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Changeling")] + public class FieChangeling : FieEnemiesHoovesRaces + { + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineChangelingBaseAttack); + } + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieChangelingAnimationContainer()); + base.damageSystem.deathEvent += delegate + { + FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.zero, null); + UnbindFromDetecter(); + if (PhotonNetwork.isMasterClient) + { + PhotonNetwork.Destroy(base.photonView); + } + }; + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_ChangelingsCommonRift); + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_ChangelingsCommonPull); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + } + + private void ApplyStatusEffect_ChangelingsCommonRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsRiftEntity fieStatusEffectsRiftEntity = statusEffect as FieStatusEffectsRiftEntity; + if (fieStatusEffectsRiftEntity != null && healthStats.stagger + damage.stagger >= healthStats.staggerResistance) + { + FieStateMachineEnemiesHoovesRacesRift fieStateMachineEnemiesHoovesRacesRift = setStateToStatheMachine(typeof(FieStateMachineEnemiesHoovesRacesRift), isForceSet: true, isDupulicate: true) as FieStateMachineEnemiesHoovesRacesRift; + if (fieStateMachineEnemiesHoovesRacesRift != null) + { + fieStateMachineEnemiesHoovesRacesRift.ResetMoveForce(fieStatusEffectsRiftEntity.resetMoveForce); + fieStateMachineEnemiesHoovesRacesRift.SetRiftForceRate(fieStatusEffectsRiftEntity.riftForceRate); + } + damage.stagger = 0f; + healthStats.stagger = 0f; + } + } + } + } + + private void ApplyStatusEffect_ChangelingsCommonPull(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsPullEntity fieStatusEffectsPullEntity = statusEffect as FieStatusEffectsPullEntity; + if (fieStatusEffectsPullEntity != null) + { + FieStateMachineStatusEffectPull fieStateMachineStatusEffectPull = setStateToStatheMachine(typeof(FieStateMachineStatusEffectPull), isForceSet: true, isDupulicate: true) as FieStateMachineStatusEffectPull; + if (fieStateMachineStatusEffectPull != null) + { + fieStateMachineStatusEffectPull.setPullPoint(fieStatusEffectsPullEntity.pullPosition); + fieStateMachineStatusEffectPull.setDuration(fieStatusEffectsPullEntity.pullDuration); + } + damage.stagger = 0f; + } + } + } + } + + protected new void Start() + { + base.Start(); + base.isEnableAutoFlip = false; + base.animationManager.SetAnimation(0, isLoop: true); + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_CHANGELING); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.CHANGELING; + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskChangelingIdle); + } + + public virtual int getBackStepAnimationID() + { + return 13; + } + + public virtual int getArrivalAnimationID() + { + return 15; + } + + public override void RequestArrivalState() + { + RequestToChangeState(Vector3.zero, 0f, StateMachineType.Base); + } + + public override GDEEnemyTableData GetEnemyMasterData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_CHANGELING); + } + + public override FieConstValues.FieEnemy GetEnemyMasterDataID() + { + return FieConstValues.FieEnemy.ENEMY_TABLE_CHANGELING; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieChangelingAnimationContainer.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieChangelingAnimationContainer.cs new file mode 100644 index 0000000..d8bc38c --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieChangelingAnimationContainer.cs @@ -0,0 +1,34 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieChangelingAnimationContainer : FieEnemiesHoovesRacesAnimationContainer + { + public enum ChangelingAnimationList + { + JUMP = 8, + JUMP_LANDING, + FALL, + MELEE, + SHOOT, + BACK_STEP, + VORTEX, + ARRIVAL, + EMOTION_NORMAL, + MAX_CHANGELING_ANIMATION + } + + public FieChangelingAnimationContainer() + { + addAnimationData(8, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(9, new FieSkeletonAnimationObject(0, "jump_end_shallow")); + addAnimationData(10, new FieSkeletonAnimationObject(0, "fall")); + addAnimationData(11, new FieSkeletonAnimationObject(0, "melee")); + addAnimationData(12, new FieSkeletonAnimationObject(0, "shoot")); + addAnimationData(13, new FieSkeletonAnimationObject(0, "backstep")); + addAnimationData(14, new FieSkeletonAnimationObject(0, "vortex")); + addAnimationData(15, new FieSkeletonAnimationObject(0, "arrival")); + addAnimationData(16, new FieSkeletonAnimationObject(1, "emotion_normal")); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBite.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBite.cs new file mode 100644 index 0000000..e8189b0 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBite.cs @@ -0,0 +1,51 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingBite")] + public class FieEmitObjectChangelingBite : FieEmittableObjectBase + { + [SerializeField] + private float CHANGELING_BITE_DURATION = 0.4f; + + [SerializeField] + private float CHANGELING_BITE_DAMAGE_DURATION = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= CHANGELING_BITE_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > CHANGELING_BITE_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBiteHitEffect.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBiteHitEffect.cs new file mode 100644 index 0000000..fcb2345 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingBiteHitEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingBiteHitEffect")] + public class FieEmitObjectChangelingBiteHitEffect : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingHitEffectSmall.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingHitEffectSmall.cs new file mode 100644 index 0000000..876b11b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingHitEffectSmall.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingHitEffectSmall")] + public class FieEmitObjectChangelingHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingShot.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingShot.cs new file mode 100644 index 0000000..554bc74 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingShot.cs @@ -0,0 +1,115 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingShot")] + public class FieEmitObjectChangelingShot : FieEmittableObjectBase + { + [SerializeField] + private float CHANGELING_SINGLE_SHOT_DURATION = 2f; + + [SerializeField] + private float CHANGELING_SINGLE_SHOT_VELOCITY_MAX = 2f; + + [SerializeField] + private float CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME = 2f; + + [SerializeField] + private float CHANGELING_SINGLE_SHOT_DESTORY_DURATION = 0.7f; + + [SerializeField] + private GameObject cilinder; + + [SerializeField] + private SmoothTrail trail; + + private const float HORMING_DISTANCE_MAX = 10f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _additionalVelocity = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = cilinder.transform.localScale; + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME, 0f, CHANGELING_SINGLE_SHOT_VELOCITY_MAX); + _scaleTweener.InitTweener(CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME, Vector3.zero, Vector3.one); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized; + } + directionalVec = _initDirectionalVec; + cilinder.transform.localScale = _initEffectModelScale; + trail.ClearSystem(emitState: true); + } + + public void setAdditionalVelocity(Vector3 additionalVelocity) + { + _additionalVelocity = additionalVelocity; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 vector = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= CHANGELING_SINGLE_SHOT_DURATION) + { + destoryEmitObject(CHANGELING_SINGLE_SHOT_DESTORY_DURATION); + trail.Emit = false; + trail.ClearSystem(emitState: false); + cilinder.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + trail.Emit = false; + destoryEmitObject(CHANGELING_SINGLE_SHOT_DESTORY_DURATION); + cilinder.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.ClearSystem(emitState: false); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingVortex.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingVortex.cs new file mode 100644 index 0000000..9d6ff2b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieEmitObjectChangelingVortex.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingVortex")] + public class FieEmitObjectChangelingVortex : FieEmittableObjectBase + { + [SerializeField] + private float VortexDuration = 1f; + + [SerializeField] + private float VortexDamageDuration = 0.75f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= VortexDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > VortexDamageDuration) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + Vector3 position = collider.ClosestPointOnBounds(base.transform.position); + FieEmitObjectChangelingBiteHitEffect fieEmitObjectChangelingBiteHitEffect = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (fieEmitObjectChangelingBiteHitEffect != null) + { + fieEmitObjectChangelingBiteHitEffect.transform.position = position; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingArrival.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingArrival.cs new file mode 100644 index 0000000..865321e --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingArrival.cs @@ -0,0 +1,97 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingArrival : FieStateMachineGameCharacterBase + { + private enum ArrivalState + { + ARRIVAL_START, + ARRIVING, + ARRIVAL_END + } + + private const float POSITION_INITIALIZE_TIME = 0.75f; + + private Tweener positionTweener = new Tweener(); + + private ArrivalState _arrivalState; + + private bool _isEnd; + + private FieEmitObjectChangelingForcesArrivalParticleEffect _arriveEffect; + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableCollider = false; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = false; + gameCharacter.skeletonUtility.skeletonRenderer.meshRenderer.enabled = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableCollider = true; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + gameCharacter.skeletonUtility.skeletonRenderer.meshRenderer.enabled = true; + if (_arriveEffect != null) + { + _arriveEffect.StopEffect(); + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieChangeling) + { + FieChangeling fieChangeling = gameCharacter as FieChangeling; + if (!(fieChangeling == null)) + { + switch (_arrivalState) + { + case ArrivalState.ARRIVAL_START: + _arrivalState = ArrivalState.ARRIVING; + fieChangeling.position += Vector3.up * 3f; + fieChangeling.groundState = FieObjectGroundState.Flying; + _arriveEffect = FieManagerBehaviour.I.EmitObject(fieChangeling.centerTransform, Vector3.zero, null); + break; + case ArrivalState.ARRIVING: + if (fieChangeling.groundState == FieObjectGroundState.Grounding) + { + FieManagerBehaviour.I.EmitObject(fieChangeling.transform, Vector3.zero, null); + _isEnd = true; + } + break; + } + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBackstep.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBackstep.cs new file mode 100644 index 0000000..87116c1 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBackstep.cs @@ -0,0 +1,104 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingBackstep : FieStateMachineGameCharacterBase + { + private enum StepState + { + STEP_START, + STEPPING + } + + private StepState _stepState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangeling fieChangeling = gameCharacter as FieChangeling; + if (!(fieChangeling == null)) + { + autoFlipToEnemy(fieChangeling); + fieChangeling.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableCollider = true; + gameCharacter.damageSystem.isEnableStaggerImmunity = false; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangeling) + { + FieChangeling changeling = gameCharacter as FieChangeling; + if (_stepState == StepState.STEP_START) + { + if (changeling.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = changeling.animationManager.SetAnimation(changeling.getBackStepAnimationID(), isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 moveForce = changeling.flipDirectionVector * e.Float; + changeling.setMoveForce(moveForce, 0f, useRound: false); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + if (e.Data.Name == "immunity") + { + changeling.isEnableCollider = (e.Int < 1); + changeling.damageSystem.isEnableStaggerImmunity = (e.Int >= 1); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + } + else + { + _isEnd = true; + } + _stepState = StepState.STEPPING; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBaseAttack.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBaseAttack.cs new file mode 100644 index 0000000..1771442 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingBaseAttack.cs @@ -0,0 +1,27 @@ +using Fie.Object; +using System; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingBaseAttack : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangeling) + { + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineEnemiesAttackIdle); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingMelee.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingMelee.cs new file mode 100644 index 0000000..c6fdad3 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingMelee.cs @@ -0,0 +1,119 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingMelee : FieStateMachineGameCharacterBase + { + private enum MeleeState + { + MELEE_START, + MELEE + } + + private const float MELEE_HORMING_DISTANCE = 1f; + + private const float MELEE_HORMING_DEFAULT_RATE = 0.5f; + + private MeleeState _meleeState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangeling fieChangeling = gameCharacter as FieChangeling; + if (!(fieChangeling == null)) + { + autoFlipToEnemy(fieChangeling); + fieChangeling.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangeling) + { + FieChangeling changeling = gameCharacter as FieChangeling; + if (_meleeState == MeleeState.MELEE_START) + { + if (changeling.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = changeling.animationManager.SetAnimation(11, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 a = changeling.flipDirectionVector; + Transform lockonEnemyTransform = changeling.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - changeling.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + vector.Normalize(); + a = vector; + vector.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + changeling.resetMoveForce(); + changeling.setMoveForce(vector2, 0f, useRound: false); + changeling.setFlipByVector(vector2); + } + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changeling.mouthTransform, changeling.flipDirectionVector, null, changeling); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + } + else + { + _isEnd = true; + } + _meleeState = MeleeState.MELEE; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingShoot.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingShoot.cs new file mode 100644 index 0000000..09ca2be --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingShoot.cs @@ -0,0 +1,77 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingShoot : FieStateMachineGameCharacterBase + { + private enum ShootState + { + STATE_PREPARE, + STATE_SHOOT + } + + private ShootState _shootState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = false; + } + + public override void updateState(ref T gameCharacter) + { + FieChangeling changeling = gameCharacter as FieChangeling; + if (!(changeling == null)) + { + if (changeling.detector.getLockonEnemyTransform() == null) + { + _isEnd = true; + } + else if (_shootState == ShootState.STATE_PREPARE) + { + TrackEntry trackEntry = changeling.animationManager.SetAnimation(12, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + autoFlipToEnemy(changeling); + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changeling.hornTransform, changeling.flipDirectionVector, changeling.detector.getLockonEnemyTransform(isCenter: true), changeling); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _shootState = ShootState.STATE_SHOOT; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingVortex.cs b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingVortex.cs new file mode 100644 index 0000000..c5a28b4 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Changeling/FieStateMachineChangelingVortex.cs @@ -0,0 +1,96 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.Changeling +{ + public class FieStateMachineChangelingVortex : FieStateMachineGameCharacterBase + { + private enum MeleeState + { + MELEE_START, + MELEE + } + + private MeleeState _meleeState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangeling fieChangeling = gameCharacter as FieChangeling; + if (!(fieChangeling == null)) + { + autoFlipToEnemy(fieChangeling); + fieChangeling.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangeling) + { + FieChangeling changeling = gameCharacter as FieChangeling; + if (_meleeState == MeleeState.MELEE_START) + { + if (changeling.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = changeling.animationManager.SetAnimation(14, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changeling.transform, changeling.flipDirectionVector, null, changeling); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + } + else + { + _isEnd = true; + } + _meleeState = MeleeState.MELEE; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlpha.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlpha.cs new file mode 100644 index 0000000..fa11df3 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlpha.cs @@ -0,0 +1,82 @@ +using Fie.AI; +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Object; +using GameDataEditor; +using System; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/ChangelingAlpha")] + public class FieChangelingAlpha : FieChangeling + { + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieChangelingAlphaAnimationContainer()); + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_ChangelingAlphaRift); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + } + + private void ApplyStatusEffect_ChangelingAlphaRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (healthStats.stagger + damage.stagger >= healthStats.staggerResistance) + { + setStateToStatheMachine(typeof(FieStateMachineEnemiesHoovesRacesRift), isForceSet: true, isDupulicate: true); + damage.stagger = 0f; + healthStats.stagger = 0f; + } + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_CHANGELING_ALPHA); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.CHANGELING_ALPHA; + } + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineChangelingBaseAttack); + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskChangelingAlphaIdle); + } + + public override int getBackStepAnimationID() + { + return 11; + } + + public override int getArrivalAnimationID() + { + return 16; + } + + public override GDEEnemyTableData GetEnemyMasterData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_CHANGELING_ALPHA); + } + + public override FieConstValues.FieEnemy GetEnemyMasterDataID() + { + return FieConstValues.FieEnemy.ENEMY_TABLE_CHANGELING_ALPHA; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlphaAnimationContainer.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlphaAnimationContainer.cs new file mode 100644 index 0000000..9572145 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieChangelingAlphaAnimationContainer.cs @@ -0,0 +1,36 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieChangelingAlphaAnimationContainer : FieEnemiesHoovesRacesAnimationContainer + { + public enum ChangelingAlphaAnimationList + { + SHOOT = 8, + SHOOT_CONCENTRATION, + MELEE, + BACK_STEP, + SHOUT, + CHARGE, + CHARGE_FINISH, + ZERO_DISTANCE_CHARGE, + ARRIVAL, + EMOTION_NORMAL, + MAX_CHANGELING_ALPHA_ANIMATION + } + + public FieChangelingAlphaAnimationContainer() + { + addAnimationData(8, new FieSkeletonAnimationObject(0, "shoot")); + addAnimationData(9, new FieSkeletonAnimationObject(0, "shoot_concentration")); + addAnimationData(10, new FieSkeletonAnimationObject(0, "melee")); + addAnimationData(11, new FieSkeletonAnimationObject(0, "backstep")); + addAnimationData(12, new FieSkeletonAnimationObject(0, "shout")); + addAnimationData(13, new FieSkeletonAnimationObject(0, "charge")); + addAnimationData(14, new FieSkeletonAnimationObject(0, "charge_finish")); + addAnimationData(15, new FieSkeletonAnimationObject(0, "zero_distance_charge")); + addAnimationData(16, new FieSkeletonAnimationObject(0, "arrival")); + addAnimationData(17, new FieSkeletonAnimationObject(1, "emotion_normal")); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaBurst.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaBurst.cs new file mode 100644 index 0000000..9d2ee0f --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaBurst.cs @@ -0,0 +1,40 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaBurst")] + public class FieEmitObjectChangelingAlphaBurst : FieEmittableObjectBase + { + [SerializeField] + private float ChangelingAlphaBurstDuration = 0.7f; + + [SerializeField] + private float ChangelingAlphaBurstDestroyDuration = 0.5f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > ChangelingAlphaBurstDuration) + { + destoryEmitObject(ChangelingAlphaBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaCharge.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaCharge.cs new file mode 100644 index 0000000..a185cd3 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaCharge.cs @@ -0,0 +1,64 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaCharge")] + public class FieEmitObjectChangelingAlphaCharge : FieEmittableObjectBase + { + [SerializeField] + private float ChargeDuration = 0.4f; + + [SerializeField] + private float ChargeDamageDuration = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ChargeDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > ChargeDamageDuration)) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + destoryEmitObject(ChargeDuration - _lifeTimeCount); + } + } + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectChangelingAlphaReflectionEffect != null) + { + fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeEffect.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeEffect.cs new file mode 100644 index 0000000..632eca2 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaChargeEffect")] + public class FieEmitObjectChangelingAlphaChargeEffect : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeFinish.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeFinish.cs new file mode 100644 index 0000000..d8e78c2 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaChargeFinish.cs @@ -0,0 +1,64 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaChargeFinish")] + public class FieEmitObjectChangelingAlphaChargeFinish : FieEmittableObjectBase + { + [SerializeField] + private float ChargeFinishDuration = 0.4f; + + [SerializeField] + private float ChargeFinishDamageDuration = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ChargeFinishDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > ChargeFinishDamageDuration)) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + destoryEmitObject(ChargeFinishDuration - _lifeTimeCount); + } + } + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectChangelingAlphaReflectionEffect != null) + { + fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaConcentration.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaConcentration.cs new file mode 100644 index 0000000..96b3cbb --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaConcentration.cs @@ -0,0 +1,70 @@ +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaConcentration")] + public class FieEmitObjectChangelingAlphaConcentration : FieEmittableObjectBase + { + private const float EFFECT_DURATION = 2f; + + private const float DURATION = 3f; + + public List effects; + + public AudioSource soundEffect; + + private float lifeTime; + + private bool isStopEffects; + + public override void awakeEmitObject() + { + foreach (PlaygroundParticlesC effect in effects) + { + if (effect != null) + { + effect.emit = true; + } + } + } + + private void Update() + { + if (base.ownerCharacter == null) + { + lifeTime = 2f; + } + lifeTime += Time.deltaTime; + if (lifeTime > 2f && !isStopEffects && effects != null) + { + foreach (PlaygroundParticlesC effect in effects) + { + if (effect != null) + { + effect.emit = false; + } + } + if (soundEffect != null) + { + soundEffect.Stop(); + } + isStopEffects = true; + } + if (lifeTime > 3f) + { + destoryEmitObject(); + } + } + + private void LateUpdate() + { + if (!(initTransform == null)) + { + base.transform.position = initTransform.position; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaHitEffect.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaHitEffect.cs new file mode 100644 index 0000000..c831e1d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaHitEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaHitEffect")] + public class FieEmitObjectChangelingAlphaHitEffect : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionEffect.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionEffect.cs new file mode 100644 index 0000000..bb607ca --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionEffect.cs @@ -0,0 +1,18 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaReflectEffect")] + public class FieEmitObjectChangelingAlphaReflectionEffect : FieEmittableObjectBase + { + [SerializeField] + private float reflectEffectDuration = 0.6f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(reflectEffectDuration); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionShout.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionShout.cs new file mode 100644 index 0000000..c4f0c37 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaReflectionShout.cs @@ -0,0 +1,59 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaReflectionShout")] + public class FieEmitObjectChangelingAlphaReflectionShout : FieEmittableObjectBase + { + [SerializeField] + private float shoutDuration = 1.5f; + + [SerializeField] + private float ShoutEnableDuration = 0.8f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shoutDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > ShoutEnableDuration)) + { + if (collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectChangelingAlphaReflectionEffect != null) + { + fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShot.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShot.cs new file mode 100644 index 0000000..454f441 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShot.cs @@ -0,0 +1,151 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaShot")] + public class FieEmitObjectChangelingAlphaShot : FieEmittableObjectBase + { + [SerializeField] + private float shotDuration = 1f; + + [SerializeField] + private float shotVelocityMax = 4f; + + [SerializeField] + private float shotAccelTime = 0.1f; + + [SerializeField] + private float shoutDestroyDuration = 0.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private Light shotLight; + + [SerializeField] + private List trailList = new List(); + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(shotAccelTime, 0f, shotVelocityMax); + _scaleTweener.InitTweener(shotAccelTime, Vector3.zero, Vector3.one); + _initDirectionalVec = directionalVec; + if (targetTransform != null && targetTransform.root != null) + { + Vector3 a = targetTransform.position; + FieGameCharacter component = targetTransform.root.GetComponent(); + if (component != null && component.groundState == FieObjectGroundState.Grounding) + { + int layerMask = 512; + if (Physics.Raycast(targetTransform.position + Vector3.up * 2f, Vector3.down, out RaycastHit hitInfo, 1024f, layerMask) && hitInfo.collider.tag == "Floor") + { + a = hitInfo.point; + } + } + _initDirectionalVec = a - base.transform.position; + _initDirectionalVec.Normalize(); + directionalVec = _initDirectionalVec; + } + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.ClearSystem(emitState: true); + } + } + effectModel.transform.localScale = _initEffectModelScale; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 vector = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shotDuration) + { + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.Emit = false; + trail.ClearSystem(emitState: false); + } + } + destoryEmitObject(shoutDestroyDuration); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieEmitObjectChangelingAlphaBurst fieEmitObjectChangelingAlphaBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + if (fieEmitObjectChangelingAlphaBurst != null) + { + fieEmitObjectChangelingAlphaBurst.setAllyTag(getArrayTag()); + fieEmitObjectChangelingAlphaBurst.setHostileTag(getHostileTag()); + } + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_BIG); + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.Emit = false; + } + } + shotLight.intensity = 0f; + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(shotDuration - _lifeTimeCount); + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.ClearSystem(emitState: false); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShout.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShout.cs new file mode 100644 index 0000000..2fbe89a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieEmitObjectChangelingAlphaShout.cs @@ -0,0 +1,52 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaShout")] + public class FieEmitObjectChangelingAlphaShout : FieEmittableObjectBase + { + [SerializeField] + private float shoutDuration = 1.5f; + + [SerializeField] + private float ShoutEnableDuration = 0.8f; + + [SerializeField] + private float ShoutPysicalForce = 5f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shoutDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > ShoutEnableDuration) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce((fieGameCharacter.centerTransform.position - base.transform.position).normalized * ShoutPysicalForce, 0f, useRound: false); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaCharge.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaCharge.cs new file mode 100644 index 0000000..62d2853 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaCharge.cs @@ -0,0 +1,80 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaCharge : FieStateMachineGameCharacterBase + { + private const float MOVE_THRESHOLD = 0.02f; + + private const float WALK_FORCE_THRESHOLD = 0.3f; + + private const float WALK_MOVESPEED_MAGNI = 0.25f; + + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha; + if ((object)changelingAlpha != null) + { + Vector3 externalInputVector = changelingAlpha.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + externalInputVector.y = 0f; + float defaultMoveSpeed = changelingAlpha.getDefaultMoveSpeed(); + TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(13, isLoop: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector); + FieManagerBehaviour.I.EmitObject(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha); + } + }; + } + changelingAlpha.addMoveForce(externalInputVector * (defaultMoveSpeed * changelingAlpha.externalInputForce), 0.4f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaChargeFinish.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaChargeFinish.cs new file mode 100644 index 0000000..66619bc --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaChargeFinish.cs @@ -0,0 +1,152 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaChargeFinish : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 1f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + autoFlipToEnemy(fieChangelingAlpha); + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangelingAlpha) + { + _timeCount += Time.deltaTime; + FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha; + switch (_fireState) + { + case FireState.KICK_START: + if (changelingAlpha.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(14, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha); + } + if (e.Data.Name == "move") + { + Vector3 a = changelingAlpha.flipDirectionVector; + Transform lockonEnemyTransform = changelingAlpha.detector.getLockonEnemyTransform(); + float num = 1f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - changelingAlpha.transform.position; + vector.Normalize(); + a = vector; + a.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + changelingAlpha.resetMoveForce(); + changelingAlpha.setMoveForce(vector2, 0f, useRound: false); + if (e.Float > 0f) + { + changelingAlpha.setFlipByVector(vector2); + } + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + } + else + { + _isEnd = true; + } + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaConcentration.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaConcentration.cs new file mode 100644 index 0000000..5efaa3a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaConcentration.cs @@ -0,0 +1,55 @@ +using Fie.Manager; +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaConcentration : FieStateMachineGameCharacterBase + { + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangelingAlpha) + { + gameCharacter.animationManager.SetAnimation(9, isLoop: true); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + FieManagerBehaviour.I.EmitObject(fieChangelingAlpha.hornTransform, Vector3.zero, null, gameCharacter); + autoFlipToEnemy(fieChangelingAlpha); + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShoot.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShoot.cs new file mode 100644 index 0000000..e6e37c2 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShoot.cs @@ -0,0 +1,92 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaShoot : FieStateMachineGameCharacterBase + { + private enum ShootState + { + STATE_PREPARE, + STATE_SHOOT + } + + private ShootState _shootState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = false; + } + + public override void updateState(ref T gameCharacter) + { + FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(changelingAlpha == null)) + { + if (changelingAlpha.detector.getLockonEnemyTransform() == null) + { + _isEnd = true; + } + else if (_shootState == ShootState.STATE_PREPARE) + { + TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(8, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + autoFlipToEnemy(changelingAlpha); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changelingAlpha.hornTransform, changelingAlpha.flipDirectionVector, changelingAlpha.detector.getLockonEnemyTransform(isCenter: true), changelingAlpha); + } + if (e.Data.Name == "move") + { + Vector3 flipDirectionVector = changelingAlpha.flipDirectionVector; + Vector3 moveForce = flipDirectionVector * e.Float; + changelingAlpha.resetMoveForce(); + changelingAlpha.setMoveForce(moveForce, 0f, useRound: false); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _shootState = ShootState.STATE_SHOOT; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineChangelingAlphaConcentration)); + list.Add(typeof(FieStateMachineChangelingAlphaShout)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShout.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShout.cs new file mode 100644 index 0000000..3eaa129 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaShout.cs @@ -0,0 +1,119 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaShout : FieStateMachineGameCharacterBase + { + private enum FireState + { + SHOUT_START, + SHOUT_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangelingAlpha) + { + _timeCount += Time.deltaTime; + FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha; + switch (_fireState) + { + case FireState.SHOUT_START: + { + TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(12, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + changelingAlpha.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + }; + FieManagerBehaviour.I.EmitObject(changelingAlpha.mouthTransform, Vector3.zero, null, changelingAlpha); + FieManagerBehaviour.I.EmitObject(changelingAlpha.mouthTransform, Vector3.zero, null, changelingAlpha); + FieManagerBehaviour.I.setWiggler(1f, 10, Vector3.one * 0.2f); + } + else + { + _isEnd = true; + } + _fireState = FireState.SHOUT_END; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + autoFlipToEnemy(fieChangelingAlpha); + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + fieChangelingAlpha.isEnableAutoFlip = true; + } + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineChangelingAlphaConcentration)); + list.Add(typeof(FieStateMachineChangelingAlphaCharge)); + list.Add(typeof(FieStateMachineChangelingAlphaZeroDistanceCharge)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaZeroDistanceCharge.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaZeroDistanceCharge.cs new file mode 100644 index 0000000..5289448 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineChangelingAlphaZeroDistanceCharge.cs @@ -0,0 +1,152 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineChangelingAlphaZeroDistanceCharge : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 10f; + + private const float KICK_HORMING_DEFAULT_RATE = 1f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + autoFlipToEnemy(fieChangelingAlpha); + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha; + if (!(fieChangelingAlpha == null)) + { + fieChangelingAlpha.isEnableAutoFlip = false; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangelingAlpha) + { + _timeCount += Time.deltaTime; + FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha; + switch (_fireState) + { + case FireState.KICK_START: + if (changelingAlpha.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(15, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha); + } + if (e.Data.Name == "move") + { + Vector3 a = changelingAlpha.flipDirectionVector; + Transform lockonEnemyTransform = changelingAlpha.detector.getLockonEnemyTransform(); + float num = 1f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - changelingAlpha.transform.position; + vector.Normalize(); + a = vector; + a.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + changelingAlpha.resetMoveForce(); + changelingAlpha.setMoveForce(vector2, 0f, useRound: false); + if (e.Float > 0f) + { + changelingAlpha.setFlipByVector(vector2); + } + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + } + else + { + _isEnd = true; + } + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineEnemiesChangelingAlphaMove.cs b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineEnemiesChangelingAlphaMove.cs new file mode 100644 index 0000000..f33f0e6 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.ChangelingAlpha/FieStateMachineEnemiesChangelingAlphaMove.cs @@ -0,0 +1,72 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.ChangelingAlpha +{ + public class FieStateMachineEnemiesChangelingAlphaMove : FieStateMachineGameCharacterBase + { + private const float MOVE_THRESHOLD = 0.02f; + + private const float WALK_FORCE_THRESHOLD = 0.3f; + + private const float WALK_MOVESPEED_MAGNI = 0.25f; + + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieChangelingAlpha) + { + Vector3 externalInputVector = gameCharacter.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + externalInputVector.y = 0f; + Vector3 velocity = gameCharacter.GetComponent().velocity; + float num = Math.Abs(velocity.x); + float num2 = num / 5f; + float defaultMoveSpeed = gameCharacter.getDefaultMoveSpeed(); + float timescale = Mathf.Min(Mathf.Max(num2 / 0.1f, 0.25f), 1.5f); + gameCharacter.animationManager.SetAnimation(1, isLoop: true); + gameCharacter.animationManager.SetAnimationTimescale(1, timescale); + defaultMoveSpeed *= 0.25f; + gameCharacter.addMoveForce(externalInputVector * (defaultMoveSpeed * gameCharacter.externalInputForce), 0.4f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingBurst.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingBurst.cs new file mode 100644 index 0000000..e1424c9 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingBurst.cs @@ -0,0 +1,40 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Flightling/Power/FlightlingBurst")] + public class FieEmitObjectFlightlingBurst : FieEmittableObjectBase + { + [SerializeField] + private float FlightlingBurstDuration = 0.7f; + + [SerializeField] + private float FlightlingBurstDestroyDuration = 0.5f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > FlightlingBurstDuration) + { + destoryEmitObject(FlightlingBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingConcentration.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingConcentration.cs new file mode 100644 index 0000000..ba1c16b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingConcentration.cs @@ -0,0 +1,70 @@ +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Flightling/Power/FlightlingConcentration")] + public class FieEmitObjectFlightlingConcentration : FieEmittableObjectBase + { + private const float EFFECT_DURATION = 1.5f; + + private const float DURATION = 2.5f; + + public List effects; + + public AudioSource soundEffect; + + private float lifeTime; + + private bool isStopEffects; + + public override void awakeEmitObject() + { + foreach (PlaygroundParticlesC effect in effects) + { + if (effect != null) + { + effect.emit = true; + } + } + } + + private void Update() + { + if (base.ownerCharacter == null) + { + lifeTime = 1.5f; + } + lifeTime += Time.deltaTime; + if (lifeTime > 1.5f && !isStopEffects && effects != null) + { + foreach (PlaygroundParticlesC effect in effects) + { + if (effect != null) + { + effect.emit = false; + } + } + if (soundEffect != null) + { + soundEffect.Stop(); + } + isStopEffects = true; + } + if (lifeTime > 2.5f) + { + destoryEmitObject(); + } + } + + private void LateUpdate() + { + if (!(initTransform == null)) + { + base.transform.position = initTransform.position; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingShot.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingShot.cs new file mode 100644 index 0000000..698ed3a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieEmitObjectFlightlingShot.cs @@ -0,0 +1,168 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Flightling/Power/FlightlingShot")] + public class FieEmitObjectFlightlingShot : FieEmittableObjectBase + { + [SerializeField] + private float FlightlingShotDuration = 3f; + + [SerializeField] + private float FlightlingShotVelocityMax = 1f; + + [SerializeField] + private float FlightlingShotVelocityAccelTime = 2f; + + [SerializeField] + private float FlightlingShotDestroyDuration = 0.7f; + + [SerializeField] + private float FlightlingShotTiltDuration = 1f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private SmoothTrail trail; + + private const float RANDOM_TILT_DISTANCE = 0.2f; + + private const float HORMING_DISTANCE_MAX = 1f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _randomTiltVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private bool _isInitRandomTilt; + + private float _totalMoveDistance; + + private float _initEnemyDistance = -3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isEndHorming; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(FlightlingShotVelocityAccelTime, 0f, FlightlingShotVelocityMax); + _tiltForceTweener.InitTweener(FlightlingShotTiltDuration, 1f, 0f); + effectModel.transform.localScale = _initEffectModelScale; + trail.ClearSystem(emitState: true); + } + + public void Update() + { + if (!_isEndUpdate) + { + if (!_isInitRandomTilt) + { + initRandomTilt(); + } + float num = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + Vector3 a = directionalVec * (1f - num); + Vector3 b = _randomTiltVec * num; + a += b; + a.Normalize(); + if (targetTransform != null) + { + if (_initEnemyDistance <= 0f) + { + _initEnemyDistance = Vector3.Distance(base.transform.position, targetTransform.position); + } + if (_totalMoveDistance > _initEnemyDistance * 1.25f) + { + _isEndHorming = true; + directionalVec = _lastDirectionalVec; + } + if (!_isEndHorming) + { + Vector3 a2 = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + a *= num; + a += a2 * (1f - num); + a.Normalize(); + _lastDirectionalVec = a; + } + } + Vector3 a3 = a * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + a3 *= Time.deltaTime; + _totalMoveDistance += Vector3.Distance(base.transform.position, base.transform.position + a3); + base.transform.position += a3; + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= FlightlingShotDuration) + { + destoryEmitObject(FlightlingShotDestroyDuration); + FieEmitObjectFlightlingBurst fieEmitObjectFlightlingBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (fieEmitObjectFlightlingBurst != null) + { + fieEmitObjectFlightlingBurst.setAllyTag(getArrayTag()); + fieEmitObjectFlightlingBurst.setHostileTag(getHostileTag()); + } + trail.Emit = false; + trail.ClearSystem(emitState: false); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + if (a3 != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(a3); + } + } + } + + private void initRandomTilt() + { + Vector3 a = base.transform.position + directionalVec * 0.2f; + Vector3 a2 = Quaternion.AngleAxis(FieRandom.Range(0f, 360f), directionalVec) * Vector3.up; + a2 *= 0.2f; + a += a2 * 0.2f; + _randomTiltVec = Quaternion.LookRotation(a - base.transform.position) * Vector3.forward; + _randomTiltVec.Normalize(); + _isInitRandomTilt = true; + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieEmitObjectFlightlingBurst fieEmitObjectFlightlingBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (fieEmitObjectFlightlingBurst != null) + { + fieEmitObjectFlightlingBurst.setAllyTag(getArrayTag()); + fieEmitObjectFlightlingBurst.setHostileTag(getHostileTag()); + } + destoryEmitObject(FlightlingShotDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.ClearSystem(emitState: false); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightling.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightling.cs new file mode 100644 index 0000000..d0d8150 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightling.cs @@ -0,0 +1,66 @@ +using Fie.AI; +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Object; +using GameDataEditor; +using System; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Flightling/Flightling")] + public class FieFlightling : FieChangeling + { + private const float FLIGHTLING_DEFAULT_MOVE_FORCE = 400f; + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieFlightlingAnimationContainer()); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_FLIGHTLING); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.FLIGHTLING; + } + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineChangelingBaseAttack); + } + + public override float getDefaultMoveSpeed() + { + return 400f; + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskFlightlingIdle); + } + + public override int getArrivalAnimationID() + { + return 15; + } + + public override GDEEnemyTableData GetEnemyMasterData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_FLIGHTLING); + } + + public override FieConstValues.FieEnemy GetEnemyMasterDataID() + { + return FieConstValues.FieEnemy.ENEMY_TABLE_FLIGHTLING; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightlingAnimationContainer.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightlingAnimationContainer.cs new file mode 100644 index 0000000..2da5a08 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieFlightlingAnimationContainer.cs @@ -0,0 +1,34 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + public class FieFlightlingAnimationContainer : FieEnemiesHoovesRacesAnimationContainer + { + public enum FlightlingAnimationList + { + JUMP = 8, + JUMP_LANDING, + FALL, + MELEE, + SHOOT, + JUMPING_SHOOT, + BACK_STEP, + ARRIVAL, + EMOTION_NORMAL, + MAX_FLIGHTLING_ANIMATION + } + + public FieFlightlingAnimationContainer() + { + addAnimationData(8, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(9, new FieSkeletonAnimationObject(0, "jump_end_shallow")); + addAnimationData(10, new FieSkeletonAnimationObject(0, "fall")); + addAnimationData(11, new FieSkeletonAnimationObject(0, "melee")); + addAnimationData(12, new FieSkeletonAnimationObject(0, "shoot")); + addAnimationData(13, new FieSkeletonAnimationObject(0, "jumping_shoot")); + addAnimationData(14, new FieSkeletonAnimationObject(0, "backstep")); + addAnimationData(15, new FieSkeletonAnimationObject(0, "arrival")); + addAnimationData(16, new FieSkeletonAnimationObject(1, "emotion_normal")); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingConcentration.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingConcentration.cs new file mode 100644 index 0000000..af71179 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingConcentration.cs @@ -0,0 +1,53 @@ +using Fie.Manager; +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + public class FieStateMachineFlightlingConcentration : FieStateMachineGameCharacterBase + { + public override void updateState(ref T flightling) + { + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieFlightling fieFlightling = gameCharacter as FieFlightling; + if (!(fieFlightling == null)) + { + FieManagerBehaviour.I.EmitObject(fieFlightling.hornTransform, Vector3.zero, null, gameCharacter); + autoFlipToEnemy(fieFlightling); + fieFlightling.isEnableGravity = false; + fieFlightling.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFly.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFly.cs new file mode 100644 index 0000000..f95bdf3 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFly.cs @@ -0,0 +1,118 @@ +using Fie.Object; +using Fie.Utility; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + public class FieStateMachineFlightlingFly : FieStateMachineGameCharacterBase + { + private enum FlightState + { + PREPARE, + CHECK_VELOCITY, + DO, + END + } + + private const float MAX_ARTTITUDE = 2.5f; + + private const float MIN_ARTTITUDE = 0.5f; + + private FlightState state; + + private bool _isEnd; + + private Type _nextState; + + private float _physicalSinWave; + + private Tweener _moveTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + FieFlightling fieFlightling = gameCharacter as FieFlightling; + if (!(fieFlightling == null)) + { + switch (state) + { + default: + return; + case FlightState.PREPARE: + fieFlightling.animationManager.SetAnimation(8, isLoop: true); + state = FlightState.DO; + break; + case FlightState.DO: + break; + } + autoFlipToEnemy(fieFlightling); + if (!_moveTweener.IsEnd()) + { + Vector3 position = _moveTweener.UpdateParameterVec3(Time.deltaTime); + fieFlightling.GetComponent().MovePosition(position); + } + } + } + + public Vector3 calcArtitude(FieGameCharacter gameCharacter, Vector3 normal) + { + int layerMask = 512; + if (Physics.Raycast(gameCharacter.position + Vector3.up * 0.5f, normal, out RaycastHit hitInfo, 1024f, layerMask)) + { + Vector3 point = hitInfo.point; + float x = point.x; + Vector3 point2 = hitInfo.point; + float y = point2.y + FieRandom.Range(0.5f, 2.5f); + Vector3 point3 = hitInfo.point; + return new Vector3(x, y, point3.z); + } + return Vector3.zero; + } + + public void setNextPosition(Vector3 nowPosition, Vector3 nextPosition, float time) + { + _moveTweener.InitTweener(time, nowPosition, nextPosition); + } + + public bool isEndMoving() + { + return _moveTweener.IsEnd(); + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = false; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFlyMove.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFlyMove.cs new file mode 100644 index 0000000..9c59001 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingFlyMove.cs @@ -0,0 +1,86 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + public class FieStateMachineFlightlingFlyMove : FieStateMachineGameCharacterBase + { + private enum FlightState + { + PREPARE, + DO + } + + private const float MOVE_THRESHOLD = 0.02f; + + private const float WALK_FORCE_THRESHOLD = 0.3f; + + private const float WALK_MOVESPEED_MAGNI = 0.5f; + + private bool _isEnd; + + private Type _nextState; + + private FlightState state; + + public override void updateState(ref T flightling) + { + if (flightling is FieFlightling) + { + switch (state) + { + default: + return; + case FlightState.PREPARE: + flightling.animationManager.SetAnimation(8, isLoop: true); + state = FlightState.DO; + break; + case FlightState.DO: + break; + } + autoFlipToEnemy(flightling); + Vector3 externalInputVector = flightling.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + float defaultMoveSpeed = flightling.getDefaultMoveSpeed(); + flightling.addMoveForce(externalInputVector * (defaultMoveSpeed * flightling.externalInputForce), 0.4f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = false; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingShoot.cs b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingShoot.cs new file mode 100644 index 0000000..ce61cfb --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.Flightling/FieStateMachineFlightlingShoot.cs @@ -0,0 +1,90 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.Flightling +{ + public class FieStateMachineFlightlingShoot : FieStateMachineGameCharacterBase + { + private enum ShootState + { + STATE_PREPARE, + STATE_SHOOT + } + + private ShootState _shootState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + gameCharacter.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + } + } + + public override void updateState(ref T gameCharacter) + { + FieFlightling flightling = gameCharacter as FieFlightling; + if (!(flightling == null)) + { + if (flightling.detector.getLockonEnemyTransform() == null) + { + _isEnd = true; + } + else if (_shootState == ShootState.STATE_PREPARE) + { + TrackEntry trackEntry = flightling.animationManager.SetAnimationChain(13, 8, isLoop: true); + if (trackEntry != null) + { + autoFlipToEnemy(flightling); + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(flightling.hornTransform, flightling.flipDirectionVector, flightling.detector.getLockonEnemyTransform(isCenter: true), flightling); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _shootState = ShootState.STATE_SHOOT; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidConcentration.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidConcentration.cs new file mode 100644 index 0000000..fddf212 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidConcentration.cs @@ -0,0 +1,127 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisAirRaidConcentration")] + public class FieEmitObjectQueenChrysalisAirRaidConcentration : FieEmittableObjectBase + { + private const float MAXIMUM_EMITTING_DURATION = 4f; + + private const float MAXIMUM_DURATION = 5f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.5f; + + [SerializeField] + private List _ppParticleList = new List(); + + [SerializeField] + private List _pkfxParticleList = new List(); + + private float _lifeTime; + + private float _initialAudioVolume = 1f; + + private bool _isEndUpdate; + + private Tweener _audioFadeTweener = new Tweener(); + + private void Awake() + { + _initialAudioVolume = _loopAudio.volume; + } + + public override void awakeEmitObject() + { + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = true; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + pkfxParticle.StartEffect(); + } + } + _loopAudio.Play(); + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void StopEffect() + { + StopAllEffect(); + } + + private void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + _lifeTime += Time.deltaTime; + if (_lifeTime > 4f) + { + StopAllEffect(); + } + } + } + + private void StopAllEffect() + { + if (!_isEndUpdate) + { + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = false; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + } + } + destoryEmitObject(1f); + _isEndUpdate = true; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidPreHit.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidPreHit.cs new file mode 100644 index 0000000..b865ab1 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRaidPreHit.cs @@ -0,0 +1,35 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisAirRaidPreEffect")] + public class FieEmitObjectQueenChrysalisAirRaidPreHit : FieEmittableObjectBase + { + private const float DURATION = 2f; + + [SerializeField] + private float _damageDuration = 0.3f; + + private float _lifeCount; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.identity; + destoryEmitObject(2f); + } + + private void Update() + { + _lifeCount += Time.deltaTime; + } + + private void OnTriggerEnter(Collider collider) + { + if (!(_lifeCount > _damageDuration) && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRiad.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRiad.cs new file mode 100644 index 0000000..0704550 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisAirRiad.cs @@ -0,0 +1,68 @@ +using Fie.Manager; +using Fie.Object; +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisAirRaidEffectMain")] + public class FieEmitObjectQueenChrysalisAirRiad : FieEmittableObjectBase + { + [SerializeField] + private float AirRaidBurstDuration = 0.5f; + + [SerializeField] + private float AirRaidAttackBurstWarmup = 1.5f; + + [SerializeField] + private float AirRaidBurstDestroyDuration = 1.5f; + + [SerializeField] + private PlaygroundParticlesC _asteroidParticle; + + private bool _isEndUpdate; + + private float _lifeCount; + + private bool _isEmittedAsteroid; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.identity; + _asteroidParticle.emit = false; + } + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > AirRaidAttackBurstWarmup && !_isEmittedAsteroid) + { + FieManagerBehaviour.I.gameCamera.setWiggler(0.8f, 20, new Vector3(0.1f, 0.6f)); + _asteroidParticle.emit = true; + _isEmittedAsteroid = true; + } + if (_lifeCount > AirRaidBurstDuration + AirRaidAttackBurstWarmup) + { + destoryEmitObject(AirRaidBurstDestroyDuration); + _isEndUpdate = true; + _asteroidParticle.emit = false; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && !(_lifeCount > AirRaidBurstDuration + AirRaidAttackBurstWarmup) && !(_lifeCount < AirRaidAttackBurstWarmup) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + Vector3 position = collider.ClosestPointOnBounds(base.transform.position); + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = position; + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCommonActivationEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCommonActivationEffect.cs new file mode 100644 index 0000000..d085c03 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCommonActivationEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisActivationEffect")] + public class FieEmitObjectQueenChrysalisCommonActivationEffect : FieEmittableObjectBase + { + private const float DURATION = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleBurst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleBurst.cs new file mode 100644 index 0000000..d1e46dd --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleBurst.cs @@ -0,0 +1,55 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisCrucibleBurst")] + public class FieEmitObjectQueenChrysalisCrucibleBurst : FieEmittableObjectBase + { + [SerializeField] + private float CRUCIBLE_BURST_DURATION = 3f; + + [SerializeField] + private float CRUCIBLE_BURST_DAMAGE_DURATION = 0.75f; + + [SerializeField] + private float CRUCIBLE_BURST_DAMAGE_START_DELAY = 0.5f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= CRUCIBLE_BURST_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount < CRUCIBLE_BURST_DAMAGE_START_DELAY) && !(_lifeTimeCount > CRUCIBLE_BURST_DAMAGE_DURATION + CRUCIBLE_BURST_DAMAGE_START_DELAY) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = collider.ClosestPointOnBounds(base.transform.position); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleCircle.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleCircle.cs new file mode 100644 index 0000000..5ced91f --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisCrucibleCircle.cs @@ -0,0 +1,101 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisCrucibleCircle")] + public class FieEmitObjectQueenChrysalisCrucibleCircle : FieEmittableObjectBase + { + public delegate void hitDelegate(Vector3 point); + + [SerializeField] + private float CIRCLE_SCALING_DURATION = 1.5f; + + [SerializeField] + private float CIRCLE_DESTROY_DURATION = 1f; + + [SerializeField] + private float START_SCALE = 0.2f; + + [SerializeField] + private float END_SCALE = 3f; + + [SerializeField] + private List _scaledTransform = new List(); + + [SerializeField] + private PlaygroundParticlesC _flameParticle; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + private Tweener _scaleTweener = new Tweener(); + + public event hitDelegate hitEvent; + + public override void awakeEmitObject() + { + _scaleTweener.InitTweener(CIRCLE_SCALING_DURATION, START_SCALE, END_SCALE); + if (_flameParticle != null) + { + _flameParticle.emit = true; + } + ApplyScaleToScaledTransforms(START_SCALE); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + float scaleXZ = _scaleTweener.UpdateParameterFloat(Time.deltaTime); + ApplyScaleToScaledTransforms(scaleXZ); + if (_lifeTimeCount >= CIRCLE_SCALING_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(CIRCLE_DESTROY_DURATION); + if (_flameParticle != null) + { + _flameParticle.emit = false; + } + } + } + } + + public void ApplyScaleToScaledTransforms(float scaleXZ) + { + if (_scaledTransform.Count > 0) + { + foreach (Transform item in _scaledTransform) + { + item.localScale = new Vector3(scaleXZ, scaleXZ, 1f); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > CIRCLE_SCALING_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = vector; + FieManagerBehaviour.I.EmitObject(fieGameCharacter.centerTransform, Vector3.zero); + if (this.hitEvent != null) + { + this.hitEvent(vector); + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashFirst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashFirst.cs new file mode 100644 index 0000000..a649b1e --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashFirst.cs @@ -0,0 +1,56 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisDoubleSlashFirst")] + public class FieEmitObjectQueenChrysalisDoubleSlashFirst : FieEmittableObjectBase + { + [SerializeField] + private float DOUBLE_SLASH_DURATION = 1.5f; + + [SerializeField] + private float DOUBLE_SLASH_DAMAGE_DURATION = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DOUBLE_SLASH_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DOUBLE_SLASH_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = collider.ClosestPointOnBounds(base.transform.position); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashSecond.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashSecond.cs new file mode 100644 index 0000000..db4b4dc --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisDoubleSlashSecond.cs @@ -0,0 +1,56 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisDoubleSlashSecond")] + public class FieEmitObjectQueenChrysalisDoubleSlashSecond : FieEmittableObjectBase + { + [SerializeField] + private float DOUBLE_SLASH_DURATION = 1.5f; + + [SerializeField] + private float DOUBLE_SLASH_DAMAGE_DURATION = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DOUBLE_SLASH_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DOUBLE_SLASH_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = collider.ClosestPointOnBounds(base.transform.position); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectBurned.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectBurned.cs new file mode 100644 index 0000000..7dc6fc5 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectBurned.cs @@ -0,0 +1,49 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHitEffectBurned")] + public class FieEmitObjectQueenChrysalisHitEffectBurned : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX _burningFx; + + private const float DURATION = 1f; + + private float _lifeCount; + + private bool _isEnd; + + public override void awakeEmitObject() + { + if (_burningFx != null) + { + _burningFx.StopEffect(); + _burningFx.StartEffect(); + } + } + + private void Update() + { + if (!_isEnd) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > 1f) + { + if (_burningFx != null) + { + _burningFx.StopEffect(); + } + destoryEmitObject(1f); + _isEnd = true; + } + } + } + + private void LateUpdate() + { + base.transform.position = initTransform.position; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectSmall.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectSmall.cs new file mode 100644 index 0000000..9bfd2dc --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHitEffectSmall.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHitEffectSmall")] + public class FieEmitObjectQueenChrysalisHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShot.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShot.cs new file mode 100644 index 0000000..58df240 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShot.cs @@ -0,0 +1,173 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHormingShot")] + public class FieEmitObjectQueenChrysalisHormingShot : FieEmittableObjectBase + { + [SerializeField] + private float HormingShotDuration = 2f; + + [SerializeField] + private float HormingShotVelocityMax = 2f; + + [SerializeField] + private float HormingShotVelocityAccelTime = 0.3f; + + [SerializeField] + private float HormingShotDestroyDuration = 1f; + + [SerializeField] + private float HormingShotTiltDuration = 1f; + + [SerializeField] + private float HormingDuration = 1.5f; + + [SerializeField] + private float TiltRotPerSecDegree = 120f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PKFxFX trail; + + private const float RANDOM_TILT_DISTANCE = 2f; + + private const float HORMING_DISTANCE_MAX = 10f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Quaternion _randomTiltRot = Quaternion.identity; + + private float _lifeTimeCount; + + private bool _isInitRandomTilt; + + private float _totalMoveDistance; + + private float _initEnemyDistance = -3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isEndHorming; + + private float _initHormingDuration; + + private float _tiltDegRot; + + private float _sinWave; + + private Vector3 _initEffectModelScale = Vector3.zero; + + private Vector3 _latestDirectionalVec = Vector3.zero; + + public int childId; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + base.reflectEvent += delegate + { + trail.StopEffect(); + destoryEmitObject(HormingShotDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + }; + } + + public override void awakeEmitObject() + { + trail.StopEffect(); + trail.StartEffect(); + _velocityTweener.InitTweener(HormingShotVelocityAccelTime, 0f, HormingShotVelocityMax); + _tiltForceTweener.InitTweener(HormingShotTiltDuration, 1f, 0f); + effectModel.transform.localScale = _initEffectModelScale; + if (targetTransform != null) + { + directionalVec = (targetTransform.position - base.transform.position).normalized; + } + _latestDirectionalVec = directionalVec; + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + + public void Update() + { + if (!_isEndUpdate) + { + if (!_isInitRandomTilt) + { + initRandomTilt(); + } + if (directionalVec != _latestDirectionalVec) + { + _lastDirectionalVec = (_latestDirectionalVec = directionalVec); + } + _tiltDegRot = Mathf.Repeat(_tiltDegRot + TiltRotPerSecDegree * Time.deltaTime, 360f); + Vector3 vector = base.transform.rotation * Vector3.forward; + Vector3 a = base.transform.position + vector * 2f; + Vector3 a2 = Quaternion.AngleAxis(_tiltDegRot, vector) * Vector3.up; + a2 *= 2f; + a += a2 * 2f; + _randomTiltRot = Quaternion.LookRotation(a - base.transform.position); + Vector3 forward = vector; + if (targetTransform != null) + { + forward = (directionalVec = Vector3.Lerp(vector, (targetTransform.position - base.transform.position).normalized, 3f * Time.deltaTime)); + } + _sinWave += 120f * Time.deltaTime; + Quaternion a3 = Quaternion.LookRotation(forward); + float num = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.rotation = Quaternion.Lerp(a3, _randomTiltRot, Mathf.Min(Mathf.Abs(Mathf.Sin(_sinWave)) * 0.2f, 1f) * num); + Vector3 vector2 = base.transform.rotation * Vector3.forward * _velocityTweener.UpdateParameterFloat(Time.deltaTime) * Time.deltaTime; + base.transform.position += vector2; + _totalMoveDistance += Vector3.Distance(base.transform.position, base.transform.position + vector2); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= HormingShotDuration) + { + destoryEmitObject(HormingShotDestroyDuration); + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + } + + private void initRandomTilt() + { + _tiltDegRot = Random.Range(0f, 360f); + _isInitRandomTilt = true; + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + trail.StopEffect(); + destoryEmitObject(HormingShotDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShotActivateEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShotActivateEffect.cs new file mode 100644 index 0000000..a48cdbf --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHormingShotActivateEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHormingShotActivateEffect")] + public class FieEmitObjectQueenChrysalisHormingShotActivateEffect : FieEmittableObjectBase + { + private const float DURATION = 1.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(1.5f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHornEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHornEffect.cs new file mode 100644 index 0000000..a29b560 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisHornEffect.cs @@ -0,0 +1,62 @@ +using Fie.Object; +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHornEffect")] + public class FieEmitObjectQueenChrysalisHornEffect : FieEmittableObjectBase + { + [SerializeField] + private float HORN_EFFECT_MAXIMUM_DURATION = 10f; + + [SerializeField] + private float HORN_EFFECT_DESTROY_DURATION = 1f; + + [SerializeField] + private PlaygroundParticlesC _hornParticle; + + private float _lifeCount; + + private bool _isEnd; + + public void Kill() + { + if (!_isEnd) + { + if (_hornParticle != null) + { + _hornParticle.emit = false; + } + destoryEmitObject(HORN_EFFECT_DESTROY_DURATION); + _isEnd = true; + } + } + + public override void awakeEmitObject() + { + _hornParticle.emit = true; + } + + private void Update() + { + if (!_isEnd) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > HORN_EFFECT_MAXIMUM_DURATION) + { + Kill(); + } + } + } + + private void LateUpdate() + { + if (!(initTransform == null)) + { + base.transform.position = initTransform.position; + base.transform.rotation = initTransform.rotation; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteBurst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteBurst.cs new file mode 100644 index 0000000..3c440d8 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteBurst.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisIgniteBurst")] + public class FieEmitObjectQueenChrysalisIgniteBurst : FieEmittableObjectBase + { + [SerializeField] + private float IGNITE_BURST_DURATION = 3f; + + [SerializeField] + private float IGNITE_DAMAGE_DURATION = 0.5f; + + private float _lifeCount; + + public override void awakeEmitObject() + { + destoryEmitObject(IGNITE_BURST_DURATION); + } + + public void AddDamageForGameCharacter(FieGameCharacter targetCharacter) + { + if (!(targetCharacter == null)) + { + FieGameCharacter x = addDamageToCharacter(targetCharacter, getDefaultDamageObject(), isPenetration: true); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(targetCharacter.centerTransform, Vector3.zero); + } + } + } + + private void Update() + { + _lifeCount += Time.deltaTime; + } + + private void OnTriggerEnter(Collider collider) + { + if (!(_lifeCount > IGNITE_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + defaultDamageObject.damage *= 0.5f; + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, defaultDamageObject, isPenetration: true); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(fieGameCharacter.centerTransform, Vector3.zero); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteCollision.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteCollision.cs new file mode 100644 index 0000000..9d55f7d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteCollision.cs @@ -0,0 +1,56 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisIgniteCollision")] + public class FieEmitObjectQueenChrysalisIgniteCollision : FieEmittableObjectBase + { + public delegate void GrabbedDelegate(FieGameCharacter grabbedCharacter); + + [SerializeField] + private float ChargeDuration = 0.5f; + + [SerializeField] + private float ChargeDamageDuration = 0.5f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public event GrabbedDelegate grabbedEvent; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ChargeDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > ChargeDamageDuration) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + if (this.grabbedEvent != null) + { + this.grabbedEvent(fieGameCharacter); + } + destoryEmitObject(ChargeDuration - _lifeTimeCount); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteConcentration.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteConcentration.cs new file mode 100644 index 0000000..b7355fb --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisIgniteConcentration.cs @@ -0,0 +1,127 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisIgniteConcentration")] + public class FieEmitObjectQueenChrysalisIgniteConcentration : FieEmittableObjectBase + { + private const float MAXIMUM_EMITTING_DURATION = 4f; + + private const float MAXIMUM_DURATION = 5f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.5f; + + [SerializeField] + private List _ppParticleList = new List(); + + [SerializeField] + private List _pkfxParticleList = new List(); + + private float _lifeTime; + + private float _initialAudioVolume = 1f; + + private bool _isEndUpdate; + + private Tweener _audioFadeTweener = new Tweener(); + + private void Awake() + { + _initialAudioVolume = _loopAudio.volume; + } + + public override void awakeEmitObject() + { + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = true; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + pkfxParticle.StartEffect(); + } + } + _loopAudio.Play(); + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void StopEffect() + { + StopAllEffect(); + } + + private void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + _lifeTime += Time.deltaTime; + if (_lifeTime > 4f) + { + StopAllEffect(); + } + } + } + + private void StopAllEffect() + { + if (!_isEndUpdate) + { + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = false; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + } + } + destoryEmitObject(1f); + _isEndUpdate = true; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerBurst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerBurst.cs new file mode 100644 index 0000000..01066f2 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerBurst.cs @@ -0,0 +1,45 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisMeteorBurst")] + public class FieEmitObjectQueenChrysalisMeteorShowerBurst : FieEmittableObjectBase + { + [SerializeField] + private float MeteorShowerBurstDuration = 0.7f; + + [SerializeField] + private float MeteorShowerBurstDestroyDuration = 0.7f; + + private bool _isEndUpdate; + + private float _lifeCount; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > MeteorShowerBurstDuration) + { + destoryEmitObject(MeteorShowerBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerConcentration.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerConcentration.cs new file mode 100644 index 0000000..dd2e09d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerConcentration.cs @@ -0,0 +1,124 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisMeteorConcentration")] + public class FieEmitObjectQueenChrysalisMeteorShowerConcentration : FieEmittableObjectBase + { + private const float MAXIMUM_EMITTING_DURATION = 6f; + + private const float MAXIMUM_DURATION = 8f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.5f; + + [SerializeField] + private List _ppParticleList = new List(); + + [SerializeField] + private List _pkfxParticleList = new List(); + + private float _lifeTime; + + private float _initialAudioVolume = 1f; + + private bool _isEndUpdate; + + private Tweener _audioFadeTweener = new Tweener(); + + private void Awake() + { + _initialAudioVolume = _loopAudio.volume; + } + + public override void awakeEmitObject() + { + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = true; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + pkfxParticle.StartEffect(); + } + } + _loopAudio.Play(); + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void StopEffect() + { + StopAllEffect(); + } + + private void Update() + { + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + _lifeTime += Time.deltaTime; + if (_lifeTime > 6f) + { + StopAllEffect(); + _isEndUpdate = true; + } + } + } + + private void StopAllEffect() + { + if (!_isEndUpdate) + { + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = false; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + } + } + destoryEmitObject(2f); + _isEndUpdate = true; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect.cs new file mode 100644 index 0000000..6051408 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect.cs @@ -0,0 +1,139 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisMeteorEmitting")] + public class FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect : FieEmittableObjectBase + { + private const float MAXIMUM_EMITTING_DURATION = 25f; + + private const float DESTROY_DURATION = 2f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.5f; + + [SerializeField] + private List _ppParticleList = new List(); + + [SerializeField] + private List _pkfxParticleList = new List(); + + private float _lifeTime; + + private float _initialAudioVolume = 1f; + + private bool _isEndUpdate; + + private Tweener _audioFadeTweener = new Tweener(); + + private void Awake() + { + _initialAudioVolume = _loopAudio.volume; + } + + public override void awakeEmitObject() + { + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = true; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + pkfxParticle.StartEffect(); + } + } + _loopAudio.Play(); + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void StopEffect() + { + StopAllEffect(); + } + + private void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + _lifeTime += Time.deltaTime; + if (_lifeTime > 25f) + { + StopAllEffect(); + } + } + } + + private void StopAllEffect() + { + if (!_isEndUpdate) + { + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = false; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + } + } + destoryEmitObject(2f); + _isEndUpdate = true; + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerMeteor.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerMeteor.cs new file mode 100644 index 0000000..9061b5b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisMeteorShowerMeteor.cs @@ -0,0 +1,155 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisMeteor")] + public class FieEmitObjectQueenChrysalisMeteorShowerMeteor : FieEmittableObjectBase + { + [SerializeField] + private float meteorDuration = 3f; + + [SerializeField] + private float meteorVelocityMax = 2f; + + [SerializeField] + private float meteorAccelTime = 0.1f; + + [SerializeField] + private float meteorDestroyDuration = 1f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.2f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PlaygroundParticlesC _flameParticle; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Tweener _audioFadeTweener = new Tweener(); + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private Vector3 _initEffectModelScale = Vector3.zero; + + private float _initialAudioVolume = 1f; + + public void Awake() + { + if (effectModel != null) + { + _initEffectModelScale = effectModel.transform.localScale; + } + base.reflectEvent += delegate + { + FieEmitObjectQueenChrysalisMeteorShowerBurst fieEmitObjectQueenChrysalisMeteorShowerBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.forward); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(meteorDestroyDuration); + if (_flameParticle != null) + { + _flameParticle.emit = false; + } + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + }; + if (_loopAudio != null) + { + _initialAudioVolume = _loopAudio.volume; + } + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(meteorAccelTime, 0f, meteorVelocityMax); + _scaleTweener.InitTweener(meteorAccelTime, Vector3.zero, Vector3.one); + _initDirectionalVec = new Vector3(0f, -1f, 0f).normalized; + effectModel.transform.localScale = _initEffectModelScale; + effectModel.transform.rotation = Quaternion.Euler((float)Random.Range(0, 360), (float)Random.Range(0, 360), (float)Random.Range(0, 360)); + if (_flameParticle != null) + { + _flameParticle.emit = true; + } + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void Update() + { + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + Vector3 vector = _initDirectionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= meteorDuration) + { + destoryEmitObject(meteorDestroyDuration); + if (_flameParticle != null) + { + _flameParticle.emit = false; + } + if (effectModel != null) + { + effectModel.transform.localScale = Vector3.zero; + } + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == "Floor" || collider.gameObject.tag == getHostileTagString())) + { + FieEmitObjectQueenChrysalisMeteorShowerBurst fieEmitObjectQueenChrysalisMeteorShowerBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.forward); + if (fieEmitObjectQueenChrysalisMeteorShowerBurst != null) + { + fieEmitObjectQueenChrysalisMeteorShowerBurst.setAllyTag(getArrayTag()); + fieEmitObjectQueenChrysalisMeteorShowerBurst.setHostileTag(getHostileTag()); + } + if (collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + } + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(meteorDestroyDuration); + if (_flameParticle != null) + { + _flameParticle.emit = false; + } + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (effectModel != null) + { + effectModel.transform.localScale = Vector3.zero; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShot.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShot.cs new file mode 100644 index 0000000..ccd6e93 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShot.cs @@ -0,0 +1,148 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisPenetrateShot")] + public class FieEmitObjectQueenChrysalisPenetrateShot : FieEmittableObjectBase + { + [SerializeField] + private float shotDuration = 1f; + + [SerializeField] + private float shotVelocityMax = 4f; + + [SerializeField] + private float shotAccelTime = 0.1f; + + [SerializeField] + private float shoutDestroyDuration = 0.5f; + + [SerializeField] + private float PenetrateShotPysicalForce = 5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private Light shotLight; + + [SerializeField] + private PKFxFX trail; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(shotAccelTime, 0f, shotVelocityMax); + _scaleTweener.InitTweener(shotAccelTime, Vector3.zero, Vector3.one); + _initDirectionalVec = directionalVec; + if (targetTransform != null && targetTransform.root != null) + { + Vector3 a = targetTransform.position; + FieGameCharacter component = targetTransform.root.GetComponent(); + if (component != null && component.groundState == FieObjectGroundState.Grounding) + { + int layerMask = 512; + if (Physics.Raycast(targetTransform.position + Vector3.up * 2f, Vector3.down, out RaycastHit hitInfo, 1024f, layerMask) && hitInfo.collider.tag == "Floor") + { + a = hitInfo.point; + } + } + _initDirectionalVec = a - base.transform.position; + _initDirectionalVec.Normalize(); + directionalVec = _initDirectionalVec; + } + if (trail != null) + { + trail.StopEffect(); + trail.StartEffect(); + } + effectModel.transform.localScale = _initEffectModelScale; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 vector = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shotDuration) + { + trail.StopEffect(); + destoryEmitObject(shoutDestroyDuration); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject(), isPenetration: true); + if (fieGameCharacter != null) + { + Vector3 normalized = directionalVec.normalized; + normalized.y = 0.5f; + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(normalized * PenetrateShotPysicalForce, 0f, useRound: false); + } + } + if (collider.gameObject.tag == "Floor") + { + FieEmitObjectQueenChrysalisPenetrateShotBurst fieEmitObjectQueenChrysalisPenetrateShotBurst = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (fieEmitObjectQueenChrysalisPenetrateShotBurst != null) + { + fieEmitObjectQueenChrysalisPenetrateShotBurst.setAllyTag(getArrayTag()); + fieEmitObjectQueenChrysalisPenetrateShotBurst.setHostileTag(getHostileTag()); + } + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_BIG); + if (trail != null) + { + trail.StopEffect(); + } + shotLight.intensity = 0f; + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(shotDuration - _lifeTimeCount); + _isEndUpdate = true; + } + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotActivateEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotActivateEffect.cs new file mode 100644 index 0000000..7f284c5 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotActivateEffect.cs @@ -0,0 +1,17 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisPenetrateShotActivateEffect")] + public class FieEmitObjectQueenChrysalisPenetrateShotActivateEffect : FieEmittableObjectBase + { + private const float DURATION = 3f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(3f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotBurst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotBurst.cs new file mode 100644 index 0000000..4838e01 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisPenetrateShotBurst.cs @@ -0,0 +1,40 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisPenetrateShotBurst")] + public class FieEmitObjectQueenChrysalisPenetrateShotBurst : FieEmittableObjectBase + { + [SerializeField] + private float PenetrateShotBurstDuration = 0.7f; + + [SerializeField] + private float PenetrateShotBurstDestroyDuration = 0.5f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > PenetrateShotBurstDuration) + { + destoryEmitObject(PenetrateShotBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisReflectionEffect.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisReflectionEffect.cs new file mode 100644 index 0000000..76b6006 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisReflectionEffect.cs @@ -0,0 +1,18 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisReflectEffect")] + public class FieEmitObjectQueenChrysalisReflectionEffect : FieEmittableObjectBase + { + [SerializeField] + private float reflectEffectDuration = 0.6f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(reflectEffectDuration); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisShootingConcentration.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisShootingConcentration.cs new file mode 100644 index 0000000..e33eb62 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisShootingConcentration.cs @@ -0,0 +1,127 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisShootingConcentration")] + public class FieEmitObjectQueenChrysalisShootingConcentration : FieEmittableObjectBase + { + private const float MAXIMUM_EMITTING_DURATION = 3f; + + private const float MAXIMUM_DURATION = 4f; + + [SerializeField] + private AudioSource _loopAudio; + + [SerializeField] + private float _audioFadeTime = 0.5f; + + [SerializeField] + private List _ppParticleList = new List(); + + [SerializeField] + private List _pkfxParticleList = new List(); + + private float _lifeTime; + + private float _initialAudioVolume = 1f; + + private bool _isEndUpdate; + + private Tweener _audioFadeTweener = new Tweener(); + + private void Awake() + { + _initialAudioVolume = _loopAudio.volume; + } + + public override void awakeEmitObject() + { + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = true; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + pkfxParticle.StartEffect(); + } + } + _loopAudio.Play(); + _audioFadeTweener.InitTweener(0.5f, _initialAudioVolume, _initialAudioVolume); + } + + public void StopEffect() + { + StopAllEffect(); + } + + private void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + _loopAudio.volume = _audioFadeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_isEndUpdate) + { + _lifeTime += Time.deltaTime; + if (_lifeTime > 3f) + { + StopAllEffect(); + } + } + } + + private void StopAllEffect() + { + if (!_isEndUpdate) + { + _audioFadeTweener.InitTweener(_audioFadeTime, _initialAudioVolume, 0f); + if (_ppParticleList.Count > 0) + { + foreach (PlaygroundParticlesC ppParticle in _ppParticleList) + { + ppParticle.emit = false; + } + } + if (_pkfxParticleList.Count > 0) + { + foreach (PKFxFX pkfxParticle in _pkfxParticleList) + { + pkfxParticle.StopEffect(); + } + } + destoryEmitObject(1f); + _isEndUpdate = true; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisStaggerRecoveringBurst.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisStaggerRecoveringBurst.cs new file mode 100644 index 0000000..f5bcaa0 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieEmitObjectQueenChrysalisStaggerRecoveringBurst.cs @@ -0,0 +1,70 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisRecoveringAttack")] + public class FieEmitObjectQueenChrysalisStaggerRecoveringBurst : FieEmittableObjectBase + { + [SerializeField] + private float RecoverAttackBurstDuration = 0.5f; + + [SerializeField] + private float RecoverAttackBurstWarmup = 0.3f; + + [SerializeField] + private float RecorverAttackBurstDestroyDuration = 1f; + + [SerializeField] + private float RecorverAttackPysicalForce = 5f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > RecoverAttackBurstDuration) + { + destoryEmitObject(RecorverAttackBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && !(_lifeCount > RecoverAttackBurstDuration + RecoverAttackBurstWarmup) && !(_lifeCount < RecoverAttackBurstWarmup)) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + Vector3 a = collider.ClosestPointOnBounds(base.transform.position); + FieManagerBehaviour.I.EmitObject(fieGameCharacter.centerTransform, Vector3.zero); + Vector3 vector = a - base.transform.position; + vector = new Vector3(vector.x, 0f, vector.z).normalized; + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(vector * RecorverAttackPysicalForce, 0f, useRound: false); + } + } + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector2 = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector3 = vector2 - base.transform.position; + FieEmitObjectQueenChrysalisReflectionEffect fieEmitObjectQueenChrysalisReflectionEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector3.normalized); + if (fieEmitObjectQueenChrysalisReflectionEffect != null) + { + fieEmitObjectQueenChrysalisReflectionEffect.transform.position = vector2; + } + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalis.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalis.cs new file mode 100644 index 0000000..1f9d3df --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalis.cs @@ -0,0 +1,302 @@ +using Fie.AI; +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/QueenChrysalis")] + public class FieQueenChrysalis : FieEnemiesHoovesRaces + { + public const int MAXIMUM_MINION_NUMBER = 2; + + public const float DEFAULT_CALLED_MINION_DELAY = 15f; + + public const float DIALOUGE_INTERVAL = 30f; + + public const float DIALOUGE_INTERVAL_FIRST_TIME = 3f; + + [SerializeField] + private Transform _concentrationTransform; + + private const float STAGGER_IMUNITE_DELAY = 5f; + + public FieGameCharacter grabbingGameCharacter; + + private float _callingMinionDelay; + + private float _maximumCallingMinionDelay; + + private int _maximumCallingMinionCount = 2; + + public bool _isImmuniteStaggerDamage; + + public bool _isEffectivePull; + + public float _staggerDamageRate = 1f; + + public float _staggerImuniteDelay; + + public float _staggerImuniteDelayInitializedParam; + + public float _dialougeInterval = 3f; + + private FieGameCharacter[] _currentMinions = new FieGameCharacter[2]; + + public Transform concentrationTransform => _concentrationTransform; + + public FieGameCharacter[] currentMinions => _currentMinions; + + public int currentMinionCount + { + get + { + int num = 0; + FieGameCharacter[] currentMinions = _currentMinions; + foreach (FieGameCharacter x in currentMinions) + { + if (x != null) + { + num++; + } + } + return num; + } + } + + public bool canAbleToCallMinion => currentMinionCount <= 0 && _callingMinionDelay <= 0f; + + public int maximumCallingMinionCount => _maximumCallingMinionCount; + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieQueenChrysalisAnimationContainer()); + base.damageSystem.deathEvent += delegate + { + FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.zero, null); + UnbindFromDetecter(); + if (PhotonNetwork.isMasterClient) + { + PhotonNetwork.Destroy(base.photonView); + } + }; + base.damageSystem.beforeDamageEvent += this.HealthSystem_beforeDamageEvent; + base.damageSystem.ResetStaggerEvent(); + base.damageSystem.staggerEvent += delegate + { + setStateToStatheMachine(typeof(FieStateMachineEnemiesQueenChrysalisStagger), isForceSet: true, isDupulicate: true); + }; + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_QueenChrysalisRift); + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_QueenChrysalisPull); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + } + + private void HealthSystem_beforeDamageEvent(FieGameCharacter attacker, ref FieDamage damage) + { + if (_isImmuniteStaggerDamage) + { + damage.stagger = 0f; + } + damage.stagger *= _staggerDamageRate; + } + + protected new void Start() + { + base.Start(); + base.emotionController.SetDefaultEmoteAnimationID(30); + base.emotionController.SetEmoteAnimation(30, isForceSet: true); + _maximumCallingMinionDelay = 15f; + _maximumCallingMinionCount = 2; + } + + private new void Update() + { + base.Update(); + if (_staggerImuniteDelay > 0f) + { + _staggerImuniteDelay -= Time.deltaTime; + _staggerDamageRate = ((!(_staggerImuniteDelay <= 0f)) ? (1f - _staggerDamageRate / _staggerImuniteDelayInitializedParam) : 1f); + } + if (_callingMinionDelay > 0f && currentMinionCount <= 0) + { + _callingMinionDelay -= Time.deltaTime; + } + if (_dialougeInterval > 0f && !base.voiceController.isPlaying) + { + _dialougeInterval -= Time.deltaTime; + } + if (base.isSpeakable && _dialougeInterval <= 0f) + { + SetRandomDialouge(); + _dialougeInterval = 30f; + } + } + + private void SetRandomDialouge() + { + if (healthStats.shield > 0f) + { + float num = healthStats.shield / healthStats.maxShield; + if (num > 0.5f) + { + SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_APPEAR_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_APPEAR_2)); + } + else + { + SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_2), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_3)); + } + } + else + { + float num2 = healthStats.hitPoint / healthStats.maxHitPoint; + if (num2 > 0.7f) + { + SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_6), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_7)); + } + else if (num2 > 0.3f) + { + SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_8), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_9)); + } + else + { + SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_10), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_11), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_12)); + } + } + } + + public void SetCalledMinionDelay() + { + _callingMinionDelay = _maximumCallingMinionDelay; + } + + private void ApplyStatusEffect_QueenChrysalisRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsRiftEntity fieStatusEffectsRiftEntity = statusEffect as FieStatusEffectsRiftEntity; + if (fieStatusEffectsRiftEntity != null && healthStats.stagger + damage.stagger >= healthStats.staggerResistance) + { + FieStateMachineQueenChrysalisRift fieStateMachineQueenChrysalisRift = setStateToStatheMachine(typeof(FieStateMachineQueenChrysalisRift), isForceSet: true, isDupulicate: true) as FieStateMachineQueenChrysalisRift; + if (fieStateMachineQueenChrysalisRift != null) + { + fieStateMachineQueenChrysalisRift.ResetMoveForce(fieStatusEffectsRiftEntity.resetMoveForce); + fieStateMachineQueenChrysalisRift.SetRiftForceRate(fieStatusEffectsRiftEntity.riftForceRate); + } + damage.stagger = 0f; + healthStats.stagger = 0f; + } + } + } + } + + private void ApplyStatusEffect_QueenChrysalisPull(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsPullEntity fieStatusEffectsPullEntity = statusEffect as FieStatusEffectsPullEntity; + if (fieStatusEffectsPullEntity != null) + { + if (_isEffectivePull) + { + FieStateMachineStatusEffectPull fieStateMachineStatusEffectPull = setStateToStatheMachine(typeof(FieStateMachineStatusEffectPull), isForceSet: true, isDupulicate: true) as FieStateMachineStatusEffectPull; + if (fieStateMachineStatusEffectPull != null) + { + fieStateMachineStatusEffectPull.setPullPoint(fieStatusEffectsPullEntity.pullPosition); + fieStateMachineStatusEffectPull.setDuration(fieStatusEffectsPullEntity.pullDuration); + } + } + damage.stagger = 0f; + } + } + } + } + + public void SetStaggerImmuniteDelay(float delay = 5f) + { + _staggerImuniteDelay = (_staggerImuniteDelayInitializedParam = delay); + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_THE_QUEEN_OF_INSECTS); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.THE_INSECT_QUEEN; + } + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineQueenChrysalisBaseAttack); + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskQueenChrysalisIdle); + } + + public override FieStateMachineInterface getDefaultState(StateMachineType type) + { + if (type == StateMachineType.Base) + { + return new FieStateMachineQueenChrysalisIdle(); + } + return new FieStateMachineQueenChrysalisBaseAttack(); + } + + public override GDEGameCharacterTypeData getCharacterTypeData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.GameCharacterType_THE_INSECT_QUEEN); + } + + public override void RequestArrivalState() + { + } + + public override GDEEnemyTableData GetEnemyMasterData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_CHRYSALIS); + } + + public override FieConstValues.FieEnemy GetEnemyMasterDataID() + { + return FieConstValues.FieEnemy.ENEMY_TABLE_CHRYSALIS; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisAnimationContainer.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisAnimationContainer.cs new file mode 100644 index 0000000..5fa1e2d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisAnimationContainer.cs @@ -0,0 +1,64 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieQueenChrysalisAnimationContainer : FieEnemiesHoovesRacesAnimationContainer + { + public enum QueenChrysalisAnimationList + { + BACK_STEP = 8, + AIRRAID_ATTACKING, + AIRRAID_FINISHMOVE, + AIRRAID_PREPARE, + AIRRAID_TO_IDLE, + CALL_MINIONS_MIDAIR, + CALL_MINIONS_ONGROUND, + CRUCIBLE_FLYBY, + CRUCIBLE_KICK, + DOUBLE_SLASH, + DOUBLE_SLASH_MIDAIR, + GRAB_BURN, + GRAB_FAILED, + GRAB_PREBURN, + GRAB_START, + JUMP_IDLE, + JUMP_END, + METEOR_SHOWER_IDLE, + METEOR_SHOWER_PREPARE, + METEOR_SHOWER_TO_IDLE, + SHOOT_HORMING, + SHOOT_PENETRATION, + EMOTION_NORMAL, + EMOTION_EYE_CLOSE, + MAX_CHANGELING_ALPHA_ANIMATION + } + + public FieQueenChrysalisAnimationContainer() + { + addAnimationData(8, new FieSkeletonAnimationObject(0, "backstep")); + addAnimationData(9, new FieSkeletonAnimationObject(0, "airraid_attacking")); + addAnimationData(10, new FieSkeletonAnimationObject(0, "airraid_finishmove")); + addAnimationData(11, new FieSkeletonAnimationObject(0, "airraid_prepare")); + addAnimationData(12, new FieSkeletonAnimationObject(0, "airraid_to_idle")); + addAnimationData(13, new FieSkeletonAnimationObject(0, "call_minions_midair")); + addAnimationData(14, new FieSkeletonAnimationObject(0, "call_minions_onground")); + addAnimationData(15, new FieSkeletonAnimationObject(0, "crucible_flyby")); + addAnimationData(16, new FieSkeletonAnimationObject(0, "crucible_kick")); + addAnimationData(17, new FieSkeletonAnimationObject(0, "double_slash")); + addAnimationData(18, new FieSkeletonAnimationObject(0, "double_slash_midair")); + addAnimationData(19, new FieSkeletonAnimationObject(0, "grab_burn")); + addAnimationData(20, new FieSkeletonAnimationObject(0, "grab_failed")); + addAnimationData(21, new FieSkeletonAnimationObject(0, "grab_preburn")); + addAnimationData(22, new FieSkeletonAnimationObject(0, "grab_start")); + addAnimationData(23, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(24, new FieSkeletonAnimationObject(0, "jump_end_shallow")); + addAnimationData(25, new FieSkeletonAnimationObject(0, "meteor_shower_idle")); + addAnimationData(26, new FieSkeletonAnimationObject(0, "meteor_shower_prepare")); + addAnimationData(27, new FieSkeletonAnimationObject(0, "meteor_shower_to_idle")); + addAnimationData(28, new FieSkeletonAnimationObject(0, "shoot_horming")); + addAnimationData(29, new FieSkeletonAnimationObject(0, "shoot_penetration")); + addAnimationData(30, new FieSkeletonAnimationObject(1, "emotion_eye_open")); + addAnimationData(31, new FieSkeletonAnimationObject(1, "emotion_eye_close")); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisEffectManager.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisEffectManager.cs new file mode 100644 index 0000000..52cdb9d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieQueenChrysalisEffectManager.cs @@ -0,0 +1,74 @@ +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieQueenChrysalisEffectManager : MonoBehaviour + { + public FieQueenChrysalis _chrysalis; + + public PlaygroundParticlesC _teleportEffect; + + public PlaygroundParticlesC _teleportEndEffect; + + public PKFxFX _teleportingEffect; + + public Transform _submeshTransform; + + public AudioSource _teleportSoundEffect; + + private bool _isTeleporting; + + private WorldObject _worldObject; + + private void Start() + { + _worldObject = PlaygroundParticlesC.NewWorldObject(_submeshTransform); + } + + private void Update() + { + if (_chrysalis.getStateMachine().nowStateType() == typeof(FieStateMachineQueenChrysalisTeleportation)) + { + if (!_isTeleporting) + { + _teleportEndEffect.worldObject = null; + _teleportEndEffect.Emit(setEmission: false); + PlaygroundParticlesC.SetParticleTimeNow(_teleportEffect); + _teleportEffect.worldObject = _worldObject; + _teleportEffect.source = SOURCEC.WorldObject; + _teleportEffect.Emit(setEmission: true); + _chrysalis.submeshObject.enabled = false; + _isTeleporting = true; + _teleportSoundEffect.Play(); + _teleportingEffect.StopEffect(); + _teleportingEffect.StartEffect(); + } + } + else if (_isTeleporting) + { + _teleportEffect.Emit(setEmission: false); + _chrysalis.submeshObject.enabled = true; + PlaygroundParticlesC.SetParticleTimeNow(_teleportEndEffect); + _teleportEndEffect.worldObject = _worldObject; + _teleportEndEffect.source = SOURCEC.WorldObject; + _teleportEndEffect.transform.position = _chrysalis.torsoTransform.position; + Vector3 position = _teleportEndEffect.transform.position; + float x = position.x + 0.3f; + Vector3 position2 = _teleportEndEffect.transform.position; + float y = position2.y + 0.3f; + Vector3 position3 = _teleportEndEffect.transform.position; + Vector3 vector = new Vector3(x, y, position3.z + 0.1f); + Vector3 position4 = _teleportEndEffect.transform.position; + float x2 = position4.x - 0.3f; + Vector3 position5 = _teleportEndEffect.transform.position; + float y2 = position5.y - 0.3f; + Vector3 position6 = _teleportEndEffect.transform.position; + Vector3 vector2 = new Vector3(x2, y2, position6.z - 0.1f); + _teleportEndEffect.Emit(setEmission: true); + _isTeleporting = false; + _teleportingEffect.StopEffect(); + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineEnemiesQueenChrysalisStagger.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineEnemiesQueenChrysalisStagger.cs new file mode 100644 index 0000000..8c1705a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineEnemiesQueenChrysalisStagger.cs @@ -0,0 +1,106 @@ +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineEnemiesQueenChrysalisStagger : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (_staggerState == StaggerState.STATE_PREPARE) + { + int num = 3; + _nextState = typeof(FieStateMachineQueenChrysalisStaggerFall); + fieEnemiesHoovesRaces.isEnableGravity = false; + fieEnemiesHoovesRaces.isEnableGravity = true; + gameCharacter.setGravityRate(0.2f); + Vector3 vector = Vector3.Normalize(fieEnemiesHoovesRaces.centerTransform.position - fieEnemiesHoovesRaces.latestDamageWorldPoint); + vector.y *= 0.1f; + vector.z = 0f; + vector.Normalize(); + fieEnemiesHoovesRaces.setFlipByVector(vector * -1f); + fieEnemiesHoovesRaces.setMoveForce((Vector3.up + vector).normalized * 8f, 1f, useRound: false); + num = 4; + fieEnemiesHoovesRaces.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_8), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_9)); + TrackEntry trackEntry = fieEnemiesHoovesRaces.animationManager.SetAnimation(num, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.setGravityRate(1f); + fieEnemiesHoovesRaces.isEnableAutoFlip = true; + fieEnemiesHoovesRaces.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineEnemiesQueenChrysalisStagger)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRaidFinished.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRaidFinished.cs new file mode 100644 index 0000000..fd82604 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRaidFinished.cs @@ -0,0 +1,109 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisAirRaidFinished : FieStateMachineGameCharacterBase + { + private enum FinishedState + { + FINISHED_START, + FINISHED_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FinishedState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + switch (_fireState) + { + case FinishedState.FINISHED_START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(10, isLoop: false, isForceSet: true); + FieManagerBehaviour.I.EmitObject(chrysalis.transform, Vector3.up, null, chrysalis); + FieManagerBehaviour.I.EmitObject(chrysalis.transform, Vector3.up, null, chrysalis); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + TrackEntry trackEntry2 = chrysalis.animationManager.SetAnimation(12); + if (trackEntry2 != null) + { + trackEntry2.Complete += delegate + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + } + }; + } + else + { + _isEnd = true; + } + _fireState = FinishedState.FINISHED_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.emotionController.StopAutoAnimation(); + gameCharacter.isEnableCollider = true; + gameCharacter.isEnableAutoFlip = false; + gameCharacter.isEnableGravity = true; + gameCharacter.resetMoveForce(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableCollider = true; + gameCharacter.rootBone.transform.localRotation = Quaternion.identity; + gameCharacter.resetMoveForce(); + gameCharacter.submeshObject.enabled = true; + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadAttacking.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadAttacking.cs new file mode 100644 index 0000000..7552ef0 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadAttacking.cs @@ -0,0 +1,160 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisAirRiadAttacking : FieStateMachineGameCharacterBase + { + private enum AttackingState + { + AIR_RAID_ATTACKING_START, + AIR_RAID_ATTACKING, + AIR_RAID_ATTACKING_FINISHED + } + + private const float MAXIMUM_ATTACK_DISTANCE = 20f; + + private const float ATTAKING_DRATION = 0.3f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private AttackingState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + private Tweener _attackingTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + switch (_fireState) + { + case AttackingState.AIR_RAID_ATTACKING_START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(9, isLoop: false, isForceSet: true); + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_2)); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + InitializeAttackingTweener(chrysalis); + _fireState = AttackingState.AIR_RAID_ATTACKING_FINISHED; + } + }; + } + else + { + _isEnd = true; + } + _fireState = AttackingState.AIR_RAID_ATTACKING; + break; + } + case AttackingState.AIR_RAID_ATTACKING_FINISHED: + if (!_attackingTweener.IsEnd()) + { + chrysalis.position = _attackingTweener.UpdateParameterVec3(Time.deltaTime); + } + else + { + FieManagerBehaviour.I.gameCamera.setWiggler(0.4f, 10, new Vector3(0.05f, 0.3f)); + _nextState = typeof(FieStateMachineQueenChrysalisAirRaidFinished); + _isEnd = true; + } + break; + } + } + } + + private void InitializeAttackingTweener(FieQueenChrysalis chrysalis) + { + if (chrysalis == null) + { + _isEnd = true; + } + else + { + Vector3 vector = chrysalis.position; + Vector3 vector2 = Vector3.down; + FieGameCharacter lockonTargetObject = chrysalis.detector.lockonTargetObject; + if (lockonTargetObject != null) + { + vector2 = (lockonTargetObject.centerTransform.position - chrysalis.centerTransform.position).normalized; + vector2.y = -0.25f; + vector2 = vector2.normalized; + } + int layerMask = 1049088; + if (Physics.Raycast(chrysalis.centerTransform.position, vector2, out RaycastHit hitInfo, 20f, layerMask)) + { + vector = hitInfo.point; + } + layerMask = 512; + if (Physics.Raycast(vector, Vector3.down, out hitInfo, 20f, layerMask) && hitInfo.collider.tag == "Floor") + { + vector = hitInfo.point; + } + if (vector2 != Vector3.down) + { + chrysalis.setFlipByVector(new Vector3(vector2.x, 0f, 0f).normalized); + } + _attackingTweener.InitTweener(0.3f, chrysalis.position, vector); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.emotionController.StopAutoAnimation(); + gameCharacter.isEnableCollider = false; + gameCharacter.isEnableAutoFlip = false; + gameCharacter.isEnableGravity = false; + gameCharacter.resetMoveForce(); + autoFlipToEnemy(gameCharacter); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableCollider = true; + gameCharacter.rootBone.transform.localRotation = Quaternion.identity; + gameCharacter.resetMoveForce(); + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadPrepare.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadPrepare.cs new file mode 100644 index 0000000..f2b0c7b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisAirRiadPrepare.cs @@ -0,0 +1,148 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisAirRiadPrepare : FieStateMachineGameCharacterBase + { + private enum PreparingState + { + AIR_RAID_PREPARING_START, + AIR_RAID_PREPARING_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private PreparingState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + private FieEmitObjectQueenChrysalisAirRaidConcentration _concentrationObject; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + private float _initializedDrag; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + if (chrysalis.groundState != FieObjectGroundState.Flying) + { + _isEnd = true; + } + else + { + switch (_fireState) + { + case PreparingState.AIR_RAID_PREPARING_START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(11, isLoop: false, isForceSet: true); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + chrysalis._isEffectivePull = true; + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + chrysalis.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineQueenChrysalisAirRiadAttacking); + _isEnd = true; + }; + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "activate") + { + _concentrationObject = FieManagerBehaviour.I.EmitObject(chrysalis.leftFrontHoofTransform, chrysalis.flipDirectionVector); + } + if (e.Data.Name == "finished") + { + FieManagerBehaviour.I.EmitObject(chrysalis.leftFrontHoofTransform, chrysalis.flipDirectionVector); + if (_concentrationObject != null) + { + _concentrationObject.StopEffect(); + } + } + }; + } + else + { + _isEnd = true; + } + _fireState = PreparingState.AIR_RAID_PREPARING_END; + break; + } + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = false; + gameCharacter.resetMoveForce(); + autoFlipToEnemy(gameCharacter); + Rigidbody component = gameCharacter.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + component.drag = 500f; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + fieQueenChrysalis.isEnableGravity = true; + fieQueenChrysalis.isEnableAutoFlip = true; + fieQueenChrysalis.resetMoveForce(); + if (_concentrationObject != null) + { + _concentrationObject.StopEffect(); + } + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + Rigidbody component = fieQueenChrysalis.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + fieQueenChrysalis._isEffectivePull = false; + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisBaseAttack.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisBaseAttack.cs new file mode 100644 index 0000000..c42a9c6 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisBaseAttack.cs @@ -0,0 +1,27 @@ +using Fie.Object; +using System; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisBaseAttack : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieQueenChrysalis) + { + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineEnemiesAttackIdle); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCallingMinion.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCallingMinion.cs new file mode 100644 index 0000000..25c187a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCallingMinion.cs @@ -0,0 +1,194 @@ +using Fie.Enemies.HoovesRaces.Changeling; +using Fie.Enemies.HoovesRaces.ChangelingAlpha; +using Fie.Enemies.HoovesRaces.Flightling; +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisCallingMinion : FieStateMachineGameCharacterBase + { + private enum CallingState + { + CALLING_START, + CALLING + } + + private const float MELEE_HORMING_DISTANCE = 1f; + + private const float MELEE_HORMING_DEFAULT_RATE = 0.5f; + + private CallingState _meleeState; + + private bool _isEnd; + + private bool _isMidAirAttack; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + autoFlipToEnemy(fieQueenChrysalis); + fieQueenChrysalis.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + } + } + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (chrysalis == null) + { + _isEnd = true; + } + else if (_meleeState == CallingState.CALLING_START) + { + if (!chrysalis.canAbleToCallMinion) + { + _isEnd = true; + } + else + { + _isMidAirAttack |= (chrysalis.groundState == FieObjectGroundState.Flying); + TrackEntry trackEntry = null; + if (!_isMidAirAttack) + { + trackEntry = chrysalis.animationManager.SetAnimation(14, isLoop: false, isForceSet: true); + } + else + { + trackEntry = chrysalis.animationManager.SetAnimation(13, isLoop: false, isForceSet: true); + chrysalis.isEnableGravity = false; + } + if (trackEntry != null) + { + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_6), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_7)); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(chrysalis.leftFrontHoofTransform, Vector3.zero, null); + FieGameCharacter[] currentMinions = chrysalis.currentMinions; + for (int i = 0; i < chrysalis.maximumCallingMinionCount; i++) + { + currentMinions[i] = CreateEnemy(chrysalis); + if (currentMinions[i] != null) + { + currentMinions[i].healthStats.maxShield *= 0.5f; + currentMinions[i].healthStats.shield *= 0.5f; + currentMinions[i].healthStats.maxHitPoint *= 0.5f; + currentMinions[i].healthStats.hitPoint *= 0.5f; + currentMinions[i].expRate = 0.1f; + } + } + chrysalis.SetCalledMinionDelay(); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + _meleeState = CallingState.CALLING; + } + } + } + + private FieGameCharacter CreateEnemy(FieQueenChrysalis chrysalis) + { + Type enemyType = typeof(FieChangeling); + Lottery lottery = new Lottery(); + FieEnvironmentManager.Difficulty currentDifficulty = FieManagerBehaviour.I.currentDifficulty; + if (chrysalis.healthStats.shield > 0f) + { + if (currentDifficulty >= FieEnvironmentManager.Difficulty.NIGHTMARE) + { + lottery.AddItem(typeof(FieChangeling), 50); + lottery.AddItem(typeof(FieFlightling), 50); + if (chrysalis.currentMinionCount <= 0 && currentDifficulty >= FieEnvironmentManager.Difficulty.NORMAL) + { + lottery.AddItem(typeof(FieChangelingAlpha), 50 * (int)currentDifficulty); + } + } + else + { + lottery.AddItem(typeof(FieChangeling), 100); + lottery.AddItem(typeof(FieFlightling), 100); + } + } + else + { + float num = chrysalis.healthStats.hitPoint / chrysalis.healthStats.maxHitPoint; + if (num > 0.5f) + { + lottery.AddItem(typeof(FieChangeling), 200); + lottery.AddItem(typeof(FieFlightling), 100); + if (chrysalis.currentMinionCount <= 0 && currentDifficulty >= FieEnvironmentManager.Difficulty.NORMAL) + { + lottery.AddItem(typeof(FieChangelingAlpha), 50 * (int)currentDifficulty); + } + } + else if (currentDifficulty >= FieEnvironmentManager.Difficulty.CHAOS) + { + lottery.AddItem(typeof(FieChangelingAlpha), 100); + } + else + { + lottery.AddItem(typeof(FieChangeling), 100); + lottery.AddItem(typeof(FieFlightling), 100); + if (chrysalis.currentMinionCount <= 0 && currentDifficulty >= FieEnvironmentManager.Difficulty.NORMAL) + { + lottery.AddItem(typeof(FieChangelingAlpha), 200 * (int)currentDifficulty); + } + } + } + if (lottery.IsExecutable()) + { + enemyType = lottery.Lot(); + } + Vector3 normalized = new Vector3(UnityEngine.Random.Range(-1f, 1f), 0f, UnityEngine.Random.Range(-1f, 1f)).normalized; + Vector3 vector = chrysalis.position + normalized * 1f; + int layerMask = 1049088; + if (Physics.Raycast(chrysalis.centerTransform.position, normalized, out RaycastHit hitInfo, 1f, layerMask)) + { + vector = hitInfo.point; + } + layerMask = 512; + if (Physics.Raycast(vector, Vector3.down, out hitInfo, 20f, layerMask) && hitInfo.collider.tag == "Floor") + { + vector = hitInfo.point; + } + return FieManagerBehaviour.I.CreateEnemyOnlyMasterClienty(enemyType, vector); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCrucible.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCrucible.cs new file mode 100644 index 0000000..c5a9456 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisCrucible.cs @@ -0,0 +1,171 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisCrucible : FieStateMachineGameCharacterBase + { + private enum AttackState + { + KICK_START, + KICK, + FLYBY, + FINISHED + } + + private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle); + + private AttackState _attackingState; + + private bool _isEnd; + + private bool _isMidAirAttack; + + private int _attackCount; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + private List _hittedPosition = new List(); + + public override void initialize(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + autoFlipToEnemy(fieQueenChrysalis); + fieQueenChrysalis.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableCollider = true; + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieQueenChrysalis) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + switch (_attackingState) + { + case AttackState.KICK_START: + if (chrysalis.groundState != 0) + { + _isEnd = true; + } + else + { + TrackEntry trackEntry2 = chrysalis.animationManager.SetAnimation(16, isLoop: false, isForceSet: true); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + if (trackEntry2 != null) + { + trackEntry2.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieEmitObjectQueenChrysalisCrucibleCircle fieEmitObjectQueenChrysalisCrucibleCircle = FieManagerBehaviour.I.EmitObject(chrysalis.leftFrontHoofTransform, Vector3.forward, null, chrysalis); + if (fieEmitObjectQueenChrysalisCrucibleCircle != null) + { + fieEmitObjectQueenChrysalisCrucibleCircle.transform.rotation = Quaternion.identity; + fieEmitObjectQueenChrysalisCrucibleCircle.hitEvent += CrucibleCircle_hitEvent; + } + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + } + if (e.Data.Name == "finished") + { + _attackingState = AttackState.FLYBY; + } + }; + trackEntry2.Complete += delegate + { + _attackingState = AttackState.FLYBY; + }; + } + else + { + _isEnd = true; + } + _attackingState = AttackState.KICK; + } + break; + case AttackState.FLYBY: + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(15, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + foreach (Vector3 item in _hittedPosition) + { + FieEmitObjectQueenChrysalisCrucibleBurst fieEmitObjectQueenChrysalisCrucibleBurst = FieManagerBehaviour.I.EmitObject(chrysalis.transform, Vector3.zero, null, chrysalis); + fieEmitObjectQueenChrysalisCrucibleBurst.transform.position = item; + } + } + if (e.Data.Name == "activate") + { + FieManagerBehaviour.I.EmitObject(chrysalis.leftFrontHoofTransform, Vector3.zero, null, chrysalis); + } + if (e.Data.Name == "move") + { + chrysalis.isEnableGravity = false; + Vector3 moveForce = Vector3.up * e.Float; + chrysalis.setMoveForce(moveForce, 0.5f); + } + }; + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineQueenChrysalisJumpIdle); + _isEnd = true; + }; + } + _attackingState = AttackState.FINISHED; + break; + } + } + } + } + + private void CrucibleCircle_hitEvent(Vector3 point) + { + _hittedPosition.Add(point); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisDoubleSlash.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisDoubleSlash.cs new file mode 100644 index 0000000..74dacb9 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisDoubleSlash.cs @@ -0,0 +1,150 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisDoubleSlash : FieStateMachineGameCharacterBase + { + private enum MeleeState + { + MELEE_START, + MELEE + } + + private const float MELEE_HORMING_DISTANCE = 1f; + + private const float MELEE_HORMING_DEFAULT_RATE = 0.5f; + + private MeleeState _meleeState; + + private bool _isEnd; + + private bool _isMidAirAttack; + + private int _attackCount; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + autoFlipToEnemy(fieQueenChrysalis); + fieQueenChrysalis.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieQueenChrysalis) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (_meleeState == MeleeState.MELEE_START) + { + if (chrysalis.detector.lockonTargetObject != null) + { + Vector3 position = chrysalis.transform.position; + float y = position.y; + Vector3 position2 = chrysalis.detector.lockonTargetObject.position; + float y2 = position2.y; + _isMidAirAttack = (y2 > y + 1f); + _isMidAirAttack |= (chrysalis.groundState == FieObjectGroundState.Flying); + } + TrackEntry trackEntry = null; + if (!_isMidAirAttack) + { + trackEntry = chrysalis.animationManager.SetAnimation(17, isLoop: false, isForceSet: true); + } + else + { + trackEntry = chrysalis.animationManager.SetAnimation(18, isLoop: false, isForceSet: true); + chrysalis.isEnableGravity = false; + } + if (trackEntry != null) + { + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 a = chrysalis.flipDirectionVector; + Transform lockonEnemyTransform = chrysalis.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - chrysalis.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + vector.Normalize(); + a = vector; + vector.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + chrysalis.resetMoveForce(); + chrysalis.setMoveForce(vector2, 0f, useRound: false); + chrysalis.setFlipByVector(vector2); + } + if (e.Data.Name == "fire") + { + if (_attackCount == 0) + { + FieManagerBehaviour.I.EmitObject(chrysalis.torsoTransform, chrysalis.flipDirectionVector, null, chrysalis); + } + else + { + FieManagerBehaviour.I.EmitObject(chrysalis.torsoTransform, chrysalis.flipDirectionVector, null, chrysalis); + } + _attackCount++; + } + if (e.Data.Name == "finished") + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + _meleeState = MeleeState.MELEE; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisHormingShot.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisHormingShot.cs new file mode 100644 index 0000000..6261a7f --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisHormingShot.cs @@ -0,0 +1,120 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisHormingShot : FieStateMachineGameCharacterBase + { + private enum ShootState + { + STATE_PREPARE, + STATE_SHOOT + } + + private ShootState _shootState; + + private bool _isEnd; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + fieQueenChrysalis._isEffectivePull = false; + } + } + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + if (chrysalis.detector.getLockonEnemyTransform() == null) + { + _isEnd = true; + } + else + { + ShootState shootState = _shootState; + if (shootState == ShootState.STATE_PREPARE) + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(28, isLoop: false, isForceSet: true); + FieEmitObjectQueenChrysalisShootingConcentration concentRation = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector, chrysalis.detector.getLockonEnemyTransform(isCenter: true)); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null, chrysalis); + chrysalis._isEffectivePull = true; + if (trackEntry != null) + { + autoFlipToEnemy(chrysalis); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector, chrysalis.detector.getLockonEnemyTransform(isCenter: true), chrysalis); + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + chrysalis._isEffectivePull = false; + } + if (e.Data.Name == "move") + { + Vector3 flipDirectionVector = chrysalis.flipDirectionVector; + Vector3 moveForce = flipDirectionVector * e.Float; + chrysalis.resetMoveForce(); + chrysalis.setMoveForce(moveForce, 0f, useRound: false); + } + if (e.Data.Name == "finished") + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + concentRation.StopEffect(); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _shootState = ShootState.STATE_SHOOT; + } + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineQueenChrysalisPenetrateShot); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineQueenChrysalisPenetrateShot)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIdle.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIdle.cs new file mode 100644 index 0000000..503ae5b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIdle.cs @@ -0,0 +1,43 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisIdle : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieQueenChrysalis) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineQueenChrysalisJumpIdle); + _isEnd = true; + } + gameCharacter.animationManager.SetAnimation(0, isLoop: true); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteFailed.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteFailed.cs new file mode 100644 index 0000000..0767df2 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteFailed.cs @@ -0,0 +1,98 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisIgniteFailed : FieStateMachineGameCharacterBase + { + private enum FailedState + { + FAILED_START, + FAILED_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FailedState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + switch (_fireState) + { + case FailedState.FAILED_START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(20, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + chrysalis.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + }; + } + else + { + _isEnd = true; + } + _fireState = FailedState.FAILED_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgnitePrepare.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgnitePrepare.cs new file mode 100644 index 0000000..4b07bb6 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgnitePrepare.cs @@ -0,0 +1,159 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Object; +using Fie.Ponies; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisIgnitePrepare : FieStateMachineGameCharacterBase + { + private enum IgniteState + { + START, + PREPARE, + FINISHED + } + + private const float HORMING_DISTANCE = 1f; + + private const float HORMING_DEFAULT_RATE = 0.5f; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle); + + private IgniteState _state; + + private bool _succeedGrab; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + private FieEmitObjectQueenChrysalisIgniteConcentration _concentrationEffect; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (chrysalis == null) + { + _isEnd = true; + } + else if (chrysalis.grabbingGameCharacter == null) + { + _nextState = typeof(FieStateMachineQueenChrysalisIgniteFailed); + _isEnd = true; + } + else + { + switch (_state) + { + case IgniteState.START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(21, isLoop: false, isForceSet: true); + _concentrationEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + chrysalis._isEffectivePull = true; + if (FieManagerBehaviour.I.gameCamera != null) + { + FieManagerBehaviour.I.gameCamera.setOffsetTransition(chrysalis.grabbingGameCharacter, new FieCameraOffset(new FieCameraOffset.FieCameraOffsetParam(new Vector3(0f, -0.5f, 2.2f), new Vector3(0f, 0f, 0f), -10f), 0.5f, 3.5f, 0.3f)); + } + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "activate") + { + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector); + if (_concentrationEffect != null) + { + _concentrationEffect.StopEffect(); + } + chrysalis._isEffectivePull = true; + } + }; + trackEntry.Complete += delegate + { + FieStateMachinePoniesGrabbed fieStateMachinePoniesGrabbed = chrysalis.grabbingGameCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachinePoniesGrabbed; + if (fieStateMachinePoniesGrabbed != null) + { + FieEmitObjectQueenChrysalisIgniteBurst fieEmitObjectQueenChrysalisIgniteBurst = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector, null, chrysalis); + if (fieEmitObjectQueenChrysalisIgniteBurst != null) + { + fieEmitObjectQueenChrysalisIgniteBurst.AddDamageForGameCharacter(chrysalis.grabbingGameCharacter); + } + fieStateMachinePoniesGrabbed.SetReleaseState(isReleased: true); + chrysalis.grabbingGameCharacter = null; + _nextState = typeof(FieStateMachineQueenChrysalisIgniteSucceed); + _isEnd = true; + } + }; + _state = IgniteState.PREPARE; + } + else + { + _nextState = typeof(FieStateMachineQueenChrysalisIgniteFailed); + _isEnd = true; + } + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.emotionController.StopAutoAnimation(); + gameCharacter.isEnableAutoFlip = false; + autoFlipToEnemy(gameCharacter); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + base.terminate(gameCharacter); + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + fieQueenChrysalis.isEnableGravity = true; + fieQueenChrysalis.isEnableAutoFlip = false; + fieQueenChrysalis._isEffectivePull = false; + fieQueenChrysalis.emotionController.RestartAutoAnimation(); + if (_hornEffect != null) + { + _hornEffect.Kill(); + } + if (_concentrationEffect != null) + { + _concentrationEffect.StopEffect(); + } + if (fieQueenChrysalis.grabbingGameCharacter != null) + { + (fieQueenChrysalis.grabbingGameCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachinePoniesGrabbed)?.SetReleaseState(isReleased: true); + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteStart.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteStart.cs new file mode 100644 index 0000000..b7611f1 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteStart.cs @@ -0,0 +1,165 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Ponies; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisIgniteStart : FieStateMachineGameCharacterBase + { + private enum GrabState + { + START, + GRABBING, + FINISHED + } + + private const float HORMING_DISTANCE = 1f; + + private const float HORMING_DEFAULT_RATE = 0.5f; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle); + + private GrabState _state; + + private bool _succeedGrab; + + private FieGameCharacter _grabbedCharacter; + + private FieEmitObjectQueenChrysalisIgniteCollision _grabbingCollisionObject; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (chrysalis == null) + { + _isEnd = true; + } + else + { + switch (_state) + { + case GrabState.START: + if (chrysalis.groundState != 0) + { + _nextState = typeof(FieStateMachineQueenChrysalisIdle); + _isEnd = true; + } + else + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(22, isLoop: false, isForceSet: true); + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_3), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_4)); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 a = chrysalis.flipDirectionVector; + Transform lockonEnemyTransform = chrysalis.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - chrysalis.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + vector.Normalize(); + a = vector; + vector.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + chrysalis.resetMoveForce(); + chrysalis.setMoveForce(vector2, 0f, useRound: false); + chrysalis.setFlipByVector(vector2); + } + if (e.Data.Name == "fire") + { + _grabbingCollisionObject = FieManagerBehaviour.I.EmitObject(chrysalis.centerTransform, chrysalis.flipDirectionVector, null, chrysalis); + if (_grabbingCollisionObject != null) + { + _grabbingCollisionObject.grabbedEvent += delegate(FieGameCharacter grabbedCharacter) + { + _grabbedCharacter = grabbedCharacter; + }; + } + } + }; + trackEntry.Complete += delegate + { + if (!_succeedGrab) + { + _nextState = typeof(FieStateMachineQueenChrysalisIgniteFailed); + _isEnd = true; + } + }; + _state = GrabState.GRABBING; + } + else + { + _nextState = typeof(FieStateMachineQueenChrysalisIgniteFailed); + _isEnd = true; + } + } + break; + case GrabState.GRABBING: + if (_grabbedCharacter != null) + { + FieStateMachinePoniesGrabbed fieStateMachinePoniesGrabbed = _grabbedCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachinePoniesGrabbed; + if (fieStateMachinePoniesGrabbed != null) + { + fieStateMachinePoniesGrabbed.SetAnchorTransform(chrysalis.rightFrontHoofTransform, chrysalis.torsoTransform); + chrysalis.grabbingGameCharacter = _grabbedCharacter; + _nextState = typeof(FieStateMachineQueenChrysalisIgnitePrepare); + _isEnd = true; + } + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.emotionController.StopAutoAnimation(); + gameCharacter.isEnableAutoFlip = false; + autoFlipToEnemy(gameCharacter); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + base.terminate(gameCharacter); + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = false; + gameCharacter.emotionController.RestartAutoAnimation(); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteSucceed.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteSucceed.cs new file mode 100644 index 0000000..b48328a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisIgniteSucceed.cs @@ -0,0 +1,106 @@ +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisIgniteSucceed : FieStateMachineGameCharacterBase + { + private enum SucceedState + { + SUCCEED_START, + SUCCEED_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private SucceedState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + switch (_fireState) + { + case SucceedState.SUCCEED_START: + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(19, isLoop: false, isForceSet: true); + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_2)); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + chrysalis.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 moveForce = chrysalis.flipDirectionVector * e.Float; + chrysalis.setMoveForce(moveForce, 0f, useRound: false); + } + if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + }; + } + else + { + _isEnd = true; + } + _fireState = SucceedState.SUCCEED_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisJumpIdle.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisJumpIdle.cs new file mode 100644 index 0000000..62f997c --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisJumpIdle.cs @@ -0,0 +1,57 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisJumpIdle : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieQueenChrysalis && gameCharacter.groundState == FieObjectGroundState.Grounding) + { + gameCharacter.animationManager.SetAnimation(24, isLoop: false, isForceSet: true); + _nextState = typeof(FieStateMachineQueenChrysalisIdle); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + base.terminate(gameCharacter); + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerAttacking.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerAttacking.cs new file mode 100644 index 0000000..9862c55 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerAttacking.cs @@ -0,0 +1,191 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisMeteorShowerAttacking : FieStateMachineGameCharacterBase + { + private enum AttackingState + { + METEOR_SHOWER_ATTACKING_START, + METEOR_SHOWER_ATTACKING, + METEOR_SHOWER_ATTACKING_END + } + + private const float METEOR_EMITTING_DURATION = 6f; + + private const float METEOR_EMITTING_INTERVAL = 0.5f; + + private const float HORMING_SHOT_EMITTING_INTERVAL = 1f; + + private const float METEOR_EMITTING_DISTANCE_MAX = 8f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private AttackingState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + private FieEmitObjectQueenChrysalisMeteorShowerEmittingEffect _emittingEffect; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + private float _lifeTimeCount; + + private float _meteorEmittingDelay; + + private float _hormingShotEmittingDelay; + + private int _meteorEmittedCount; + + private float _initializedDrag; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + switch (_fireState) + { + case AttackingState.METEOR_SHOWER_ATTACKING_START: + { + TrackEntry trackEntry = fieQueenChrysalis.animationManager.SetAnimation(25, isLoop: true, isForceSet: true); + if (trackEntry == null) + { + _isEnd = true; + } + else + { + _hornEffect = FieManagerBehaviour.I.EmitObject(fieQueenChrysalis.hornTransform, Vector3.zero, null); + _emittingEffect = FieManagerBehaviour.I.EmitObject(fieQueenChrysalis.leftFrontHoofTransform, Vector3.zero, null); + _fireState = AttackingState.METEOR_SHOWER_ATTACKING; + } + break; + } + case AttackingState.METEOR_SHOWER_ATTACKING: + _lifeTimeCount += Time.deltaTime; + _meteorEmittingDelay -= Time.deltaTime; + if (_meteorEmittingDelay <= 0f) + { + EmitMeteor(fieQueenChrysalis); + _meteorEmittingDelay = 0.5f; + } + _hormingShotEmittingDelay -= Time.deltaTime; + if (_hormingShotEmittingDelay <= 0f) + { + FieManagerBehaviour.I.EmitObject(fieQueenChrysalis.leftFrontHoofTransform, fieQueenChrysalis.flipDirectionVector, fieQueenChrysalis.detector.getLockonEnemyTransform(isCenter: true), fieQueenChrysalis); + _hormingShotEmittingDelay = 1f; + } + if (_lifeTimeCount > 6f) + { + _fireState = AttackingState.METEOR_SHOWER_ATTACKING_END; + } + break; + case AttackingState.METEOR_SHOWER_ATTACKING_END: + _nextState = typeof(FieStateMachineQueenChrysalisMeteorShowerFinished); + _isEnd = true; + break; + } + } + } + + private void EmitMeteor(FieQueenChrysalis chrysalis) + { + if (!(chrysalis == null)) + { + Vector3 position = chrysalis.transform.position; + int num = Mathf.FloorToInt(position.x * 10f); + Vector3 position2 = chrysalis.transform.position; + int num2 = num + Mathf.FloorToInt(position2.y * 10f); + Vector3 position3 = chrysalis.transform.position; + int seed = num2 + Mathf.FloorToInt(position3.z * 10f) + _meteorEmittedCount; + UnityEngine.Random.InitState(seed); + float z = UnityEngine.Random.Range(-0.5f, 0.5f); + UnityEngine.Random.InitState(seed); + float num3 = UnityEngine.Random.Range(-10f, 10f); + Vector3 vector = -chrysalis.flipDirectionVector; + vector.z = z; + vector.Normalize(); + Vector3 vector2 = chrysalis.centerTransform.position + vector * num3; + int layerMask = 1049088; + if (Physics.Raycast(chrysalis.centerTransform.position, vector, out RaycastHit hitInfo, num3, layerMask)) + { + vector2 = hitInfo.point; + vector2 -= vector; + } + vector2.y += 4f; + FieEmitObjectQueenChrysalisMeteorShowerMeteor fieEmitObjectQueenChrysalisMeteorShowerMeteor = FieManagerBehaviour.I.EmitObject(chrysalis.centerTransform, chrysalis.flipDirectionVector, null, chrysalis); + if (fieEmitObjectQueenChrysalisMeteorShowerMeteor != null) + { + fieEmitObjectQueenChrysalisMeteorShowerMeteor.transform.position = vector2; + } + _meteorEmittedCount++; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + gameCharacter.isEnableGravity = false; + gameCharacter.resetMoveForce(); + Rigidbody component = gameCharacter.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + component.drag = 500f; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + gameCharacter.resetMoveForce(); + if (_emittingEffect != null) + { + _emittingEffect.StopEffect(); + } + if (_hornEffect != null) + { + _hornEffect.Kill(); + } + Rigidbody component = gameCharacter.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerFinished.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerFinished.cs new file mode 100644 index 0000000..7dc0735 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerFinished.cs @@ -0,0 +1,92 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisMeteorShowerFinished : FieStateMachineGameCharacterBase + { + private enum FinishedState + { + METEOR_SHOWER_FINISHED_START, + METEOR_SHOWER_FINISHED_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FinishedState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + switch (_fireState) + { + case FinishedState.METEOR_SHOWER_FINISHED_START: + { + TrackEntry trackEntry = fieQueenChrysalis.animationManager.SetAnimation(27, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _fireState = FinishedState.METEOR_SHOWER_FINISHED_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + gameCharacter.resetMoveForce(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + gameCharacter.resetMoveForce(); + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerPrepare.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerPrepare.cs new file mode 100644 index 0000000..f9a95ba --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisMeteorShowerPrepare.cs @@ -0,0 +1,159 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisMeteorShowerPrepare : FieStateMachineGameCharacterBase + { + private enum PreparingState + { + METEOR_SHOWER_PREPARE_START, + METEOR_SHOWER_PREPARE_END + } + + public const float METEOR_SHOWER_AIR_DRAG = 500f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private PreparingState _fireState; + + private bool _isEnd; + + private bool _isFinished; + + private FieEmitObjectQueenChrysalisMeteorShowerConcentration _concentrationObject; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + private float _initializedDrag; + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + switch (_fireState) + { + case PreparingState.METEOR_SHOWER_PREPARE_START: + { + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_5)); + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(26, isLoop: false, isForceSet: true); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + _concentrationObject = FieManagerBehaviour.I.EmitObject(chrysalis.concentrationTransform, chrysalis.flipDirectionVector); + chrysalis.emotionController.SetDefaultEmoteAnimationID(31); + chrysalis.emotionController.SetEmoteAnimation(31, isForceSet: true); + chrysalis._isEffectivePull = true; + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineQueenChrysalisMeteorShowerAttacking); + _isEnd = true; + }; + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 moveForce = Vector3.up * e.Float; + chrysalis.isEnableGravity = false; + chrysalis.resetMoveForce(); + chrysalis.setMoveForce(moveForce, 0.5f); + } + if (e.Data.Name == "activate") + { + if (_concentrationObject != null) + { + _concentrationObject.StopEffect(); + } + chrysalis.emotionController.SetDefaultEmoteAnimationID(30); + chrysalis.emotionController.SetEmoteAnimation(30, isForceSet: true); + chrysalis._isEffectivePull = false; + } + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector); + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_2)); + } + }; + } + else + { + _isEnd = true; + } + _fireState = PreparingState.METEOR_SHOWER_PREPARE_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + gameCharacter.isEnableGravity = true; + gameCharacter.resetMoveForce(); + autoFlipToEnemy(gameCharacter); + Rigidbody component = gameCharacter.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + component.drag = 500f; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + fieQueenChrysalis.isEnableGravity = true; + fieQueenChrysalis.isEnableAutoFlip = true; + fieQueenChrysalis.resetMoveForce(); + if (_concentrationObject != null) + { + _concentrationObject.StopEffect(); + } + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + Rigidbody component = fieQueenChrysalis.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + fieQueenChrysalis.emotionController.SetDefaultEmoteAnimationID(30); + fieQueenChrysalis.emotionController.SetEmoteAnimation(30, isForceSet: true); + fieQueenChrysalis._isEffectivePull = false; + } + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisPenetrateShot.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisPenetrateShot.cs new file mode 100644 index 0000000..bcd2c6f --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisPenetrateShot.cs @@ -0,0 +1,113 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisPenetrateShot : FieStateMachineGameCharacterBase + { + private enum ShootState + { + STATE_PREPARE, + STATE_SHOOT + } + + private ShootState _shootState; + + private bool _isEnd; + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + } + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + if (!(chrysalis == null)) + { + if (chrysalis.detector.getLockonEnemyTransform() == null) + { + _isEnd = true; + } + else if (_shootState == ShootState.STATE_PREPARE) + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(29, isLoop: false, isForceSet: true); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + if (trackEntry != null) + { + autoFlipToEnemy(chrysalis); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + Transform lockonEnemyTransform = chrysalis.detector.getLockonEnemyTransform(isCenter: true); + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector, lockonEnemyTransform, chrysalis); + Vector3 vector = chrysalis.flipDirectionVector; + if (lockonEnemyTransform != null) + { + vector = lockonEnemyTransform.position - chrysalis.hornTransform.position; + } + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, vector.normalized, null); + } + if (e.Data.Name == "move") + { + Vector3 flipDirectionVector = chrysalis.flipDirectionVector; + Vector3 moveForce = flipDirectionVector * e.Float; + chrysalis.resetMoveForce(); + chrysalis.setMoveForce(moveForce, 0f, useRound: false); + } + if (e.Data.Name == "finished") + { + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _shootState = ShootState.STATE_SHOOT; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineQueenChrysalisPenetrateShot)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisRift.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisRift.cs new file mode 100644 index 0000000..2d9fd84 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisRift.cs @@ -0,0 +1,125 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisRift : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private float _riftForceRate = 1f; + + private bool _resetMoveForce; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + _staggerState = StaggerState.STATE_STAGGER; + break; + case StaggerState.STATE_STAGGER: + { + int num = 3; + _nextState = typeof(FieStateMachineQueenChrysalisStaggerFall); + fieEnemiesHoovesRaces.isEnableGravity = false; + fieEnemiesHoovesRaces.isEnableGravity = true; + gameCharacter.setGravityRate(0.15f); + if (_resetMoveForce) + { + fieEnemiesHoovesRaces.resetMoveForce(); + } + fieEnemiesHoovesRaces.setMoveForce(Vector3.up * 8f * _riftForceRate, 1f, useRound: false); + num = 4; + TrackEntry trackEntry = fieEnemiesHoovesRaces.animationManager.SetAnimation(num, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.setGravityRate(1f); + fieEnemiesHoovesRaces.isEnableAutoFlip = true; + fieEnemiesHoovesRaces.isEnableGravity = true; + } + } + + public void SetRiftForceRate(float forceRate) + { + _riftForceRate = forceRate; + } + + public void ResetMoveForce(bool resetMoveForce) + { + _resetMoveForce = resetMoveForce; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineEnemiesQueenChrysalisStagger)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisStaggerFall.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisStaggerFall.cs new file mode 100644 index 0000000..c68f53a --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisStaggerFall.cs @@ -0,0 +1,136 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisStaggerFall : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private List _allowedStateList = new List(); + + private FieEmitObjectQueenChrysalisHornEffect _hornEffect; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + { + int animationId = 5; + TrackEntry trackEntry2 = chrysalis.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + trackEntry2.mixDuration = 0f; + chrysalis.emotionController.SetDefaultEmoteAnimationID(31); + chrysalis.emotionController.SetEmoteAnimation(31, isForceSet: true); + chrysalis.isSpeakable = false; + chrysalis._isImmuniteStaggerDamage = true; + _staggerState = StaggerState.STATE_STAGGER; + break; + } + case StaggerState.STATE_STAGGER: + if (chrysalis.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(6, isLoop: false, isForceSet: true); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "activate") + { + FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, chrysalis.flipDirectionVector, null, chrysalis); + _hornEffect = FieManagerBehaviour.I.EmitObject(chrysalis.hornTransform, Vector3.zero, null); + chrysalis.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_4), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_RANDOM_5)); + chrysalis.emotionController.SetDefaultEmoteAnimationID(30); + chrysalis.emotionController.SetEmoteAnimation(30, isForceSet: true); + chrysalis.isSpeakable = true; + } + if (e.Data.Name == "fire") + { + FieEmitObjectQueenChrysalisStaggerRecoveringBurst fieEmitObjectQueenChrysalisStaggerRecoveringBurst = FieManagerBehaviour.I.EmitObject(chrysalis.centerTransform, chrysalis.flipDirectionVector, null, chrysalis); + FieManagerBehaviour.I.gameCamera.setWiggler(0.6f, 15, new Vector3(0.2f, 0.5f)); + fieEmitObjectQueenChrysalisStaggerRecoveringBurst.transform.rotation = Quaternion.identity; + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + _staggerState = StaggerState.STATE_STAGGER_END; + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + fieQueenChrysalis.isEnableGravity = true; + fieQueenChrysalis.setGravityRate(0.5f); + fieQueenChrysalis.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + fieQueenChrysalis.setGravityRate(1f); + fieQueenChrysalis.isEnableAutoFlip = true; + fieQueenChrysalis.isEnableGravity = true; + if ((bool)_hornEffect) + { + _hornEffect.Kill(); + } + fieQueenChrysalis.emotionController.SetDefaultEmoteAnimationID(30); + fieQueenChrysalis.emotionController.SetEmoteAnimation(30, isForceSet: true); + fieQueenChrysalis.isSpeakable = true; + fieQueenChrysalis._isImmuniteStaggerDamage = false; + fieQueenChrysalis.SetStaggerImmuniteDelay(); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return _allowedStateList; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisTeleportation.cs b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisTeleportation.cs new file mode 100644 index 0000000..9c07485 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces.QueenChrysalis/FieStateMachineQueenChrysalisTeleportation.cs @@ -0,0 +1,130 @@ +using Fie.Object; +using Fie.Utility; +using System; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces.QueenChrysalis +{ + public class FieStateMachineQueenChrysalisTeleportation : FieStateMachineGameCharacterBase + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_STANDBY, + TELEPORTATION, + TELEPORTATION_END + } + + private const float TELEPORT_DELAY = 0.2f; + + private const float TELEPORT_DURATION = 1f; + + private const float TELEPORT_DISTANCE = 8f; + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private Type _nextState; + + private Vector3 _teleportNormalVec = Vector3.zero; + + private Vector3 _teleportTargetPos = Vector3.zero; + + private Tweener _teleportTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis; + if (!(fieQueenChrysalis == null)) + { + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + if (fieQueenChrysalis.groundState != 0) + { + _isEnd = true; + } + else + { + if (fieQueenChrysalis.flipState == FieObjectFlipState.Left) + { + _teleportNormalVec = Vector3.left; + } + else + { + _teleportNormalVec = Vector3.right; + } + if (fieQueenChrysalis.detector.lockonTargetObject != null) + { + _teleportNormalVec = fieQueenChrysalis.detector.lockonTargetObject.position - fieQueenChrysalis.position; + _teleportNormalVec.y = 0f; + _teleportNormalVec.Normalize(); + } + _teleportTargetPos = fieQueenChrysalis.position + _teleportNormalVec * 8f; + int layerMask = 1049088; + if (Physics.Raycast(fieQueenChrysalis.centerTransform.position, _teleportNormalVec, out RaycastHit hitInfo, 8f, layerMask) && Physics.Raycast(hitInfo.point, Vector3.down, out hitInfo, 8f, layerMask)) + { + _teleportTargetPos = hitInfo.point; + } + fieQueenChrysalis.isEnableCollider = false; + _teleportTweener.InitTweener(1f, fieQueenChrysalis.position, _teleportTargetPos); + _teleportationState = TeleportationState.TELEPORTATION; + } + break; + case TeleportationState.TELEPORTATION: + { + Vector3 vector2 = fieQueenChrysalis.position = _teleportTweener.UpdateParameterVec3(Time.deltaTime); + fieQueenChrysalis.setFlipByVector(fieQueenChrysalis.externalInputVector.normalized); + if (_teleportTweener.IsEnd()) + { + fieQueenChrysalis.isEnableCollider = true; + _teleportationState = TeleportationState.TELEPORTATION_END; + _isEnd = true; + autoFlipToEnemy(gameCharacter); + _nextState = typeof(FieStateMachineCommonIdle); + } + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + autoFlipToEnemy(gameCharacter); + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = false; + gameCharacter.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableCollider = true; + gameCharacter.isEnableAutoFlip = false; + } + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalFireEffect.cs b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalFireEffect.cs new file mode 100644 index 0000000..29d12ad --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalFireEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Common/ChangelingForcesArrivalFire")] + public class FieEmitObjectChangelingForcesArrivalFireEffect : FieEmittableObjectBase + { + private const float DURATION = 2f; + + private void Start() + { + destoryEmitObject(2f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalParticleEffect.cs b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalParticleEffect.cs new file mode 100644 index 0000000..376ca55 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesArrivalParticleEffect.cs @@ -0,0 +1,68 @@ +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Common/ChangelingForcecArrivalParticle")] + public class FieEmitObjectChangelingForcesArrivalParticleEffect : FieEmittableObjectBase + { + [SerializeField] + private float arrivalParticleDuration = 1.5f; + + [SerializeField] + private float arrivalDuration = 3f; + + [SerializeField] + private List particles; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Awake() + { + } + + public void StopEffect() + { + if (!_isEndUpdate) + { + foreach (PlaygroundParticlesC particle in particles) + { + if (particle != null) + { + particle.emit = false; + } + } + _isEndUpdate = true; + destoryEmitObject(arrivalParticleDuration - arrivalDuration); + } + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= arrivalDuration) + { + foreach (PlaygroundParticlesC particle in particles) + { + if (particle != null) + { + particle.emit = false; + } + } + _isEndUpdate = true; + destoryEmitObject(arrivalParticleDuration - arrivalDuration); + } + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesDeadEffect.cs b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesDeadEffect.cs new file mode 100644 index 0000000..bf694c3 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieEmitObjectChangelingForcesDeadEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Enemies.HoovesRaces +{ + [FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Common/ChangelingForcesDeadEffect")] + public class FieEmitObjectChangelingForcesDeadEffect : FieEmittableObjectBase + { + private const float DURATION = 2.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(2.5f); + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieEnemiesHoovesRaces.cs b/src/Fie.Enemies.HoovesRaces/FieEnemiesHoovesRaces.cs new file mode 100644 index 0000000..f3111d4 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieEnemiesHoovesRaces.cs @@ -0,0 +1,73 @@ +using Spine; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces +{ + public abstract class FieEnemiesHoovesRaces : FieObjectEnemies + { + [SerializeField] + private Transform _torsoTransform; + + [SerializeField] + private Transform _leftFrontHoofTransform; + + [SerializeField] + private Transform _rightFrontHoofTransform; + + [SerializeField] + private Transform _leftBackHoofTransform; + + [SerializeField] + private Transform _rightBackHoofTransform; + + [SerializeField] + private Transform _hornTransform; + + [SerializeField] + private Transform _mouthTransform; + + public Transform torsoTransform => _torsoTransform; + + public Transform leftFrontHoofTransform => _leftFrontHoofTransform; + + public Transform rightFrontHoofTransform => _rightFrontHoofTransform; + + public Transform leftBackHoofTransform => _leftBackHoofTransform; + + public Transform rightBackHoofTransform => _rightBackHoofTransform; + + public Transform hornTransform => _hornTransform; + + public Transform mouthTransform => _mouthTransform; + + public new void Awake() + { + base.Awake(); + base.damageSystem.staggerEvent += delegate + { + setStateToStatheMachine(typeof(FieStateMachineEnemiesHoovesRacesStagger), isForceSet: true, isDupulicate: true); + }; + base.gameObject.SetActive(value: true); + } + + protected new void Start() + { + base.Start(); + base.animationManager.commonAnimationEvent += AnimationManager_commonAnimationEvent; + } + + private void AnimationManager_commonAnimationEvent(TrackEntry entry) + { + if (entry != null) + { + entry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "footstep" && base.currentFootstepMaterial != null) + { + base.currentFootstepMaterial.playFootstepAudio(base.footstepPlayer); + } + }; + } + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesMove.cs b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesMove.cs new file mode 100644 index 0000000..1491c2b --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesMove.cs @@ -0,0 +1,92 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces +{ + public class FieStateMachineEnemiesHoovesRacesMove : FieStateMachineGameCharacterBase + { + private const float MOVE_THRESHOLD = 0.02f; + + private const float WALK_FORCE_THRESHOLD = 0.3f; + + private const float WALK_MOVESPEED_MAGNI = 0.5f; + + private bool _isEnd; + + private Type _nextState; + + private float _physicalSinWave; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + Vector3 externalInputVector = gameCharacter.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + externalInputVector.y = 0f; + float externalInputForce = gameCharacter.externalInputForce; + Vector3 velocity = gameCharacter.GetComponent().velocity; + float num = Math.Abs(velocity.x); + float num2 = num / 5f; + float num3 = gameCharacter.getDefaultMoveSpeed(); + _physicalSinWave += 10f * Time.deltaTime; + if (num2 <= 0.02f) + { + _physicalSinWave = 0f; + } + else if (num2 <= 0.3f) + { + float timescale = Mathf.Min(Mathf.Max(num2 / 0.1f, 0.25f), 1.5f); + gameCharacter.animationManager.SetAnimation(1, isLoop: true); + gameCharacter.animationManager.SetAnimationTimescale(1, timescale); + if (externalInputForce < 0.6f) + { + num3 *= 0.5f; + } + } + else + { + float timescale2 = Mathf.Min(Mathf.Max(num2, 1f) / 0.5f, 1f); + gameCharacter.animationManager.SetAnimation(2, isLoop: true); + gameCharacter.animationManager.SetAnimationTimescale(2, timescale2); + } + gameCharacter.addMoveForce(externalInputVector * (num3 * gameCharacter.externalInputForce), 0.4f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesRift.cs b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesRift.cs new file mode 100644 index 0000000..f1a4f46 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesRift.cs @@ -0,0 +1,125 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces +{ + public class FieStateMachineEnemiesHoovesRacesRift : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private float _riftForceRate = 1f; + + private bool _resetMoveForce; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + _staggerState = StaggerState.STATE_STAGGER; + break; + case StaggerState.STATE_STAGGER: + { + int num = 3; + _nextState = typeof(FieStateMachineEnemiesHoovesRacesStaggerFall); + fieEnemiesHoovesRaces.isEnableGravity = false; + fieEnemiesHoovesRaces.isEnableGravity = true; + gameCharacter.setGravityRate(0.15f); + if (_resetMoveForce) + { + fieEnemiesHoovesRaces.resetMoveForce(); + } + fieEnemiesHoovesRaces.setMoveForce(Vector3.up * 8f * _riftForceRate, 1f, useRound: false); + num = 4; + TrackEntry trackEntry = fieEnemiesHoovesRaces.animationManager.SetAnimation(num, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.setGravityRate(1f); + fieEnemiesHoovesRaces.isEnableAutoFlip = true; + fieEnemiesHoovesRaces.isEnableGravity = true; + } + } + + public void SetRiftForceRate(float forceRate) + { + _riftForceRate = forceRate; + } + + public void ResetMoveForce(bool resetMoveForce) + { + _resetMoveForce = resetMoveForce; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineEnemiesHoovesRacesStagger)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStagger.cs b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStagger.cs new file mode 100644 index 0000000..e4e6306 --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStagger.cs @@ -0,0 +1,107 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies.HoovesRaces +{ + public class FieStateMachineEnemiesHoovesRacesStagger : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (_staggerState == StaggerState.STATE_PREPARE) + { + int animationId = 3; + if (fieEnemiesHoovesRaces.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineEnemiesHoovesRacesStaggerFall); + fieEnemiesHoovesRaces.isEnableGravity = false; + fieEnemiesHoovesRaces.isEnableGravity = true; + gameCharacter.setGravityRate(0.2f); + Vector3 vector = Vector3.Normalize(fieEnemiesHoovesRaces.centerTransform.position - fieEnemiesHoovesRaces.latestDamageWorldPoint); + vector.y *= 0.1f; + vector.z = 0f; + vector.Normalize(); + fieEnemiesHoovesRaces.setFlipByVector(vector * -1f); + fieEnemiesHoovesRaces.setMoveForce((Vector3.up + vector).normalized * 8f, 1f, useRound: false); + animationId = 4; + } + TrackEntry trackEntry = fieEnemiesHoovesRaces.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.setGravityRate(1f); + fieEnemiesHoovesRaces.isEnableAutoFlip = true; + fieEnemiesHoovesRaces.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineEnemiesHoovesRacesStagger)); + return list; + } + } +} diff --git a/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStaggerFall.cs b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStaggerFall.cs new file mode 100644 index 0000000..c359d8d --- /dev/null +++ b/src/Fie.Enemies.HoovesRaces/FieStateMachineEnemiesHoovesRacesStaggerFall.cs @@ -0,0 +1,99 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies.HoovesRaces +{ + public class FieStateMachineEnemiesHoovesRacesStaggerFall : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private List _allowedStateList = new List(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieEnemiesHoovesRaces) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + { + int animationId = 5; + TrackEntry trackEntry2 = fieEnemiesHoovesRaces.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + trackEntry2.mixDuration = 0f; + _staggerState = StaggerState.STATE_STAGGER; + break; + } + case StaggerState.STATE_STAGGER: + if (fieEnemiesHoovesRaces.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = fieEnemiesHoovesRaces.animationManager.SetAnimation(6, isLoop: false, isForceSet: true); + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + _staggerState = StaggerState.STATE_STAGGER_END; + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.isEnableGravity = true; + fieEnemiesHoovesRaces.setGravityRate(0.5f); + fieEnemiesHoovesRaces.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieEnemiesHoovesRaces fieEnemiesHoovesRaces = gameCharacter as FieEnemiesHoovesRaces; + if (!(fieEnemiesHoovesRaces == null)) + { + fieEnemiesHoovesRaces.setGravityRate(1f); + fieEnemiesHoovesRaces.isEnableAutoFlip = true; + fieEnemiesHoovesRaces.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return _allowedStateList; + } + } +} diff --git a/src/Fie.Enemies/FieEnemiesAnimationContainer.cs b/src/Fie.Enemies/FieEnemiesAnimationContainer.cs new file mode 100644 index 0000000..e57ff28 --- /dev/null +++ b/src/Fie.Enemies/FieEnemiesAnimationContainer.cs @@ -0,0 +1,12 @@ +using Fie.Object; + +namespace Fie.Enemies +{ + public class FieEnemiesAnimationContainer : FieAnimationContainerBase + { + public FieEnemiesAnimationContainer() + { + addAnimationData(0, new FieSkeletonAnimationObject(0, "idle")); + } + } +} diff --git a/src/Fie.Enemies/FieEnemiesHoovesRacesAnimationContainer.cs b/src/Fie.Enemies/FieEnemiesHoovesRacesAnimationContainer.cs new file mode 100644 index 0000000..338562b --- /dev/null +++ b/src/Fie.Enemies/FieEnemiesHoovesRacesAnimationContainer.cs @@ -0,0 +1,36 @@ +using Fie.Object; + +namespace Fie.Enemies +{ + public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer + { + public enum HoovesRacesAnimTrack + { + HORN = 2, + MAX_HOOVES_RACES_TRACK + } + + public enum HoovesRacesAnimList + { + WALK = 1, + GALLOP, + STAGGER, + STAGGER_AIR, + STAGGER_FALL, + STAGGER_FALL_RECOVER, + DEAD, + MAX_HOOVES_RACES_ANIMATION + } + + public FieEnemiesHoovesRacesAnimationContainer() + { + addAnimationData(1, new FieSkeletonAnimationObject(0, "walk")); + addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop")); + addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger")); + addAnimationData(4, new FieSkeletonAnimationObject(0, "stagger_air")); + addAnimationData(5, new FieSkeletonAnimationObject(0, "stagger_fall")); + addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger_fall_recover")); + addAnimationData(7, new FieSkeletonAnimationObject(0, "dead")); + } + } +} diff --git a/src/Fie.Enemies/FieObjectEnemies.cs b/src/Fie.Enemies/FieObjectEnemies.cs new file mode 100644 index 0000000..cec309a --- /dev/null +++ b/src/Fie.Enemies/FieObjectEnemies.cs @@ -0,0 +1,217 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Scene; +using Fie.Utility; +using GameDataEditor; +using HighlightingSystem; +using Spine.Unity; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Enemies +{ + [RequireComponent(typeof(SkeletonUtility))] + public abstract class FieObjectEnemies : FieGameCharacter + { + public const float SCORE_BONUS_RATE_FOR_DEFEAT = 0.25f; + + public const float SCORE_BONUS_RATE_FOR_ASSIT_PER_PLAYER = 0.1f; + + public const float SCORE_MINIMUM_GUARANTEED = 0.1f; + + private static Color HighlightStartColor = new Color(1f, 0f, 0f, 0.5f); + + private static Color HighlightEndColor = new Color(1f, 0f, 0f, 0f); + + private static Color HighlightStartColorNonTargetting = new Color(0.95f, 0.5f, 0f, 0.5f); + + private static Color HighlightEndColorNonTargetting = new Color(0.95f, 0.5f, 0f, 0f); + + private const float HighlightFlashCountPerSec = 0.5f; + + [SerializeField] + private FieAttribute _shieldType; + + private Highlighter _highlighter; + + private bool _isEnableHighLight; + + public bool isEnableHighLight + { + get + { + return _isEnableHighLight; + } + set + { + if (value != _isEnableHighLight) + { + SwitchHighLighter(value); + } + _isEnableHighLight = value; + } + } + + public void setHighLightColorByTargetStatus(FieGameCharacter gameCharacter) + { + if (base.detector.isTargetting(gameCharacter)) + { + _highlighter.FlashingParams(HighlightStartColor, HighlightEndColor, 0.5f); + } + else + { + _highlighter.FlashingParams(HighlightStartColorNonTargetting, HighlightEndColorNonTargetting, 0.5f); + } + } + + private void SwitchHighLighter(bool isEnable) + { + if (!(_highlighter == null)) + { + if (isEnable) + { + _highlighter.enabled = true; + _highlighter.FlashingOn(); + _highlighter.SeeThroughOn(); + } + else + { + _highlighter.enabled = false; + _highlighter.FlashingOff(); + } + } + } + + private void InitializeHighlighter() + { + if (!(_highlighter == null)) + { + _highlighter.enabled = false; + _isEnableHighLight = false; + } + } + + protected override void Awake() + { + base.Awake(); + healthStats.shieldType = _shieldType; + base.damageSystem.isEnableHitPointGate = false; + base.damageSystem.isEnableShieldGate = false; + base.damageSystem.dyingNeedSec = 0f; + _highlighter = base.submeshObject.gameObject.AddComponent(); + if (_highlighter != null) + { + InitializeHighlighter(); + } + base.damageSystem.deathEvent += FieEnemiesDeathEventCallback; + FieManagerBehaviour.I.AssignCharacter(FieInGameCharacterStatusManager.ForcesTag.ENEMY, this); + } + + private void FieEnemiesDeathEventCallback(FieGameCharacter killer, FieDamage damage) + { + if (!(killer == null) && damage != null) + { + FieGameCharacter usersCharacter = FieManagerBehaviour.I.GetUserData(FieManagerBehaviour.I.myPlayerNumber).usersCharacter; + if (killer.GetInstanceID() != usersCharacter.GetInstanceID() && FieRandom.Range(0, 100) >= 50) + { + usersCharacter.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ALLY_DEFEAT_ENEMY)); + } + else + { + killer.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_DEFEAT_ENEMY)); + } + FieManagerBehaviour.I.DissociateCharacter(FieInGameCharacterStatusManager.ForcesTag.ENEMY, this); + if (base.photonView.isMine) + { + DeployScoresToDefeaters(killer, base.damageSystem); + } + } + } + + private void DeployScoresToDefeaters(FieGameCharacter killer, FieDamageSystem damageSystem) + { + if (!(base.photonView == null) && base.photonView.isMine && !(damageSystem == null) && damageSystem.takenDamage != null && damageSystem.takenDamage.Count > 0) + { + float num = 0f; + float num2 = 0f; + foreach (KeyValuePair item in damageSystem.takenDamage) + { + if (item.Key != killer) + { + num += 0.1f; + } + num2 += item.Value; + } + if (!(num2 <= 0f)) + { + foreach (KeyValuePair item2 in damageSystem.takenDamage) + { + int exp = GetEnemyMasterData().Exp; + bool isDefeater = false; + float num3 = item2.Value / num2; + if (item2.Key == killer) + { + num3 += 0.35f; + isDefeater = true; + } + else + { + num3 += num + 0.1f; + } + exp = Mathf.FloorToInt((float)exp * FieManagerBehaviour.I.currentDifficultyData.expMagnify); + exp = Mathf.FloorToInt((float)exp * base.expRate); + int score = Mathf.FloorToInt((float)exp * num3); + item2.Key.ReduceOrIncreaseScore(score, isDefeater); + } + } + } + } + + protected override void Start() + { + base.Start(); + if (FieManagerFactory.I.currentSceneType == FieSceneType.INGAME) + { + FieManagerBehaviour.I.RetryEvent += RetryEvent; + } + } + + private void RetryEvent() + { + if (PhotonNetwork.isMasterClient && this != null) + { + PhotonNetwork.Destroy(base.photonView); + } + } + + protected override void Update() + { + base.Update(); + } + + public override void RequestToChangeState(Vector3 directionalVec, float force, StateMachineType type) + { + getStateMachine(type).setState(typeof(T), isForceSet: false); + if (type == StateMachineType.Base) + { + base.externalInputVector = directionalVec; + base.externalInputForce = force; + } + } + + public override FieStateMachineInterface getDefaultState(StateMachineType type) + { + if (type == StateMachineType.Base) + { + return new FieStateMachineCommonIdle(); + } + return new FieStateMachineEnemiesAttackIdle(); + } + + public abstract void RequestArrivalState(); + + public abstract GDEEnemyTableData GetEnemyMasterData(); + + public abstract FieConstValues.FieEnemy GetEnemyMasterDataID(); + } +} diff --git a/src/Fie.Enemies/FieStateMachineEnemiesAttackIdle.cs b/src/Fie.Enemies/FieStateMachineEnemiesAttackIdle.cs new file mode 100644 index 0000000..6534970 --- /dev/null +++ b/src/Fie.Enemies/FieStateMachineEnemiesAttackIdle.cs @@ -0,0 +1,28 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Enemies +{ + public class FieStateMachineEnemiesAttackIdle : FieStateMachineGameCharacterBase + { + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return null; + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Fader/FieFader.cs b/src/Fie.Fader/FieFader.cs new file mode 100644 index 0000000..afbabc6 --- /dev/null +++ b/src/Fie.Fader/FieFader.cs @@ -0,0 +1,64 @@ +using Fie.Utility; +using Spine.Unity; +using UnityEngine; +using UnityEngine.UI; + +namespace Fie.Fader +{ + public class FieFader : MonoBehaviour + { + [SerializeField] + private GameObject faderCameraRootObject; + + [SerializeField] + private Image faderPlaneObject; + + [SerializeField] + private SkeletonGraphic _loadingIcon; + + private Tweener faderTweener = new Tweener(); + + private bool isDrawFader; + + public void Initialize() + { + faderCameraRootObject.transform.gameObject.SetActive(value: false); + } + + public void HideFader() + { + isDrawFader = false; + faderCameraRootObject.transform.gameObject.SetActive(value: false); + } + + public void InitFader(Vector4 startColor, Vector4 endColor, float time) + { + isDrawFader = true; + faderTweener.InitTweener(time, startColor, endColor); + faderCameraRootObject.transform.gameObject.SetActive(value: true); + } + + public bool IsEndUpdateFader() + { + return faderTweener == null || faderTweener.IsEnd(); + } + + private void Update() + { + if (isDrawFader) + { + Color color = faderTweener.UpdateParameterVec4(Time.deltaTime); + faderPlaneObject.color = color; + _loadingIcon.color = new Color(1f, 1f, 1f, color.a); + } + } + + public void ShowLoadScreen() + { + } + + public void HideLoadScreen() + { + } + } +} diff --git a/src/Fie.Fader/FieFaderElementDecsenter.cs b/src/Fie.Fader/FieFaderElementDecsenter.cs new file mode 100644 index 0000000..2f4ad0a --- /dev/null +++ b/src/Fie.Fader/FieFaderElementDecsenter.cs @@ -0,0 +1,33 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.Fader +{ + internal class FieFaderElementDecsenter : MonoBehaviour + { + public Vector3 moving = Vector3.zero; + + public float movingCycleSec = 1f; + + private bool isRepeat; + + private Vector3 currentPosition = Vector3.zero; + + private Tweener positionTweener = new Tweener(); + + private void Start() + { + currentPosition = base.transform.position; + } + + private void Update() + { + if (positionTweener.IsEnd()) + { + positionTweener.InitTweener(movingCycleSec, (!isRepeat) ? moving : (moving * -1f), (!isRepeat) ? (moving * -1f) : moving); + isRepeat = !isRepeat; + } + base.transform.position = currentPosition + positionTweener.UpdateParameterVec3(Time.deltaTime); + } + } +} diff --git a/src/Fie.Footstep/FieFootstepMaterial.cs b/src/Fie.Footstep/FieFootstepMaterial.cs new file mode 100644 index 0000000..18a94ff --- /dev/null +++ b/src/Fie.Footstep/FieFootstepMaterial.cs @@ -0,0 +1,45 @@ +using Fie.Utility; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Footstep +{ + public class FieFootstepMaterial : MonoBehaviour + { + [SerializeField] + private float _audioVolume = 0.5f; + + [SerializeField] + private List _audioClips = new List(); + + [SerializeField] + private Material _footStepParticleMaterial; + + private Lottery _lottery = new Lottery(); + + public List audioClips => _audioClips; + + private void Awake() + { + foreach (AudioClip audioClip in _audioClips) + { + _lottery.AddItem(audioClip); + } + } + + public void playFootstepAudio(FieFootstepPlayer player) + { + if (!(player == null) && _lottery.IsExecutable()) + { + AudioClip audioClip = _lottery.Lot(); + if (!(audioClip == null)) + { + player.SetMaterial(_footStepParticleMaterial); + player.audioSource.pitch = player.pitchOffset; + player.audioSource.PlayOneShot(audioClip, _audioVolume); + player.EmitFootstepParticle(audioClip.length); + } + } + } + } +} diff --git a/src/Fie.Footstep/FieFootstepPlayer.cs b/src/Fie.Footstep/FieFootstepPlayer.cs new file mode 100644 index 0000000..d017a42 --- /dev/null +++ b/src/Fie.Footstep/FieFootstepPlayer.cs @@ -0,0 +1,57 @@ +using ParticlePlayground; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Fie.Footstep +{ + public class FieFootstepPlayer : MonoBehaviour + { + [SerializeField] + private AudioSource _audioSource; + + [SerializeField] + private PlaygroundParticlesC _particle; + + [SerializeField] + private float _pitchOffset = 1f; + + private float _particleDuration; + + public AudioSource audioSource => _audioSource; + + public float pitchOffset => _pitchOffset; + + public void EmitFootstepParticle(float duration) + { + _particleDuration = duration; + } + + public void SetMaterial(Material material) + { + _particle.particleSystemRenderer.material = material; + } + + private void Update() + { + bool flag = _particleDuration > 0f; + _particle.emit = flag; + if (flag) + { + _particleDuration -= Time.deltaTime; + } + } + + private void Awake() + { + SceneManager.sceneLoaded += SceneManager_sceneLoaded; + } + + private void SceneManager_sceneLoaded(UnityEngine.SceneManagement.Scene arg0, LoadSceneMode arg1) + { + if ((bool)_particle) + { + _particle.Start(); + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectGlowEyes.cs b/src/Fie.LevelObject/FieLevelObjectGlowEyes.cs new file mode 100644 index 0000000..644cc45 --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectGlowEyes.cs @@ -0,0 +1,55 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectGlowEyes : MonoBehaviour + { + [SerializeField] + private float _rotatingDuration = 0.5f; + + [SerializeField] + private float _rotatebleAngleZ = 15f; + + [SerializeField] + private float _rotatebleAngleY = 30f; + + [SerializeField] + private Vector2 _changingAngleIntervalMinMax = new Vector2(0.75f, 5f); + + private Tweener _tweener = new Tweener(); + + private Quaternion _currentTargetRotation; + + private Quaternion _oldRotation; + + private float _rotationCounter; + + private void Start() + { + SetNextParameter(); + } + + private void SetNextParameter() + { + _tweener.InitTweener(_rotatingDuration, 0f, 1f); + _rotationCounter = Random.Range(_changingAngleIntervalMinMax.x, _changingAngleIntervalMinMax.y); + _currentTargetRotation = Quaternion.Euler(new Vector3(0f, Random.Range(0f - _rotatebleAngleY, _rotatebleAngleY), Random.Range(0f - _rotatebleAngleZ, _rotatebleAngleZ))); + _oldRotation = base.transform.rotation; + } + + private void Update() + { + if (!_tweener.IsEnd()) + { + float t = _tweener.UpdateParameterFloat(Time.deltaTime); + base.transform.rotation = Quaternion.Lerp(_oldRotation, _currentTargetRotation, t); + } + _rotationCounter -= Time.deltaTime; + if (_rotationCounter <= 0f) + { + SetNextParameter(); + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectGlowInsect.cs b/src/Fie.LevelObject/FieLevelObjectGlowInsect.cs new file mode 100644 index 0000000..674618d --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectGlowInsect.cs @@ -0,0 +1,83 @@ +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectGlowInsect : MonoBehaviour + { + private enum PathCalcType + { + Increase = 1, + Decrease = -1 + } + + [SerializeField] + private FieLevelObjectTracePath _parentPath; + + [SerializeField] + private int _startPathIndex; + + [SerializeField] + private float _moveSpeedPerSec = 1f; + + [SerializeField] + private float _wiggleLoopPerSec = 0.5f; + + [SerializeField] + private float _wiggleForceLoopPerSec = 0.25f; + + [SerializeField] + private float _wiggleForce = 0.25f; + + [SerializeField] + private float _changePathPointBoundingSize = 0.5f; + + [SerializeField] + private PathCalcType _calcType = PathCalcType.Increase; + + private int _currentPathIndex; + + private int _nextPathIndex; + + private float _wiggleAngle; + + private float _wiggleForceSinWave; + + private void Start() + { + if (_parentPath.pathObject != null && _parentPath.pathObject.Count > 0) + { + _currentPathIndex = Mathf.Clamp(_startPathIndex, 0, _parentPath.pathObject.Count - 1); + base.transform.position = _parentPath.pathObject[_currentPathIndex].transform.position; + _nextPathIndex = getNextPathPoint(_currentPathIndex, (int)_calcType); + } + } + + private int getNextPathPoint(int currentIndex, int incrementCount = 1) + { + return Mathf.RoundToInt(Mathf.Repeat((float)(currentIndex + incrementCount), (float)(_parentPath.pathObject.Count - 1))); + } + + private void Update() + { + if (_parentPath.pathObject != null && _parentPath.pathObject.Count > 0) + { + if (Vector3.Distance(base.transform.position, _parentPath.pathObject[_nextPathIndex].transform.position) <= _changePathPointBoundingSize) + { + _currentPathIndex = _nextPathIndex; + _nextPathIndex = getNextPathPoint(_currentPathIndex, (int)_calcType); + } + Vector3 vector = _parentPath.pathObject[_nextPathIndex].transform.position - base.transform.position; + vector.Normalize(); + Vector3 a = base.transform.position + vector; + a += Quaternion.AngleAxis(_wiggleAngle, vector) * Vector3.up; + Vector3 b = (a - base.transform.position).normalized * Mathf.Sin(_wiggleForceSinWave); + vector = Vector3.Lerp(vector, b, _wiggleForce); + base.transform.position += vector * _moveSpeedPerSec * Time.deltaTime; + _wiggleForceSinWave += 90f * _wiggleForceLoopPerSec * Time.deltaTime; + _wiggleAngle += 360f * _wiggleLoopPerSec * Time.deltaTime; + _wiggleForceSinWave = Mathf.Repeat(_wiggleForceSinWave, 360f); + _wiggleAngle = Mathf.Repeat(_wiggleAngle, 360f); + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectGrass.cs b/src/Fie.LevelObject/FieLevelObjectGrass.cs new file mode 100644 index 0000000..fe07025 --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectGrass.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectGrass : MonoBehaviour + { + public const string GRASS_DENSITY_NAME = "_MaxTessellation"; + + private void Awake() + { + switch (QualitySettings.GetQualityLevel()) + { + case 3: + break; + default: + UnityEngine.Object.Destroy(base.gameObject); + break; + case 2: + { + float float2 = GetComponent().material.GetFloat("_MaxTessellation"); + GetComponent().material.SetFloat("_MaxTessellation", float2 - 1f); + break; + } + case 4: + { + float @float = GetComponent().material.GetFloat("_MaxTessellation"); + GetComponent().material.SetFloat("_MaxTessellation", @float + 1f); + break; + } + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectInfiniGrass.cs b/src/Fie.LevelObject/FieLevelObjectInfiniGrass.cs new file mode 100644 index 0000000..35966aa --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectInfiniGrass.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectInfiniGrass : MonoBehaviour + { + private void Awake() + { + switch (QualitySettings.GetQualityLevel()) + { + case 1: + case 2: + case 3: + case 4: + break; + default: + UnityEngine.Object.Destroy(base.gameObject); + break; + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectOpeningCinematic.cs b/src/Fie.LevelObject/FieLevelObjectOpeningCinematic.cs new file mode 100644 index 0000000..7618543 --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectOpeningCinematic.cs @@ -0,0 +1,142 @@ +using CinemaDirector; +using Fie.Camera; +using Fie.Manager; +using Photon; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectOpeningCinematic : Photon.MonoBehaviour + { + [SerializeField] + private float _firstTimeDelay = 0.5f; + + [SerializeField] + private Cutscene _cutscene; + + [SerializeField] + private ActorTrackGroup _cameraActor; + + [SerializeField] + private List _cinematicObjects = new List(); + + [SerializeField] + private FieWaveController _thenTriggerWave; + + private bool _isStarted; + + private bool _isFinished; + + private float _delay; + + private void Awake() + { + _delay = _firstTimeDelay; + _cutscene.CutsceneFinished += _cutscene_CutsceneFinished; + FieManagerBehaviour.I.RetryEvent += RetryEvent; + } + + private void RetryEvent() + { + _isStarted = false; + _isFinished = false; + if (_cinematicObjects != null && _cinematicObjects.Count > 0) + { + foreach (GameObject cinematicObject in _cinematicObjects) + { + cinematicObject.SetActive(value: true); + } + } + _delay = _firstTimeDelay; + } + + public void Reset() + { + _isStarted = false; + _isFinished = false; + } + + private void _cutscene_CutsceneFinished(object sender, CutsceneEventArgs e) + { + if (_cinematicObjects != null && _cinematicObjects.Count > 0) + { + foreach (GameObject cinematicObject in _cinematicObjects) + { + cinematicObject.SetActive(value: false); + } + } + FieManagerBehaviour.I.gameCamera.GetComponent().enabled = true; + FieManagerBehaviour.I.gameCamera.camera.cullingMask &= -524289; + FieManagerBehaviour.I.gameCamera.camera.cullingMask |= 256; + FieManagerBehaviour.I.ShowHeaderFooter(); + FieManagerBehaviour.I.isEnableControll = true; + if (_thenTriggerWave != null) + { + _thenTriggerWave._isEnable = true; + } + _isFinished = true; + } + + private void Update() + { + if (_delay > 0f) + { + _delay -= Time.deltaTime; + } + if (!_isFinished && _cutscene.State == Cutscene.CutsceneState.Playing && FieManagerBehaviour.I.GetPlayer().GetButton("Menu") && (PhotonNetwork.isMasterClient || PhotonNetwork.offlineMode)) + { + _cutscene.Skip(); + base.photonView.RPC("SkipCinemacitRPC", PhotonTargets.Others, null); + } + } + + [PunRPC] + public void SkipCinemacitRPC() + { + _cutscene.Skip(); + } + + [PunRPC] + public void StartCinemacitRPC() + { + StartCinematic(); + } + + private void OnTriggerEnter(Collider collider) + { + if (!(_delay > 0f) && !_isStarted) + { + FieCollider component = collider.gameObject.GetComponent(); + if (component != null && component.getParentGameCharacter() != null && collider.gameObject.tag == "Player") + { + base.photonView.RPC("StartCinemacitRPC", PhotonTargets.All, null); + StartCinematic(); + } + } + } + + private void StartCinematic() + { + if (!_isStarted) + { + if (_cinematicObjects != null && _cinematicObjects.Count > 0) + { + foreach (GameObject cinematicObject in _cinematicObjects) + { + cinematicObject.SetActive(value: true); + } + } + _cameraActor.Actor = FieManagerBehaviour.I.gameCamera.transform; + FieManagerBehaviour.I.gameCamera.camera.cullingMask |= 524288; + FieManagerBehaviour.I.gameCamera.camera.cullingMask &= -257; + FieManagerBehaviour.I.gameCamera.GetComponent().enabled = false; + FieManagerBehaviour.I.HideHeaderFooter(); + _cutscene.Refresh(); + _cutscene.Play(); + FieManagerBehaviour.I.isEnableControll = false; + _isStarted = true; + } + } + } +} diff --git a/src/Fie.LevelObject/FieLevelObjectTracePath.cs b/src/Fie.LevelObject/FieLevelObjectTracePath.cs new file mode 100644 index 0000000..bff0a00 --- /dev/null +++ b/src/Fie.LevelObject/FieLevelObjectTracePath.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.LevelObject +{ + public class FieLevelObjectTracePath : MonoBehaviour + { + [SerializeField] + private List _pathPoints; + + public List pathObject => _pathPoints; + } +} diff --git a/src/Fie.Manager/FieActivityManager.cs b/src/Fie.Manager/FieActivityManager.cs new file mode 100644 index 0000000..e89e8b1 --- /dev/null +++ b/src/Fie.Manager/FieActivityManager.cs @@ -0,0 +1,136 @@ +using GameDataEditor; +using System.Collections; +using UnityEngine; + +namespace Fie.Manager +{ + public class FieActivityManager : FieManagerBehaviour + { + public delegate void FieActivityManagerActivityChangedCallback(GDEConstantTextListData titleTextData, GDEConstantTextListData noteTextData, string titleString = "", string noteString = ""); + + public const float DEFAULT_ACTIVITY_SHOWING_TIME = 10f; + + private FieAcvitityQueue _currentActivity; + + private IEnumerator _execQueuesCoroutine; + + private string _replaceFromString = string.Empty; + + private string _replaceToString = string.Empty; + + public event FieActivityManagerActivityChangedCallback activityStartEvent; + + public event FieActivityManagerActivityChangedCallback activityEndEvent; + + private IEnumerator WatchQueuesCoroutine() + { + float timeCounter = 0f; + if (this.activityStartEvent != null) + { + if (_currentActivity != null) + { + if (_replaceFromString != string.Empty) + { + string constantText = FieLocalizeUtility.GetConstantText(_currentActivity.titleTextData.Key); + string constantText2 = FieLocalizeUtility.GetConstantText(_currentActivity.noteTextData.Key); + constantText = constantText.Replace(_replaceFromString, _replaceToString); + constantText2 = constantText2.Replace(_replaceFromString, _replaceToString); + this.activityStartEvent(_currentActivity.titleTextData, _currentActivity.noteTextData, constantText, constantText2); + _replaceFromString = string.Empty; + _replaceToString = string.Empty; + } + else + { + this.activityStartEvent(_currentActivity.titleTextData, _currentActivity.noteTextData, string.Empty, string.Empty); + } + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + else + { + if (FieManagerBehaviour.I.GetActivityWindowState() != 0) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + if (_currentActivity != null) + { + if (timeCounter <= _currentActivity.showingTime) + { + if (_currentActivity != null) + { + float num = timeCounter + Time.deltaTime; + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + else + { + if (this.activityEndEvent != null) + { + if (_currentActivity == null) + { + yield break; + } + this.activityEndEvent(_currentActivity.titleTextData, _currentActivity.noteTextData, string.Empty, string.Empty); + } + _currentActivity = null; + } + } + } + } + + public bool IsShowingAnyActivity() + { + return _currentActivity != null; + } + + public void RequestLobbyOnlyActivity(FieGameCharacter gameCharacter, GDEConstantTextListData title, GDEConstantTextListData note, float showingTime = 10f) + { + if (FieManagerBehaviour.I.isLobby() && !(FieManagerBehaviour.I.gameOwnerCharacter == null) && gameCharacter.GetInstanceID() == FieManagerBehaviour.I.gameOwnerCharacter.GetInstanceID()) + { + RequestActivity(title, note, showingTime); + } + } + + public void RequestGameOwnerOnlyActivity(FieGameCharacter gameCharacter, GDEConstantTextListData title, GDEConstantTextListData note, float showingTime = 10f) + { + if (!(FieManagerBehaviour.I.gameOwnerCharacter == null) && gameCharacter.GetInstanceID() == FieManagerBehaviour.I.gameOwnerCharacter.GetInstanceID()) + { + RequestActivity(title, note, showingTime); + } + } + + public void RequestActivity(GDEConstantTextListData title, GDEConstantTextListData note, float showingTime = 10f, bool forcePush = false, bool flushQueue = false) + { + if (_execQueuesCoroutine != null) + { + StopCoroutine(_execQueuesCoroutine); + _currentActivity = null; + } + _currentActivity = new FieAcvitityQueue(showingTime, title, note); + _execQueuesCoroutine = WatchQueuesCoroutine(); + StartCoroutine(_execQueuesCoroutine); + } + + public void RequestToHideActivity() + { + if (_execQueuesCoroutine != null) + { + StopCoroutine(_execQueuesCoroutine); + _currentActivity = null; + } + if (this.activityEndEvent != null) + { + this.activityEndEvent(null, null, string.Empty, string.Empty); + } + } + + public void RegistReplaceString(string fromString, string toString) + { + _replaceFromString = fromString; + _replaceToString = toString; + } + } +} diff --git a/src/Fie.Manager/FieAcvitityQueue.cs b/src/Fie.Manager/FieAcvitityQueue.cs new file mode 100644 index 0000000..d37a3d4 --- /dev/null +++ b/src/Fie.Manager/FieAcvitityQueue.cs @@ -0,0 +1,20 @@ +using GameDataEditor; + +namespace Fie.Manager +{ + public class FieAcvitityQueue + { + public float showingTime; + + public GDEConstantTextListData titleTextData; + + public GDEConstantTextListData noteTextData; + + public FieAcvitityQueue(float showingTime, GDEConstantTextListData titleTextData, GDEConstantTextListData noteTextData) + { + this.showingTime = showingTime; + this.titleTextData = titleTextData; + this.noteTextData = noteTextData; + } + } +} diff --git a/src/Fie.Manager/FieAudioManager.cs b/src/Fie.Manager/FieAudioManager.cs new file mode 100644 index 0000000..a6457e3 --- /dev/null +++ b/src/Fie.Manager/FieAudioManager.cs @@ -0,0 +1,88 @@ +using Fie.Utility; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Audio; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieAudioManager : FieManagerBehaviour + { + public enum FieAudioMixerType + { + BGM, + SE, + Voice + } + + public const float AUDIO_VOLUME_MIN = -50f; + + public const float AUDIO_VOLUME_MAX = 0f; + + public const float AUDIO_VOLUME_LITTLE_BIT_SMALL = -1f; + + private const string MIXER_VOLUME_PROPERTY_NAME = "MasterVolume"; + + private const string BGM_MIXER_PATH = "AudioMixer/BGM"; + + private const string SE_MIXER_PATH = "AudioMixer/SE"; + + private const string VOICE_MIXER_PATH = "AudioMixer/Voice"; + + private Dictionary _currentVolume = new Dictionary(); + + private Dictionary _audioMixers = new Dictionary(); + + public Dictionary audioMixers => _audioMixers; + + private IEnumerator ChangeVolumeTask(float volume, float time, FieAudioMixerType type) + { + if (_currentVolume.ContainsKey(type) && _audioMixers.ContainsKey(type)) + { + Tweener volumeTweener = new Tweener(); + volumeTweener.InitTweener(time, _currentVolume[type], volume); + if (!volumeTweener.IsEnd()) + { + _currentVolume[type] = volumeTweener.UpdateParameterFloat(Time.deltaTime); + _audioMixers[type].SetFloat("MasterVolume", _currentVolume[type]); + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + } + + protected override void StartUpEntity() + { + _audioMixers[FieAudioMixerType.BGM] = Resources.Load("AudioMixer/BGM"); + _audioMixers[FieAudioMixerType.SE] = Resources.Load("AudioMixer/SE"); + _audioMixers[FieAudioMixerType.Voice] = Resources.Load("AudioMixer/Voice"); + _currentVolume[FieAudioMixerType.BGM] = 1f; + _currentVolume[FieAudioMixerType.SE] = 1f; + _currentVolume[FieAudioMixerType.Voice] = 1f; + foreach (KeyValuePair audioMixer in _audioMixers) + { + if (audioMixer.Value == null) + { + Debug.LogError("FieAudioManager : Faild to get an AudioMixer object. " + audioMixer.Key.ToString()); + } + else + { + audioMixer.Value.SetFloat("MasterVolume", 1f); + } + } + } + + public void ChangeMixerVolume(float volume, float time, params FieAudioMixerType[] types) + { + volume = Mathf.Clamp(volume, -50f, volume); + if (types.Length > 0) + { + foreach (FieAudioMixerType type in types) + { + StartCoroutine(ChangeVolumeTask(volume, time, type)); + } + } + } + } +} diff --git a/src/Fie.Manager/FieCurrentGameManager.cs b/src/Fie.Manager/FieCurrentGameManager.cs new file mode 100644 index 0000000..6ba3976 --- /dev/null +++ b/src/Fie.Manager/FieCurrentGameManager.cs @@ -0,0 +1,33 @@ +using Fie.User; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.INGAME)] + public class FieCurrentGameManager : FieManagerBehaviour + { + private bool _isBooted; + + public bool isBooted => _isBooted; + + protected override void StartUpEntity() + { + InitializeCurrentGameInfo(); + _isBooted = true; + } + + public void InitializeCurrentGameInfo() + { + FieManagerBehaviour.I.ResetCurrentGameData(); + FieUser[] allUserData = FieManagerBehaviour.I.getAllUserData(); + foreach (FieUser fieUser in allUserData) + { + if (fieUser != null && !(fieUser.usersCharacter == null)) + { + fieUser.usersCharacter.score = 0; + int totalExp = fieUser.usersCharacter.totalExp; + FieManagerBehaviour.I.SnapshotCurrentExp(fieUser.usersCharacter, totalExp); + } + } + } + } +} diff --git a/src/Fie.Manager/FieDialogManager.cs b/src/Fie.Manager/FieDialogManager.cs new file mode 100644 index 0000000..dbaf505 --- /dev/null +++ b/src/Fie.Manager/FieDialogManager.cs @@ -0,0 +1,143 @@ +using Fie.Utility; +using Fie.Voice; +using GameDataEditor; +using System.Collections.Generic; + +namespace Fie.Manager +{ + public class FieDialogManager : FieManagerBehaviour + { + public delegate void FieDialogManagerDialogChangedCallback(FieGameCharacter actor, GDEWordScriptsListData dialogData); + + private Queue> _dialogQueues = new Queue>(); + + private FieGameCharacter _currentActor; + + private GDEWordScriptsListData _currentWordScript; + + public bool _isEnableDialog = true; + + public bool isEnableDialg + { + get + { + return _isEnableDialog; + } + set + { + if (_isEnableDialog != value) + { + if (!isEnableDialg) + { + this.dialogEndEvent(null, null); + } + _isEnableDialog = value; + } + } + } + + public event FieDialogManagerDialogChangedCallback dialogStartEvent; + + public event FieDialogManagerDialogChangedCallback dialogEndEvent; + + public void RequestDialog(FieGameCharacter actor, GDEWordScriptsListData dialogData) + { + if (!(actor == null) && !(actor.voiceController == null) && dialogData != null && actor.isSpeakable && (!(_currentActor != null) || !(_currentActor.voiceController != null) || !_currentActor.voiceController.isPlaying || _currentWordScript == null || dialogData.Trigger.enableStaking || dialogData.Trigger.priority < _currentWordScript.Trigger.priority)) + { + _dialogQueues.Enqueue(new KeyValuePair(dialogData, actor)); + if (_dialogQueues.Count == 1) + { + SetDialogFromQueue(); + } + } + } + + public void RequestDialog(GDEWordScriptTriggerTypeData triggerTypeData, GDEGameCharacterTypeData gameCharacterTypeData = null) + { + if (triggerTypeData != null) + { + List list = FieMasterData.FindMasterDataList(delegate(GDEWordScriptsListData wordScriptData) + { + if (triggerTypeData.Key != wordScriptData.Trigger.Key) + { + return false; + } + if (gameCharacterTypeData != null && gameCharacterTypeData.Key != wordScriptData.Actor.Key) + { + return false; + } + return true; + }); + if (list != null && list.Count > 0) + { + GDEWordScriptsListData gDEWordScriptsListData = null; + Lottery lottery = new Lottery(); + lottery.InitializeFromListData(list); + if (lottery.IsExecutable()) + { + gDEWordScriptsListData = lottery.Lot(); + FieGameCharacter existingGameCharacterRandom = FieManagerBehaviour.I.GetExistingGameCharacterRandom(gDEWordScriptsListData.Actor); + RequestDialog(existingGameCharacterRandom, gDEWordScriptsListData); + } + } + } + } + + private void VoiceController_startEvent(FieVoiceController controller) + { + FieManagerBehaviour.I.ChangeMixerVolume(-1f, 0.2f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.SE); + } + + private void VoiceController_endEvent(FieVoiceController controller) + { + FieManagerBehaviour.I.ChangeMixerVolume(0f, 0.2f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.SE); + if (_currentWordScript != null && _currentWordScript.Next != null) + { + GDEGameCharacterTypeData actor = _currentWordScript.Next.Actor; + if (actor != null) + { + FieGameCharacter existingGameCharacterRandom = FieManagerBehaviour.I.GetExistingGameCharacterRandom(actor); + if (existingGameCharacterRandom != null) + { + RequestDialog(existingGameCharacterRandom, _currentWordScript.Next); + } + } + } + if (this.dialogEndEvent != null) + { + this.dialogEndEvent(_currentActor, _currentWordScript); + } + _currentActor = null; + _currentWordScript = null; + SetDialogFromQueue(); + } + + private void SetDialogFromQueue() + { + if (_dialogQueues.Count > 0) + { + KeyValuePair keyValuePair = _dialogQueues.Dequeue(); + _currentWordScript = keyValuePair.Key; + _currentActor = keyValuePair.Value; + if (_currentActor == null) + { + if (_dialogQueues.Count <= 0) + { + return; + } + SetDialogFromQueue(); + } + if (_isEnableDialog) + { + _currentActor.voiceController.startEvent += VoiceController_startEvent; + _currentActor.voiceController.endEvent += VoiceController_endEvent; + _currentActor.voiceController.Play(_currentWordScript.Key, isForceSet: true); + if (this.dialogStartEvent != null) + { + this.dialogStartEvent(_currentActor, _currentWordScript); + } + } + } + } + } +} diff --git a/src/Fie.Manager/FieEnvironmentManager.cs b/src/Fie.Manager/FieEnvironmentManager.cs new file mode 100644 index 0000000..063ce78 --- /dev/null +++ b/src/Fie.Manager/FieEnvironmentManager.cs @@ -0,0 +1,334 @@ +using Fie.UI; +using GameDataEditor; +using TMPro; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieEnvironmentManager : FieManagerBehaviour + { + public enum Language + { + None = -1, + English, + Japanese, + French, + LANGUAGE_MAX + } + + public enum QualitySettings + { + None = -1, + Fast_and_Cheap, + Good, + Beautiful, + Fantastic, + Ultimate, + QUALITY_SETTINGS_MAX + } + + public enum Difficulty + { + DIFFICULTY_NONE = -1, + EASY, + NORMAL, + HARD, + VERY_HARD, + NIGHTMARE, + CHAOS, + DIFFICULTY_MAX + } + + public enum GameMode + { + ADVENTURE, + SURVIVAL, + GAME_MODE_MAX + } + + public delegate void FieEnviromentChangedCallback(); + + public const string FIE_VERSION_STRING = "v_1_0_211_Prototype(In-House Build)"; + + public const string FIE_APP_ID = "7cae3868-8823-43e8-9729-588152a87571"; + + public const string FIE_MASTER_DATA_FILE_NAME = "MasterData/fie_master_data"; + + private const string DIFFICULTY_SETTING_USERPREF_KEY = "DIFFICULTY"; + + private const string LANGUAGE_SETTING_USERPREF_KEY = "LANGUAGE"; + + public const int DEFAULT_FRAME_RATE = 60; + + public GameMode currentGameMode; + + private GDEDifficultyListData _currentDifficultyData; + + public Language currentLanguage + { + get; + private set; + } + + public TMP_FontAsset englishFont + { + get; + private set; + } + + public TMP_FontAsset currentFont + { + get; + private set; + } + + public float currentFontSizeRate + { + get; + private set; + } + + public int currentFrameRate + { + get; + private set; + } + + public Difficulty currentDifficulty + { + get; + private set; + } + + public GDEDifficultyListData currentDifficultyData => _currentDifficultyData; + + public float currentEnemyDamageMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.enemyDamageMagnify; + } + return 1f; + } + } + + public float currentStaggerRegistMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.enemyStaggerRegsitMagnify; + } + return 1f; + } + } + + public float currentEnemyHealthMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.enemyHealthMagnify; + } + return 1f; + } + } + + public float currentPlayerRegenDelayMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.playerRegenDelayMagnify; + } + return 1f; + } + } + + public float currentFriendshipPointMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.friendshipPointMagnify; + } + return 1f; + } + } + + public float currentExpMagnify + { + get + { + if (currentDifficultyData != null) + { + return currentDifficultyData.expMagnify; + } + return 1f; + } + } + + public event FieEnviromentChangedCallback DifficultyChangedEvent; + + protected override void StartUpEntity() + { + GDEDataManager.Init("MasterData/fie_master_data"); + InitializePrefs(); + InitializeFont(); + if (UnityEngine.QualitySettings.GetQualityLevel() == 0) + { + FieManagerBehaviour.I.CalibrateTimeEnviroment(1f, 30); + } + else + { + FieManagerBehaviour.I.CalibrateTimeEnviroment(); + } + } + + private void InitializePrefs() + { + currentLanguage = (Language)FieManagerBehaviour.I.onMemorySaveData.LanguageCode; + currentDifficulty = Difficulty.NORMAL; + currentGameMode = GameMode.ADVENTURE; + _currentDifficultyData = FieMasterData.I.GetMasterData(GetDifficultyItemKeyName(currentDifficulty)); + SetLanguageSetting(currentLanguage, reloadAllTextUI: false); + } + + private void InitializeFont() + { + GDEConstantTextListData masterData = FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_FONT); + GDEConstantTextListData masterData2 = FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_FONT_SIZE_RATE); + if (masterData == null || masterData2 == null) + { + Debug.LogError("Faild to load font parameters."); + } + else + { + englishFont = Resources.Load(masterData.English); + if (englishFont == null) + { + Debug.LogError("Faild to load an english font data."); + } + ReloadCurrentFont(); + } + } + + private void ReloadCurrentFont() + { + GDEConstantTextListData masterData = FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_FONT); + GDEConstantTextListData masterData2 = FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_FONT_SIZE_RATE); + if (masterData == null || masterData2 == null) + { + Debug.LogError("Faild to load font parameters."); + } + else + { + switch (currentLanguage) + { + case Language.English: + currentFont = englishFont; + currentFontSizeRate = float.Parse(masterData2.English); + break; + case Language.Japanese: + currentFont = Resources.Load(masterData.Japanese); + currentFontSizeRate = float.Parse(masterData2.Japanese); + break; + case Language.French: + currentFont = Resources.Load(masterData.French); + currentFontSizeRate = float.Parse(masterData2.French); + break; + } + if (currentFont == null) + { + Debug.LogError("Faild to load a current language font data. Language :" + currentLanguage.ToString()); + } + } + } + + public void CalibrateTimeEnviroment(float timeScale = 1f, int targetFrameRate = 60) + { + Time.timeScale = timeScale; + Application.targetFrameRate = targetFrameRate; + Time.fixedDeltaTime = Time.timeScale / (float)Application.targetFrameRate; + currentFrameRate = targetFrameRate; + } + + public void SetLanguageSetting(Language targetLanguage, bool reloadAllTextUI = true) + { + if (targetLanguage != currentLanguage) + { + FieManagerBehaviour.I.onMemorySaveData.LanguageCode = (int)targetLanguage; + currentLanguage = targetLanguage; + ReloadCurrentFont(); + if (reloadAllTextUI) + { + ReloadAllTextUI(currentLanguage); + } + } + } + + public void SetDifficulty(Difficulty targetDifficulty) + { + if (targetDifficulty != currentDifficulty) + { + currentDifficulty = targetDifficulty; + _currentDifficultyData = FieMasterData.I.GetMasterData(GetDifficultyItemKeyName(currentDifficulty)); + if (this.DifficultyChangedEvent != null) + { + this.DifficultyChangedEvent(); + } + } + } + + public GDEDifficultyListData GetDifficultyData(Difficulty difficulty) + { + return FieMasterData.I.GetMasterData(GetDifficultyItemKeyName(difficulty)); + } + + private string GetDifficultyItemKeyName(Difficulty difficulty) + { + switch (difficulty) + { + case Difficulty.EASY: + return GDEItemKeys.DifficultyList_EASY; + case Difficulty.NORMAL: + return GDEItemKeys.DifficultyList_NORMAL; + case Difficulty.HARD: + return GDEItemKeys.DifficultyList_HARD; + case Difficulty.VERY_HARD: + return GDEItemKeys.DifficultyList_VERY_HARD; + case Difficulty.NIGHTMARE: + return GDEItemKeys.DifficultyList_NIGHTMARE; + case Difficulty.CHAOS: + return GDEItemKeys.DifficultyList_CHAOS; + default: + return GDEItemKeys.DifficultyList_NORMAL; + } + } + + public void ReloadAllTextUI(Language targetLanguage) + { + FieUILocalizedTextObjectBase[] array = UnityEngine.Object.FindObjectsOfType(); + if (array.Length > 0) + { + FieUILocalizedTextObjectBase[] array2 = array; + foreach (FieUILocalizedTextObjectBase fieUILocalizedTextObjectBase in array2) + { + fieUILocalizedTextObjectBase.InitializeText(); + } + } + } + + public string getVersionString() + { + return "v_1_0_211_Prototype(In-House Build)"; + } + } +} diff --git a/src/Fie.Manager/FieFaderManager.cs b/src/Fie.Manager/FieFaderManager.cs new file mode 100644 index 0000000..b0245ca --- /dev/null +++ b/src/Fie.Manager/FieFaderManager.cs @@ -0,0 +1,140 @@ +using Fie.Fader; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieFaderManager : FieManagerBehaviour + { + public enum FadeType + { + NONE, + OUT_TO_BLACK, + OUT_TO_WHITE, + IN_FROM_AUTOMATIC, + IN_FROM_BLACK, + IN_FROM_WHITE + } + + public enum FadeState + { + NOT_INITIALIZED, + FADE_OUTING, + FADE_OUT_DONE, + FADE_INING, + FADE_IN_DONE, + DONE + } + + public const float DEFAULT_FADE_TIME = 0.5f; + + private FadeType latestFaderType; + + private FieFader fader; + + private readonly Vector4 fadeOutToBlackColor = new Vector4(0f, 0f, 0f, 1f); + + private readonly Vector4 fadeOutToWhiteColor = new Vector4(1f, 1f, 1f, 1f); + + private readonly Vector4 fadeInFromBlackColor = new Vector4(0f, 0f, 0f, 0f); + + private readonly Vector4 fadeInFromWhiteColor = new Vector4(1f, 1f, 1f, 0f); + + private float showLoadScreenCount; + + private Coroutine faderCoroutine; + + protected override void StartUpEntity() + { + GameObject original = Resources.Load("Prefabs/LoadScreen/FieFaderObjects") as GameObject; + GameObject gameObject = UnityEngine.Object.Instantiate(original); + gameObject.transform.parent = base.transform; + fader = gameObject.GetComponent(); + fader.Initialize(); + } + + public void InitializeFader(FadeType type, float fadeTime = 0.5f) + { + FadeType fadeType = type; + switch (type) + { + case FadeType.NONE: + fader.InitFader(Vector4.zero, Vector4.zero, 0f); + break; + case FadeType.IN_FROM_AUTOMATIC: + if (latestFaderType == FadeType.OUT_TO_BLACK) + { + fader.InitFader(fadeOutToBlackColor, fadeInFromBlackColor, fadeTime); + fadeType = FadeType.IN_FROM_BLACK; + } + else if (latestFaderType == FadeType.OUT_TO_WHITE) + { + fader.InitFader(fadeOutToWhiteColor, fadeInFromWhiteColor, fadeTime); + fadeType = FadeType.IN_FROM_WHITE; + } + else + { + fader.InitFader(Vector4.zero, Vector4.zero, 0f); + } + break; + case FadeType.OUT_TO_BLACK: + fader.InitFader(fadeInFromBlackColor, fadeOutToBlackColor, fadeTime); + break; + case FadeType.OUT_TO_WHITE: + fader.InitFader(fadeInFromWhiteColor, fadeOutToWhiteColor, fadeTime); + break; + case FadeType.IN_FROM_BLACK: + fader.InitFader(fadeOutToBlackColor, fadeInFromBlackColor, fadeTime); + break; + case FadeType.IN_FROM_WHITE: + fader.InitFader(fadeOutToWhiteColor, fadeInFromWhiteColor, fadeTime); + break; + } + latestFaderType = fadeType; + } + + public void HideFader() + { + fader.HideFader(); + } + + public bool isEndUpdateFader() + { + return fader.IsEndUpdateFader(); + } + + public void ShowLoadScreen(float showSec) + { + fader.ShowLoadScreen(); + showLoadScreenCount = showSec; + } + + public void HideLoadScreen() + { + fader.HideLoadScreen(); + } + + public bool UpdateLoadScreen(float time) + { + showLoadScreenCount -= time; + if (showLoadScreenCount <= 0f) + { + return true; + } + return false; + } + + public void LaunchFader(FadeType fadeType, float fadeTime = 0.5f) + { + if (!FieManagerBehaviour.I.isNowLoading) + { + FieManagerBehaviour.I.InitializeFader(fadeType, fadeTime); + } + } + + public bool IsEndFade() + { + return fader.IsEndUpdateFader(); + } + } +} diff --git a/src/Fie.Manager/FieGUIManager.cs b/src/Fie.Manager/FieGUIManager.cs new file mode 100644 index 0000000..0277ced --- /dev/null +++ b/src/Fie.Manager/FieGUIManager.cs @@ -0,0 +1,326 @@ +using Fie.Camera; +using Fie.UI; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Manager +{ + public class FieGUIManager : FieManagerBehaviour + { + public enum FieUILayer + { + FORWARD, + DEFAULT, + BACKWARD, + BACKWORD_SECOND, + BACKWORD_THIRD + } + + public enum FieUIPositionTag + { + HEADER_ROOT, + FOOTER_ROOT, + ABILITY_ICON_1, + ABILITY_ICON_2, + ABILITY_ICON_3 + } + + private FieUICamera _uiCamera; + + private Dictionary _asyncLoadObjectList = new Dictionary(); + + private Dictionary _gameUIResouceList = new Dictionary(); + + private Dictionary> _gameUIList = new Dictionary>(); + + private FieGameUIHeaderFooterManager _headerFooterManager; + + private FieGameUIDialogCaptionManager _dialogCaptionManager; + + private FieGameUIActivityWindowManager _activityWindowManager; + + private FieGameUIPlayerWindowManager _playerWindowManager; + + private FieGameUIGameOverWindowManager _gameOverWindowManager; + + public Dictionary uiPositionList = new Dictionary(); + + private bool _isBooted; + + public FieUICamera uiCamera => _uiCamera; + + protected override void StartUpEntity() + { + if (!_isBooted) + { + if (_uiCamera == null) + { + _uiCamera = UnityEngine.Object.FindObjectOfType(); + if (_uiCamera == null) + { + GameObject gameObject = Resources.Load("Prefabs/Manager/GUICamera") as GameObject; + if (gameObject == null) + { + throw new Exception("Missing the GUI camera prefab."); + } + GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity); + if (gameObject2 == null) + { + throw new Exception("Fiald to instantiate the GUI camera object."); + } + gameObject2.transform.parent = base.transform; + _uiCamera = gameObject2.GetComponent(); + if (_uiCamera == null) + { + throw new Exception("GUI Camera component dosen't exists in GUI camera prefab."); + } + } + } + List uIComponentManagerList = getUIComponentManagerList(); + if (uIComponentManagerList != null && uIComponentManagerList.Count > 0) + { + for (int i = 0; i < uIComponentManagerList.Count; i++) + { + base.gameObject.AddComponent(uIComponentManagerList[i]); + } + PreloadInGameUIResouses(); + ReloadUIOwner(); + _headerFooterManager = GetComponent(); + _dialogCaptionManager = GetComponent(); + _activityWindowManager = GetComponent(); + _playerWindowManager = GetComponent(); + _gameOverWindowManager = GetComponent(); + _activityWindowManager.StartUp(); + _isBooted = true; + } + } + } + + public void ReloadUIOwner() + { + setUIOwner(FieManagerBehaviour.I.gameOwnerCharacter); + uiCamera.setGameCamera(FieManagerBehaviour.I.gameCamera); + } + + public void ReloadPlayerWindow() + { + if (!(_playerWindowManager == null)) + { + _playerWindowManager.ReloadPlayerWindows(); + } + } + + public void setUIOwner(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + FieGameUIComponentManagerBase[] components = GetComponents(); + if (components != null && components.Length > 0) + { + for (int i = 0; i < components.Length; i++) + { + components[i].setComponentManagerOwner(gameCharacter); + components[i].StartUp(); + } + } + } + } + + public void ShowHeaderFooter() + { + if (!(_headerFooterManager == null)) + { + _headerFooterManager.Show(); + } + } + + public void HideHeaderFooter() + { + if (!(_headerFooterManager == null)) + { + _headerFooterManager.Hide(); + } + } + + public FieGameUIActivityWindow.ActivityWindowState GetActivityWindowState() + { + if (_activityWindowManager == null) + { + return FieGameUIActivityWindow.ActivityWindowState.BUSY; + } + return _activityWindowManager.GetActivityWindowState(); + } + + private void PreloadInGameUIResouses() + { + Dictionary gameUIPrefabList = getGameUIPrefabList(); + foreach (KeyValuePair item in gameUIPrefabList) + { + if (item.Key.IsSubclassOf(typeof(FieGameUIBase))) + { + GameObject gameObject = Resources.Load(item.Value) as GameObject; + if (gameObject == null) + { + Debug.LogError("faild to load resource of " + item.Key.ToString()); + } + else + { + _gameUIResouceList[item.Key] = gameObject; + FieManagerBehaviour.I.StartCoroutine(FieManagerBehaviour.I.AsyncInstantiateToBuffer(item.Key, gameObject)); + } + } + } + } + + public void AssignGameUIObject(string prefabPath) where T : FieGameUIBase + { + if (!_gameUIResouceList.ContainsKey(typeof(T))) + { + GameObject gameObject = Resources.Load(prefabPath) as GameObject; + if (!(gameObject == null)) + { + _gameUIResouceList[typeof(T)] = gameObject; + FieManagerBehaviour.I.StartCoroutine(FieManagerBehaviour.I.AsyncInstantiateToBuffer(typeof(T), gameObject)); + } + } + } + + public T CreateGui(FieGameCharacter ownerCharacter) where T : FieGameUIBase + { + if (!typeof(T).IsSubclassOf(typeof(FieGameUIBase))) + { + return (T)null; + } + if (!_gameUIList.ContainsKey(typeof(T))) + { + Debug.LogError(typeof(T).ToString() + " has not been assigned. You must assign this object before instantiate."); + return (T)null; + } + int num = -1; + for (int i = 0; i < _gameUIList[typeof(T)].Count; i++) + { + if (!_gameUIList[typeof(T)][i].gameObject.activeSelf) + { + _gameUIList[typeof(T)][i].ownerCharacter = ownerCharacter; + _gameUIList[typeof(T)][i].uiActive = true; + num = i; + break; + } + } + int num2 = 0; + for (int j = 0; j < _gameUIList[typeof(T)].Count; j++) + { + if (_gameUIList[typeof(T)][j].gameObject.activeSelf) + { + num2++; + } + } + if (num2 >= _gameUIList[typeof(T)].Count) + { + FieManagerBehaviour.I.StartCoroutine(FieManagerBehaviour.I.AsyncInstantiateToBuffer(typeof(T), _gameUIResouceList[typeof(T)])); + } + if (num >= 0) + { + return _gameUIList[typeof(T)][num] as T; + } + GameObject gameObject = CreateUIByBuffer(typeof(T), Vector3.zero, Quaternion.identity, useBuffer: false); + T component = gameObject.GetComponent(); + if ((UnityEngine.Object)component == (UnityEngine.Object)null) + { + return (T)null; + } + component.ownerCharacter = ownerCharacter; + component.uiActive = true; + return component; + } + + private IEnumerator AsyncInstantiateToBuffer(Type uiObjectType, GameObject instantTargetObject) + { + _asyncLoadObjectList[uiObjectType] = null; + GameObject uiObject = UnityEngine.Object.Instantiate(instantTargetObject, Vector3.zero, Quaternion.identity); + FieGameUIBase uiBase = uiObject.GetComponent(); + if (uiBase != null) + { + uiBase.uiActive = false; + uiObject.transform.SetParent(base.transform); + _asyncLoadObjectList[uiObjectType] = uiObject; + if (!_gameUIList.ContainsKey(uiObjectType)) + { + _gameUIList[uiObjectType] = new List(); + } + _gameUIList[uiObjectType].Add(uiBase); + } + else if (uiObject != null) + { + Debug.Log("unknown ui object was instantiated. this object does'nt extend FieGameUIBase.Type:" + uiObject.ToString()); + UnityEngine.Object.Destroy(uiObject); + } + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + + private GameObject CreateUIByBuffer(Type uiObjectType, Vector3 initPosition, Quaternion initRotation, bool useBuffer = true) + { + if (useBuffer && _asyncLoadObjectList[uiObjectType] != null) + { + GameObject gameObject = _asyncLoadObjectList[uiObjectType]; + gameObject.transform.position = initPosition; + gameObject.transform.rotation = initRotation; + gameObject.SetActive(value: true); + FieManagerBehaviour.I.StartCoroutine(FieManagerBehaviour.I.AsyncInstantiateToBuffer(uiObjectType, _gameUIResouceList[uiObjectType])); + return gameObject; + } + GameObject gameObject2 = UnityEngine.Object.Instantiate(_gameUIResouceList[uiObjectType], initPosition, initRotation); + if (gameObject2 == null) + { + return null; + } + FieGameUIBase component = gameObject2.GetComponent(); + if (component == null) + { + return null; + } + if (!_gameUIList.ContainsKey(uiObjectType)) + { + _gameUIList[uiObjectType] = new List(); + } + _gameUIList[uiObjectType].Add(component); + return gameObject2; + } + + private Dictionary getGameUIPrefabList() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(typeof(FieGameUIHeaderFooter), "Prefabs/UI/HeaderFooter/HeaderFooter"); + dictionary.Add(typeof(FieGameUIEnemyLifeGauge), "Prefabs/UI/LifeGauge/EnemyLifeGauge"); + dictionary.Add(typeof(FieGameUIPlayerWindow), "Prefabs/UI/PlayerWindow/PlayerWindow"); + dictionary.Add(typeof(FieGameUISplitLine), "Prefabs/UI/SplitLine/SplitLine"); + dictionary.Add(typeof(FieGameUIPlayerLifeGauge), "Prefabs/UI/LifeGauge/PlayerLifeGauge"); + dictionary.Add(typeof(FieGameUIFriendshipGauge), "Prefabs/UI/FriendshipGauge/PlayerFriendshipGauge"); + dictionary.Add(typeof(FieGameUITargetIcon), "Prefabs/UI/TargetIcon/TargetIcon"); + dictionary.Add(typeof(FieGameUIDamageCounter), "Prefabs/UI/DamageCounter/FieUIDamageCounter"); + dictionary.Add(typeof(FieGameUIDialogCaption), "Prefabs/UI/Dialog/FieDialog"); + dictionary.Add(typeof(FieGameUIActivityWindow), "Prefabs/UI/ActivityWindow/ActivityWindow"); + dictionary.Add(typeof(FieGameUIIndicator), "Prefabs/UI/Indicator/Indicator"); + dictionary.Add(typeof(FieGameUIGameOverWindow), "Prefabs/UI/GameOverWindow/GameOverWindow"); + return dictionary; + } + + private List getUIComponentManagerList() + { + List list = new List(); + list.Add(typeof(FieGameUIHeaderFooterManager)); + list.Add(typeof(FieGameUIPlayerWindowManager)); + list.Add(typeof(FieGameUIEnemyLifeGaugeManager)); + list.Add(typeof(FieGameUIDamageCounterManager)); + list.Add(typeof(FieGameUIAbilitiesIconManager)); + list.Add(typeof(FieGameUIDialogCaptionManager)); + list.Add(typeof(FieGameUIActivityWindowManager)); + list.Add(typeof(FieGameUIIndicatorManager)); + list.Add(typeof(FieGameUIGameOverWindowManager)); + return list; + } + } +} diff --git a/src/Fie.Manager/FieGameCameraManager.cs b/src/Fie.Manager/FieGameCameraManager.cs new file mode 100644 index 0000000..d74bf98 --- /dev/null +++ b/src/Fie.Manager/FieGameCameraManager.cs @@ -0,0 +1,80 @@ +using Fie.Camera; +using Fie.Utility; +using System; +using UnityEngine; + +namespace Fie.Manager +{ + public class FieGameCameraManager : FieManagerBehaviour + { + private static readonly Vector3 defaultCameraOffset = new Vector3(0f, 1.5f, -5.5f); + + private static readonly Vector3 defaultCameraRotation = new Vector3(2f, 0f, 0f); + + private Vector3 _sceneCameraOffset = defaultCameraOffset; + + private Vector3 _sceneCameraRotation = defaultCameraRotation; + + private FieGameCamera _gameCamera; + + public FieGameCamera gameCamera => _gameCamera; + + protected override void StartUpEntity() + { + if (_gameCamera == null) + { + _gameCamera = UnityEngine.Object.FindObjectOfType(); + if (_gameCamera == null) + { + GameObject gameObject = Resources.Load("Prefabs/Manager/FieGameCamera") as GameObject; + if (gameObject == null) + { + throw new Exception("Missing the game camera prefab."); + } + GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity); + if (gameObject2 == null) + { + throw new Exception("Fiald to instantiate the game camera object."); + } + _gameCamera = gameObject2.GetComponent(); + if (_gameCamera == null) + { + throw new Exception("Game camera component dosen't exists in game camera prefab."); + } + } + } + _gameCamera.transform.parent = base.transform; + _gameCamera.setCameraOwner(FieManagerBehaviour.I.gameOwnerCharacter); + } + + public void setWiggler(Wiggler.WiggleTemplate template) + { + gameCamera.setWiggler(template); + } + + public void setWiggler(float totalTime, int wiggleCount, Vector3 wiggleScale) + { + gameCamera.setWiggler(totalTime, wiggleCount, wiggleScale); + } + + public void setDefaultCameraOffset(Vector3 newDefaultOffset) + { + _sceneCameraOffset = newDefaultOffset; + } + + public void setDefaultCameraRotation(Vector3 newDefaultRotation) + { + _sceneCameraRotation = newDefaultRotation; + } + + public Vector3 getDefaultCameraOffset() + { + return _sceneCameraOffset; + } + + public Vector3 getDefaultCameraRotation() + { + return _sceneCameraRotation; + } + } +} diff --git a/src/Fie.Manager/FieGameCharacterManager.cs b/src/Fie.Manager/FieGameCharacterManager.cs new file mode 100644 index 0000000..493b279 --- /dev/null +++ b/src/Fie.Manager/FieGameCharacterManager.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public class FieGameCharacterManager : FieManagerBehaviour + { + public delegate void GameCharacterCreatedCallback(T createdCharacter) where T : FieGameCharacter; + + public const float LOAD_RESOURCE_TIMEOUT = 3f; + + private Dictionary _prefabInfoCache = new Dictionary(); + + private List _createdObjectList = new List(); + + protected override void StartUpEntity() + { + } + + private void ResetAllCache() + { + _prefabInfoCache = new Dictionary(); + } + + public void DestroyAllCharacters() + { + foreach (GameObject createdObject in _createdObjectList) + { + if (!(createdObject == null)) + { + PhotonView component = createdObject.GetComponent(); + if (component != null) + { + if (component.isMine) + { + PhotonNetwork.Destroy(component); + } + } + else + { + UnityEngine.Object.Destroy(createdObject); + } + } + } + } + + private IEnumerator AsyncCreateGameCharacter(string path, GameCharacterCreatedCallback callback, bool isSyncNetwork = true) where T : FieGameCharacter + { + ResourceRequest loadRequest = Resources.LoadAsync(path); + float time = 0f; + if (time < 3f && !loadRequest.isDone) + { + float num = time + Time.deltaTime; + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + GameObject loadObject = loadRequest.asset as GameObject; + GameObject createdObject = (!isSyncNetwork || PhotonNetwork.offlineMode) ? UnityEngine.Object.Instantiate(loadObject, Vector3.zero, Quaternion.identity) : PhotonNetwork.Instantiate(path, Vector3.zero, Quaternion.identity, 0); + createdObject.transform.SetParent(base.transform); + createdObject.SetActive(value: true); + T createdCharacter = createdObject.GetComponent(); + if ((UnityEngine.Object)createdCharacter != (UnityEngine.Object)null) + { + callback?.Invoke(createdCharacter); + } + _createdObjectList.Add(createdObject); + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + + public void CreateGameCharacter(GameCharacterCreatedCallback callback, bool isSyncNetwork = true) where T : FieGameCharacter + { + string empty = string.Empty; + if (!_prefabInfoCache.ContainsKey(typeof(T))) + { + FiePrefabInfo fiePrefabInfo = (FiePrefabInfo)Attribute.GetCustomAttribute(typeof(T), typeof(FiePrefabInfo)); + if (fiePrefabInfo == null) + { + return; + } + _prefabInfoCache[typeof(T)] = fiePrefabInfo; + empty = fiePrefabInfo.path; + } + else + { + empty = _prefabInfoCache[typeof(T)].path; + } + if (empty == string.Empty) + { + Debug.LogError("The FiePrefabInfo dosen't exists! Please check the class : " + typeof(T).FullName); + } + else + { + FieManagerBehaviour.I.StartCoroutine(FieManagerBehaviour.I.AsyncCreateGameCharacter(empty, callback, isSyncNetwork)); + } + } + + public FieGameCharacter CreateGameCharacter(Type gameCharacterType) + { + FiePrefabInfo fiePrefabInfo = (FiePrefabInfo)Attribute.GetCustomAttribute(gameCharacterType, typeof(FiePrefabInfo)); + if (fiePrefabInfo == null) + { + return null; + } + GameObject original = Resources.Load(fiePrefabInfo.path) as GameObject; + GameObject gameObject = UnityEngine.Object.Instantiate(original, Vector3.zero, Quaternion.identity); + if (gameObject == null) + { + return null; + } + return gameObject.GetComponent(); + } + } +} diff --git a/src/Fie.Manager/FieInGameCharacterStatusManager.cs b/src/Fie.Manager/FieInGameCharacterStatusManager.cs new file mode 100644 index 0000000..d6527a6 --- /dev/null +++ b/src/Fie.Manager/FieInGameCharacterStatusManager.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)] + public class FieInGameCharacterStatusManager : FieManagerBehaviour + { + public enum ForcesTag + { + PLAYER, + ENEMY + } + + public Dictionary> _characterLists = new Dictionary> + { + { + ForcesTag.PLAYER, + new Dictionary() + }, + { + ForcesTag.ENEMY, + new Dictionary() + } + }; + + protected override void StartUpEntity() + { + _characterLists[ForcesTag.PLAYER] = new Dictionary(); + _characterLists[ForcesTag.ENEMY] = new Dictionary(); + } + + public void AssignCharacter(ForcesTag tag, FieGameCharacter character) + { + _characterLists[tag][character.GetInstanceID()] = character; + } + + public void DissociateCharacter(ForcesTag tag, FieGameCharacter character) + { + _characterLists[tag].Remove(character.GetInstanceID()); + } + + public FieGameCharacter GetNearbyInjuryAllyCharacter(FieGameCharacter searchingCharacter) + { + if (_characterLists[ForcesTag.PLAYER] == null || _characterLists[ForcesTag.PLAYER].Count <= 0) + { + return null; + } + List list = new List(); + foreach (int key in _characterLists[ForcesTag.PLAYER].Keys) + { + if (_characterLists[ForcesTag.PLAYER][key].damageSystem.isDead && _characterLists[ForcesTag.PLAYER][key].GetInstanceID() != searchingCharacter.GetInstanceID()) + { + list.Add(_characterLists[ForcesTag.PLAYER][key]); + } + } + if (list.Count <= 0) + { + return null; + } + return (from entry in list + orderby Vector3.Distance(entry.transform.position, searchingCharacter.transform.position) + select entry)?.FirstOrDefault(); + } + + public bool isAllPlayerDied() + { + int num = 0; + int num2 = 0; + foreach (int key in _characterLists[ForcesTag.PLAYER].Keys) + { + num++; + if (_characterLists[ForcesTag.PLAYER][key].healthStats.hitPoint <= 0f && _characterLists[ForcesTag.PLAYER][key].friendshipStats.getCurrentFriendshipPoint() < 3) + { + num2++; + } + } + if (num2 >= num) + { + return true; + } + return false; + } + } +} diff --git a/src/Fie.Manager/FieInGameEnemyManager.cs b/src/Fie.Manager/FieInGameEnemyManager.cs new file mode 100644 index 0000000..6985c51 --- /dev/null +++ b/src/Fie.Manager/FieInGameEnemyManager.cs @@ -0,0 +1,111 @@ +using Fie.Enemies; +using Fie.Object; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)] + public class FieInGameEnemyManager : FieManagerBehaviour + { + private Dictionary _resouceCache = new Dictionary(); + + private List _currentEnemies = new List(); + + protected override void StartUpEntity() + { + _currentEnemies = new List(); + } + + private void CleanupEnemyList() + { + _currentEnemies.RemoveAll((FieGameCharacter enemy) => enemy == null); + } + + public void Assign(FieGameCharacter enemy) + { + CleanupEnemyList(); + int index = -1; + for (int i = 0; i < _currentEnemies.Count; i++) + { + if (_currentEnemies[i] == null) + { + _currentEnemies[index] = enemy; + return; + } + } + _currentEnemies.Add(enemy); + } + + public FieGameCharacter GetNearestEnemy(Vector3 worldPosition) + { + CleanupEnemyList(); + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < _currentEnemies.Count; i++) + { + if (!(_currentEnemies[i] == null)) + { + dictionary[i] = Vector3.Distance(worldPosition, _currentEnemies[i].position); + } + } + return _currentEnemies[(from x in dictionary + select (x)).Min().Key]; + } + + public FieGameCharacter CreateEnemyOnlyMasterClienty(Type enemyType, Vector3 position) + { + if (!PhotonNetwork.isMasterClient) + { + return null; + } + return CreateEnemy(enemyType, position); + } + + public FieGameCharacter CreateEnemy(Type enemyType, Vector3 position) + { + if (!enemyType.IsSubclassOf(typeof(FieObjectEnemies))) + { + return null; + } + FiePrefabInfo fiePrefabInfo = (FiePrefabInfo)Attribute.GetCustomAttribute(enemyType, typeof(FiePrefabInfo)); + if (fiePrefabInfo == null) + { + return null; + } + GameObject gameObject = null; + if (PhotonNetwork.offlineMode) + { + GameObject gameObject2 = null; + if (!_resouceCache.ContainsKey(enemyType)) + { + gameObject2 = (Resources.Load(fiePrefabInfo.path) as GameObject); + _resouceCache[enemyType] = gameObject2; + } + else + { + gameObject2 = _resouceCache[enemyType]; + } + gameObject = UnityEngine.Object.Instantiate(gameObject2, position, Quaternion.identity); + } + else + { + gameObject = PhotonNetwork.InstantiateSceneObject(fiePrefabInfo.path, position, Quaternion.identity, 0, null); + } + if (gameObject != null) + { + FieObjectEnemies component = gameObject.GetComponent(); + if (component != null) + { + component.InitializeIntelligenceSystem(FieGameCharacter.IntelligenceType.AI); + component.gameObject.SetActive(value: true); + component.RequestArrivalState(); + component.forces = FieEmittableObjectBase.EmitObjectTag.ENEMY; + } + return component; + } + return null; + } + } +} diff --git a/src/Fie.Manager/FieInGameStateManager.cs b/src/Fie.Manager/FieInGameStateManager.cs new file mode 100644 index 0000000..3c29ca2 --- /dev/null +++ b/src/Fie.Manager/FieInGameStateManager.cs @@ -0,0 +1,255 @@ +using Fie.Camera; +using Fie.Core; +using Fie.Object; +using Fie.Scene; +using Fie.User; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)] + public class FieInGameStateManager : FieManagerBehaviour + { + public enum FieInGameState + { + STATE_IS_INITIALIZING, + STATE_IS_RETRYING, + STATE_NOW_ON_GAME, + STATE_CUTSCENE, + STATE_GAMEOVER, + STATE_ON_QUIT + } + + public delegate void FieInGameStateChangedCallback(); + + public FieInGameState _gameState; + + public Coroutine _checkingGameOverCoroutine; + + private bool _isBooted; + + private int _gameOverCount; + + public bool isBootComplete => _isBooted; + + public event FieInGameStateChangedCallback GameOverEvent; + + public event FieInGameStateChangedCallback RetryEvent; + + public event FieInGameStateChangedCallback RetryFinishedEvent; + + private IEnumerator InGameBootTask() + { + _isBooted = false; + FiePlayerSpawnPoint[] array = UnityEngine.Object.FindObjectsOfType(); + Dictionary dictionary = new Dictionary(); + if (array != null && array.Length > 0) + { + for (int i = 0; i < array.Length; i++) + { + dictionary[array[i].spawnPointNumber] = array[i].transform.position; + } + } + if (!FieBootstrap.isBootedFromBootStrap) + { + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + int num = 0; + FieUser[] allUserData = FieManagerBehaviour.I.getAllUserData(); + foreach (FieUser fieUser in allUserData) + { + FieGameCharacter fieGameCharacter = null; + if (fieUser != null) + { + Vector3 position = (!dictionary.ContainsKey(num)) ? Vector3.zero : dictionary[num]; + if (fieUser.usersCharacter != null) + { + fieGameCharacter = fieUser.usersCharacter; + fieGameCharacter.transform.position = position; + fieGameCharacter.transform.rotation = Quaternion.LookRotation(Vector3.forward); + } + else + { + if (FieBootstrap.isBootedFromBootStrap) + { + Debug.LogError("An users character prefab was missed! please check the class : " + fieUser.usersCharacterPrefab.GetType()); + continue; + } + if (fieUser.usersCharacter == null && fieUser.usersCharacterPrefab != null) + { + string empty = string.Empty; + FiePrefabInfo fiePrefabInfo = (FiePrefabInfo)Attribute.GetCustomAttribute(fieUser.usersCharacterPrefab.GetType(), typeof(FiePrefabInfo)); + if (fiePrefabInfo == null) + { + Debug.LogError("The debug character prefab dose not have FiePrefabInfo attribute! Please check the class : " + fieUser.usersCharacterPrefab.GetType()); + continue; + } + string path = fiePrefabInfo.path; + if (path == string.Empty) + { + Debug.LogError("A prefab path was not found! Please check the class : " + fieUser.usersCharacterPrefab.GetType()); + continue; + } + GameObject gameObject = PhotonNetwork.Instantiate(path, position, Quaternion.LookRotation(Vector3.forward), 0); + fieGameCharacter = (fieUser.usersCharacter = gameObject.GetComponent()); + } + } + if (fieGameCharacter != null) + { + if (!FieBootstrap.isBootedFromBootStrap) + { + fieGameCharacter.InitializeIntelligenceSystem(); + } + if (PhotonNetwork.offlineMode && fieUser.usersCharacter.intelligenceType == FieGameCharacter.IntelligenceType.Controllable) + { + fieGameCharacter.SetOwnerUser(fieUser); + } + else if (fieGameCharacter.photonView.ownerId == PhotonNetwork.player.ID) + { + fieGameCharacter.SetOwnerUser(fieUser); + } + FieManagerBehaviour.I.AssignCharacter(FieInGameCharacterStatusManager.ForcesTag.PLAYER, fieGameCharacter); + } + num++; + } + } + } + else + { + int num2 = 0; + List allPlayerCharacters = FieManagerBehaviour.I.GetAllPlayerCharacters(); + foreach (FieGameCharacter item in allPlayerCharacters) + { + if (item.forces == FieEmittableObjectBase.EmitObjectTag.PLAYER) + { + Vector3 vector2 = item.position = ((!dictionary.ContainsKey(num2)) ? Vector3.zero : dictionary[num2]); + FieManagerBehaviour.I.AssignCharacter(FieInGameCharacterStatusManager.ForcesTag.PLAYER, item); + num2++; + } + } + } + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.gameCamera.SetCameraTask(); + FieManagerBehaviour.I.StartUp(); + _isBooted = true; + _gameState = FieInGameState.STATE_NOW_ON_GAME; + yield break; + } + + private IEnumerator RetryTask() + { + yield return (object)new WaitForSeconds(0.1f); + /*Error: Unable to find new state assignment for yield return*/; + } + + private void GameOverCallback() + { + FieManagerBehaviour.I.isEnableControll = false; + } + + protected override void StartUpEntity() + { + _gameState = FieInGameState.STATE_IS_INITIALIZING; + StartCoroutine(InGameBootTask()); + if (_checkingGameOverCoroutine != null) + { + StopCoroutine(_checkingGameOverCoroutine); + } + _checkingGameOverCoroutine = StartCoroutine(CheckingGameOverTask()); + } + + private IEnumerator CheckingGameOverTask() + { + if (_gameState == FieInGameState.STATE_NOW_ON_GAME) + { + if (FieManagerBehaviour.I.isAllPlayerDied()) + { + _gameOverCount = Mathf.Clamp(_gameOverCount + 1, 1, 5); + } + if (_gameOverCount > 3) + { + SetGameState(FieInGameState.STATE_GAMEOVER); + } + yield return (object)new WaitForSeconds(1f); + /*Error: Unable to find new state assignment for yield return*/; + } + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + + public void SetGameState(FieInGameState state) + { + if (state != _gameState) + { + switch (state) + { + case FieInGameState.STATE_GAMEOVER: + FieManagerBehaviour.I.SendGameOverEvent(); + if (_checkingGameOverCoroutine != null) + { + StopCoroutine(_checkingGameOverCoroutine); + } + if (this.GameOverEvent != null) + { + this.GameOverEvent(); + } + break; + case FieInGameState.STATE_IS_RETRYING: + FieManagerBehaviour.I.SendRetryEvent(); + StartCoroutine(RetryTask()); + break; + case FieInGameState.STATE_ON_QUIT: + FieManagerBehaviour.I.SendGameQuitEvent(); + QuitGame(); + break; + } + _gameState = state; + } + } + + private void QuitGame() + { + FieManagerBehaviour.I.LoadScene(new FieSceneResult(), allowSceneActivation: true, FieFaderManager.FadeType.OUT_TO_WHITE, 1f); + FieManagerBehaviour.I.ChangeMixerVolume(0f, 0.5f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.Voice, FieAudioManager.FieAudioMixerType.SE); + if (_checkingGameOverCoroutine != null) + { + StopCoroutine(_checkingGameOverCoroutine); + } + } + + public void SetGameOver() + { + if (this.GameOverEvent != null) + { + this.GameOverEvent(); + } + } + + internal void SetRetry() + { + if (_checkingGameOverCoroutine != null) + { + StopCoroutine(_checkingGameOverCoroutine); + } + StartCoroutine(RetryTask()); + } + + internal void SetQuit() + { + QuitGame(); + } + + private void OnDestroy() + { + if (_checkingGameOverCoroutine != null) + { + StopCoroutine(_checkingGameOverCoroutine); + } + } + } +} diff --git a/src/Fie.Manager/FieInputManager.cs b/src/Fie.Manager/FieInputManager.cs new file mode 100644 index 0000000..3050568 --- /dev/null +++ b/src/Fie.Manager/FieInputManager.cs @@ -0,0 +1,327 @@ +using Rewired; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieInputManager : FieManagerBehaviour + { + public enum FieInputUIControlMode + { + KEYBOARD, + GAME_PAD + } + + public enum FieInputUIKeyType + { + NONE = 0, + KEY_TYPE_UP = 1, + KEY_TYPE_DOWN = 2, + KEY_TYPE_LEFT = 4, + KEY_TYPE_RIGHT = 8, + KEY_TYPE_CANCEL = 0x10, + KEY_TYPE_DECIDE = 0x20, + KEY_TYPE_INTERACT = 0x40 + } + + public delegate void FieUIInputDelegate(FieInputUIKeyType keyType); + + private const string fieInputPlayerPrefsBaseKey = "FieInputMap"; + + public const int MAXIMUM_LOCAL_PLAYERS = 1; + + private FieInputUIKeyType _currentKeyTypes; + + private FieInputUIControlMode _currentInputUIMode; + + private InputManager _inputManager; + + private Dictionary _players = new Dictionary(); + + public bool isEnableControll = true; + + public FieInputUIKeyType currentKeyTypes => _currentKeyTypes; + + public event FieUIInputDelegate uiInputEvent; + + protected override void StartUpEntity() + { + if (_inputManager == null) + { + _inputManager = UnityEngine.Object.FindObjectOfType(); + if (_inputManager == null) + { + GameObject gameObject = Resources.Load("Prefabs/Manager/FieInputMapper") as GameObject; + if (gameObject == null) + { + throw new Exception("Missing the input manager prefab."); + } + GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity); + if (gameObject2 == null) + { + throw new Exception("Fiald to instantiate the input manager object."); + } + _inputManager = gameObject2.GetComponent(); + if (_inputManager == null) + { + throw new Exception("InputManager component dosen't exists in the imputmanager prefab."); + } + } + } + _inputManager.transform.parent = base.transform; + LoadAllMaps(); + for (int i = 0; i < 1; i++) + { + _players[i] = ReInput.players.GetPlayer(i); + } + } + + public void Update() + { + _currentKeyTypes = FieInputUIKeyType.NONE; + if (GetPlayer().GetButtonDown("Up")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_UP; + } + else if (GetPlayer().GetButtonDown("Down")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_DOWN; + } + if (GetPlayer().GetButtonDown("Left")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_LEFT; + } + else if (GetPlayer().GetButtonDown("Right")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_RIGHT; + } + if (GetPlayer().GetButtonDown("Cancel")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_CANCEL; + } + if (GetPlayer().GetButtonDown("Decide")) + { + _currentKeyTypes |= FieInputUIKeyType.KEY_TYPE_DECIDE; + } + if (_currentKeyTypes != 0 && this.uiInputEvent != null) + { + this.uiInputEvent(_currentKeyTypes); + } + if (GetPlayer().GetButtonTimePressed("Menu") > 3f) + { + Application.Quit(); + } + if (GetPlayer().GetButtonTimePressed("Restart") > 3f) + { + FieManagerFactory.I.Restart(); + } + } + + public Player GetPlayer(int playerId = 0) + { + return _players[playerId]; + } + + public void SetUIControlMode(FieInputUIControlMode mode) + { + _currentInputUIMode = mode; + } + + public FieInputUIControlMode GetUIControlMode() + { + return _currentInputUIMode; + } + + private string GetBasePlayerPrefsKey(Player player) + { + string str = "FieInputMap"; + return str + "|playerName=" + player.name; + } + + private string GetControllerMapPlayerPrefsKey(Player player, ControllerMapSaveData saveData) + { + string basePlayerPrefsKey = GetBasePlayerPrefsKey(player); + basePlayerPrefsKey += "|dataType=ControllerMap"; + basePlayerPrefsKey = basePlayerPrefsKey + "|controllerMapType=" + saveData.mapTypeString; + string text = basePlayerPrefsKey; + basePlayerPrefsKey = text + "|categoryId=" + saveData.map.categoryId + "|layoutId=" + saveData.map.layoutId; + basePlayerPrefsKey = basePlayerPrefsKey + "|hardwareIdentifier=" + saveData.controllerHardwareIdentifier; + if (saveData.mapType == typeof(JoystickMap)) + { + basePlayerPrefsKey = basePlayerPrefsKey + "|hardwareGuid=" + ((JoystickMapSaveData)saveData).joystickHardwareTypeGuid.ToString(); + } + return basePlayerPrefsKey; + } + + private string GetControllerMapXml(Player player, ControllerType controllerType, int categoryId, int layoutId, Controller controller) + { + string basePlayerPrefsKey = GetBasePlayerPrefsKey(player); + basePlayerPrefsKey += "|dataType=ControllerMap"; + basePlayerPrefsKey = basePlayerPrefsKey + "|controllerMapType=" + controller.mapTypeString; + string text = basePlayerPrefsKey; + basePlayerPrefsKey = text + "|categoryId=" + categoryId + "|layoutId=" + layoutId; + basePlayerPrefsKey = basePlayerPrefsKey + "|hardwareIdentifier=" + controller.hardwareIdentifier; + if (controllerType == ControllerType.Joystick) + { + Joystick joystick = (Joystick)controller; + basePlayerPrefsKey = basePlayerPrefsKey + "|hardwareGuid=" + joystick.hardwareTypeGuid.ToString(); + } + if (!PlayerPrefs.HasKey(basePlayerPrefsKey)) + { + return string.Empty; + } + return PlayerPrefs.GetString(basePlayerPrefsKey); + } + + private List GetAllControllerMapsXml(Player player, bool userAssignableMapsOnly, ControllerType controllerType, Controller controller) + { + List list = new List(); + IList mapCategories = ReInput.mapping.MapCategories; + for (int i = 0; i < mapCategories.Count; i++) + { + InputMapCategory inputMapCategory = mapCategories[i]; + if (!userAssignableMapsOnly || inputMapCategory.userAssignable) + { + IList list2 = ReInput.mapping.MapLayouts(controllerType); + for (int j = 0; j < list2.Count; j++) + { + InputLayout inputLayout = list2[j]; + string controllerMapXml = GetControllerMapXml(player, controllerType, inputMapCategory.id, inputLayout.id, controller); + if (!(controllerMapXml == string.Empty)) + { + list.Add(controllerMapXml); + } + } + } + } + return list; + } + + private string GetJoystickCalibrationMapPlayerPrefsKey(JoystickCalibrationMapSaveData saveData) + { + string str = "FieInputMap"; + str += "|dataType=CalibrationMap"; + str = str + "|controllerType=" + saveData.controllerType.ToString(); + str = str + "|hardwareIdentifier=" + saveData.hardwareIdentifier; + return str + "|hardwareGuid=" + saveData.joystickHardwareTypeGuid.ToString(); + } + + private string GetJoystickCalibrationMapXml(Joystick joystick) + { + string str = "FieInputMap"; + str += "|dataType=CalibrationMap"; + str = str + "|controllerType=" + joystick.type.ToString(); + str = str + "|hardwareIdentifier=" + joystick.hardwareIdentifier; + str = str + "|hardwareGuid=" + joystick.hardwareTypeGuid.ToString(); + if (!PlayerPrefs.HasKey(str)) + { + return string.Empty; + } + return PlayerPrefs.GetString(str); + } + + private string GetInputBehaviorPlayerPrefsKey(Player player, InputBehavior saveData) + { + string basePlayerPrefsKey = GetBasePlayerPrefsKey(player); + basePlayerPrefsKey += "|dataType=InputBehavior"; + return basePlayerPrefsKey + "|id=" + saveData.id; + } + + private string GetInputBehaviorXml(Player player, int id) + { + string basePlayerPrefsKey = GetBasePlayerPrefsKey(player); + basePlayerPrefsKey += "|dataType=InputBehavior"; + basePlayerPrefsKey = basePlayerPrefsKey + "|id=" + id; + if (!PlayerPrefs.HasKey(basePlayerPrefsKey)) + { + return string.Empty; + } + return PlayerPrefs.GetString(basePlayerPrefsKey); + } + + public void SaveAllMaps() + { + IList allPlayers = ReInput.players.AllPlayers; + for (int i = 0; i < allPlayers.Count; i++) + { + Player player = allPlayers[i]; + PlayerSaveData saveData = player.GetSaveData(userAssignableMapsOnly: true); + InputBehavior[] inputBehaviors = saveData.inputBehaviors; + foreach (InputBehavior inputBehavior in inputBehaviors) + { + string inputBehaviorPlayerPrefsKey = GetInputBehaviorPlayerPrefsKey(player, inputBehavior); + PlayerPrefs.SetString(inputBehaviorPlayerPrefsKey, inputBehavior.ToXmlString()); + } + foreach (ControllerMapSaveData allControllerMapSaveDatum in saveData.AllControllerMapSaveData) + { + string controllerMapPlayerPrefsKey = GetControllerMapPlayerPrefsKey(player, allControllerMapSaveDatum); + PlayerPrefs.SetString(controllerMapPlayerPrefsKey, allControllerMapSaveDatum.map.ToXmlString()); + } + } + foreach (Joystick joystick in ReInput.controllers.Joysticks) + { + JoystickCalibrationMapSaveData calibrationMapSaveData = joystick.GetCalibrationMapSaveData(); + string joystickCalibrationMapPlayerPrefsKey = GetJoystickCalibrationMapPlayerPrefsKey(calibrationMapSaveData); + PlayerPrefs.SetString(joystickCalibrationMapPlayerPrefsKey, calibrationMapSaveData.map.ToXmlString()); + } + PlayerPrefs.Save(); + } + + public void LoadAllMaps() + { + IList allPlayers = ReInput.players.AllPlayers; + for (int i = 0; i < allPlayers.Count; i++) + { + Player player = allPlayers[i]; + IList inputBehaviors = ReInput.mapping.GetInputBehaviors(player.id); + for (int j = 0; j < inputBehaviors.Count; j++) + { + string inputBehaviorXml = GetInputBehaviorXml(player, inputBehaviors[j].id); + if (inputBehaviorXml != null && !(inputBehaviorXml == string.Empty)) + { + inputBehaviors[j].ImportXmlString(inputBehaviorXml); + } + } + List allControllerMapsXml = GetAllControllerMapsXml(player, userAssignableMapsOnly: true, ControllerType.Keyboard, ReInput.controllers.Keyboard); + List allControllerMapsXml2 = GetAllControllerMapsXml(player, userAssignableMapsOnly: true, ControllerType.Mouse, ReInput.controllers.Mouse); + bool flag = false; + List> list = new List>(); + foreach (Joystick joystick in player.controllers.Joysticks) + { + List allControllerMapsXml3 = GetAllControllerMapsXml(player, userAssignableMapsOnly: true, ControllerType.Joystick, joystick); + list.Add(allControllerMapsXml3); + if (allControllerMapsXml3.Count > 0) + { + flag = true; + } + } + if (allControllerMapsXml.Count > 0) + { + player.controllers.maps.ClearMaps(ControllerType.Keyboard, userAssignableOnly: true); + } + player.controllers.maps.AddMapsFromXml(ControllerType.Keyboard, 0, allControllerMapsXml); + if (flag) + { + player.controllers.maps.ClearMaps(ControllerType.Joystick, userAssignableOnly: true); + } + int num = 0; + foreach (Joystick joystick2 in player.controllers.Joysticks) + { + player.controllers.maps.AddMapsFromXml(ControllerType.Joystick, joystick2.id, list[num]); + num++; + } + if (allControllerMapsXml2.Count > 0) + { + player.controllers.maps.ClearMaps(ControllerType.Mouse, userAssignableOnly: true); + } + player.controllers.maps.AddMapsFromXml(ControllerType.Mouse, 0, allControllerMapsXml2); + } + foreach (Joystick joystick3 in ReInput.controllers.Joysticks) + { + joystick3.ImportCalibrationMapFromXmlString(GetJoystickCalibrationMapXml(joystick3)); + } + } + } +} diff --git a/src/Fie.Manager/FieLevelInfo.cs b/src/Fie.Manager/FieLevelInfo.cs new file mode 100644 index 0000000..079485f --- /dev/null +++ b/src/Fie.Manager/FieLevelInfo.cs @@ -0,0 +1,15 @@ +namespace Fie.Manager +{ + public struct FieLevelInfo + { + public int level; + + public int levelCap; + + public int totalExp; + + public int requiredExpToNextLevel; + + public int currentExpToNextLevel; + } +} diff --git a/src/Fie.Manager/FieLobbyGameCharacterGenerateManager.cs b/src/Fie.Manager/FieLobbyGameCharacterGenerateManager.cs new file mode 100644 index 0000000..175e8e7 --- /dev/null +++ b/src/Fie.Manager/FieLobbyGameCharacterGenerateManager.cs @@ -0,0 +1,82 @@ +using Fie.Object; +using Fie.Ponies; +using Fie.User; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.OUTGAME)] + public class FieLobbyGameCharacterGenerateManager : FieManagerBehaviour + { + public delegate void LobbyGameCharacterCreatedCallback(); + + private Vector3 _playerInitPosition = Vector3.zero; + + public Vector3 playerInitPosition => _playerInitPosition; + + protected override void StartUpEntity() + { + FiePlayerSpawnPoint[] array = UnityEngine.Object.FindObjectsOfType(); + if (array != null && array.Length > 0) + { + int num = 2147483647; + for (int i = 0; i < array.Length; i++) + { + if (array[i].spawnPointNumber < num) + { + _playerInitPosition = array[i].transform.position; + } + } + } + } + + public void RequestToCreateGameCharacter(FieUser user, LobbyGameCharacterCreatedCallback lobbyCallback) where T : FieGameCharacter + { + FieGameCharacterManager.GameCharacterCreatedCallback callback = delegate(T gameCharacter) + { + user.usersCharacter = gameCharacter; + if (FieManagerBehaviour.I.myHash == user.userHash) + { + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.ReloadUIOwner(); + FieManagerBehaviour.I.ShowHeaderFooter(); + FieManagerBehaviour.I.SetUserCharacter(FieManagerBehaviour.I.getUserNumberByHash(FieManagerBehaviour.I.myHash), gameCharacter); + FieManagerBehaviour.I.ValidateUserName(FieManagerBehaviour.I.myPlayerNumber); + gameCharacter.InitializeIntelligenceSystem(FieGameCharacter.IntelligenceType.Controllable); + } + else if (!PhotonNetwork.offlineMode) + { + gameCharacter.InitializeIntelligenceSystem(FieGameCharacter.IntelligenceType.Connection); + } + else + { + gameCharacter.InitializeIntelligenceSystem(FieGameCharacter.IntelligenceType.AI); + } + Vector3 origin = _playerInitPosition + Vector3.up; + Vector3 normalized = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)).normalized; + Vector3 vector = _playerInitPosition + normalized * 1f; + int layerMask = 1049088; + if (Physics.Raycast(origin, normalized, out RaycastHit hitInfo, 1f, layerMask)) + { + vector = hitInfo.point; + } + layerMask = 512; + if (Physics.Raycast(vector, Vector3.down, out hitInfo, 20f, layerMask) && hitInfo.collider.tag == "Floor") + { + vector = hitInfo.point; + } + gameCharacter.position = vector; + gameCharacter.transform.SetParent(FieManagerBehaviour.I.transform); + user.usersCharacter = gameCharacter; + gameCharacter.SetOwnerUser(user); + gameCharacter.getStateMachine().setState(typeof(FieStateMachinePoniesArrival), isForceSet: true); + FieManagerBehaviour.I.RebuildPlayerInformationCommand(); + if (lobbyCallback != null) + { + lobbyCallback(); + } + }; + FieManagerBehaviour.I.CreateGameCharacter(callback); + } + } +} diff --git a/src/Fie.Manager/FieManagerBase.cs b/src/Fie.Manager/FieManagerBase.cs new file mode 100644 index 0000000..f58fb12 --- /dev/null +++ b/src/Fie.Manager/FieManagerBase.cs @@ -0,0 +1,34 @@ +using Photon; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.ANYTIME_DESTROY)] + public abstract class FieManagerBase : Photon.MonoBehaviour + { + private bool _isEndStartup; + + private bool _isDestroyed; + + public bool isDestroyed => _isDestroyed; + + protected virtual void StartUpEntity() + { + } + + public void StartUp() + { + if (!_isEndStartup) + { + StartUpEntity(); + _isEndStartup = true; + } + } + + public void Destroy() + { + UnityEngine.Object.Destroy(base.transform.gameObject); + _isDestroyed = true; + } + } +} diff --git a/src/Fie.Manager/FieManagerBehaviour.cs b/src/Fie.Manager/FieManagerBehaviour.cs new file mode 100644 index 0000000..ad23bd3 --- /dev/null +++ b/src/Fie.Manager/FieManagerBehaviour.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace Fie.Manager +{ + public class FieManagerBehaviour : FieManagerBase where T : FieManagerBase + { + [SerializeField] + private bool _isAutoStartUp; + + private static T instance; + + public static T I + { + get + { + if ((UnityEngine.Object)instance != (UnityEngine.Object)null && instance.isDestroyed) + { + instance = (T)null; + } + if ((UnityEngine.Object)instance == (UnityEngine.Object)null) + { + instance = UnityEngine.Object.FindObjectOfType(); + if ((UnityEngine.Object)instance == (UnityEngine.Object)null || instance.isDestroyed) + { + GameObject gameObject = new GameObject(); + UnityEngine.Object.DontDestroyOnLoad(gameObject); + instance = gameObject.AddComponent(); + gameObject.name = instance.GetType().Name; + } + FieManagerFactory.I.AddManager(instance); + } + return instance; + } + set + { + instance = value; + } + } + + private void Start() + { + if (_isAutoStartUp) + { + T i = I; + i.StartUp(); + } + } + } +} diff --git a/src/Fie.Manager/FieManagerExistSceneFlag.cs b/src/Fie.Manager/FieManagerExistSceneFlag.cs new file mode 100644 index 0000000..43d46ef --- /dev/null +++ b/src/Fie.Manager/FieManagerExistSceneFlag.cs @@ -0,0 +1,13 @@ +using System; + +namespace Fie.Manager +{ + [Flags] + public enum FieManagerExistSceneFlag + { + ANYTIME_DESTROY = 0x1, + OUTGAME = 0x2, + INGAME = 0x4, + NEVER_DESTROY = 0x8 + } +} diff --git a/src/Fie.Manager/FieManagerExists.cs b/src/Fie.Manager/FieManagerExists.cs new file mode 100644 index 0000000..9860171 --- /dev/null +++ b/src/Fie.Manager/FieManagerExists.cs @@ -0,0 +1,15 @@ +using System; + +namespace Fie.Manager +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class FieManagerExists : Attribute + { + public readonly FieManagerExistSceneFlag existFlag; + + public FieManagerExists(FieManagerExistSceneFlag initFlags) + { + existFlag = initFlags; + } + } +} diff --git a/src/Fie.Manager/FieManagerFactory.cs b/src/Fie.Manager/FieManagerFactory.cs new file mode 100644 index 0000000..8e45f6a --- /dev/null +++ b/src/Fie.Manager/FieManagerFactory.cs @@ -0,0 +1,172 @@ +using Fie.Scene; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Fie.Manager +{ + public sealed class FieManagerFactory : MonoBehaviour + { + private FieSceneType _currentSceneType; + + private static FieManagerFactory instance; + + private Dictionary managerList = new Dictionary(); + + public static FieManagerFactory I + { + get + { + if (instance == null) + { + instance = UnityEngine.Object.FindObjectOfType(); + if (instance == null) + { + GameObject gameObject = new GameObject(); + UnityEngine.Object.DontDestroyOnLoad(gameObject); + instance = gameObject.AddComponent(); + gameObject.name = instance.GetType().Name; + } + } + return instance; + } + } + + public FieSceneType currentSceneType + { + get + { + return _currentSceneType; + } + set + { + _currentSceneType = value; + } + } + + public void AddManager(FieManagerBase manager) + { + if (!managerList.ContainsKey(manager.GetType())) + { + managerList[manager.GetType()] = manager; + } + if (manager.transform != null) + { + manager.transform.parent = base.gameObject.transform; + } + } + + private void CleanupManager(FieSceneBase targertScene) + { + if (managerList.Count > 0) + { + if (targertScene != null) + { + FieSceneLink sceneLinkInfo = targertScene.GetSceneLinkInfo(); + _currentSceneType = sceneLinkInfo.definedSceneType; + } + List list = new List(); + foreach (KeyValuePair manager in managerList) + { + bool flag = false; + if (manager.Value == null || manager.Value.transform == null) + { + flag = true; + } + else + { + FieManagerExists fieManagerExists = (FieManagerExists)Attribute.GetCustomAttribute(manager.Key, typeof(FieManagerExists)); + if (fieManagerExists != null) + { + if ((fieManagerExists.existFlag & FieManagerExistSceneFlag.NEVER_DESTROY) != 0) + { + continue; + } + if ((fieManagerExists.existFlag & FieManagerExistSceneFlag.ANYTIME_DESTROY) != 0) + { + flag = true; + } + if (_currentSceneType == FieSceneType.INGAME && (fieManagerExists.existFlag & FieManagerExistSceneFlag.INGAME) == (FieManagerExistSceneFlag)0) + { + flag = true; + } + if (_currentSceneType == FieSceneType.OUTGAME && (fieManagerExists.existFlag & FieManagerExistSceneFlag.OUTGAME) == (FieManagerExistSceneFlag)0) + { + flag = true; + } + } + } + if (flag) + { + list.Add(manager.Key); + } + } + foreach (Type item in list) + { + managerList[item].Destroy(); + managerList.Remove(item); + } + } + } + + public void StartUp() + { + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.StartUp(); + FieManagerBehaviour.I.FiePreparedForLoadSceneEvent += ScenePreparedToLoadCallback; + FieManagerBehaviour.I.FieSceneWasLoadedEvent += SceneLoadedCallback; + } + + private void ScenePreparedToLoadCallback(FieSceneBase targetScene) + { + CleanupManager(targetScene); + } + + private void SceneLoadedCallback(FieSceneBase targetScene) + { + if (currentSceneType == FieSceneType.INGAME) + { + if (!FieManagerBehaviour.I.isBooted) + { + FieManagerBehaviour.I.StartUp(); + } + FieManagerBehaviour.I.StartUp(); + } + } + + public void Restart() + { + I.KillPopcornFxAll(); + if (!FieManagerBehaviour.I.isTitle()) + { + foreach (KeyValuePair manager in managerList) + { + UnityEngine.Object.Destroy(manager.Value.gameObject); + } + UnityEngine.Object.Destroy(base.gameObject); + SceneManager.LoadScene(0, LoadSceneMode.Single); + } + } + + public void KillPopcornFxAll() + { + PKFxFX[] array = UnityEngine.Object.FindObjectsOfType(); + if (array != null && array.Length > 0) + { + PKFxFX[] array2 = array; + foreach (PKFxFX pKFxFX in array2) + { + pKFxFX.KillEffect(); + } + } + } + } +} diff --git a/src/Fie.Manager/FieNetworkManager.cs b/src/Fie.Manager/FieNetworkManager.cs new file mode 100644 index 0000000..991c3a5 --- /dev/null +++ b/src/Fie.Manager/FieNetworkManager.cs @@ -0,0 +1,549 @@ +using ExitGames.Client.Photon; +using Fie.User; +using GameDataEditor; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Networking; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public class FieNetworkManager : FieManagerBehaviour + { + private enum FieNetworkChannels + { + UNRELIABLE, + RELIABLE, + ALL_COST_DELIVERY, + CHANNEL_MAX + } + + public enum FieNetworkManagerState + { + IDLE, + TRANSACTING, + NOW_HOSTING, + NOW_CLIENT + } + + public enum FieNetowrkErrorCode + { + SUCCEED, + ERROR_TO_CREATE_ROOM, + ERROR_TO_JOIN_ROOM, + ERROR_TO_CONNECT_MASTER_SERVER + } + + public delegate void FieNetworkCallback(FieNetowrkErrorCode errorCode); + + public const string ROOM_VIEW_ID = "network_manager_view_id"; + + public const string ROOM_ENEMY_FORCES = "enemy_forces"; + + public const string ROOM_DIFFICULTY = "difficulty"; + + public const string ROOM_GAME_MODE = "mode"; + + public const string USER_CHARCTER_TYPE_KEY = "game_character_type"; + + public const string USER_CHARCTER_VIEW_ID = "game_character_viwe_id"; + + public const string USER_PLAYER_LEVEL = "player_level"; + + public const string USER_CHARACTER_LEVEL = "character_level"; + + public const string USER_SCENE_ID = "scene_id"; + + private const ulong UNET_ID = 31203uL; + + private const string PROJECT_ID = "FiE"; + + private const string PLAYERPREFS_CLOUD_NETWORKING_ID_KEY = "CloudNetworkingId"; + + private FieNetworkCallback _createMatchCallback; + + private FieNetworkCallback _joinMatchCallback; + + private FieNetworkCallback _disconnectmatchCallback; + + private Coroutine _disconnectCoroutine; + + private ulong _currentMatchId; + + private FieNetworkManagerState _nowState; + + public CloudRegionCode masterServerRegion = CloudRegionCode.none; + + private ExitGames.Client.Photon.Hashtable _myPlayerInfoHashTable = new ExitGames.Client.Photon.Hashtable(); + + private ExitGames.Client.Photon.Hashtable _myRoomInfoHashTable = new ExitGames.Client.Photon.Hashtable(); + + public event FieNetworkCallback connectedToMasterServerEvent; + + public event FieNetworkCallback feiledToConnectToMasterServerEvent; + + private IEnumerator DisconnectCoroutine() + { + if (_nowState != 0) + { + if (_nowState == FieNetworkManagerState.TRANSACTING) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + PhotonNetwork.Disconnect(); + } + } + + private void Awake() + { + base.gameObject.AddComponent(); + } + + public void SetMyCharacterTypeKey(string characterTypeKey) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.player != null) + { + _myPlayerInfoHashTable["game_character_type"] = characterTypeKey; + PhotonNetwork.player.SetCustomProperties(_myPlayerInfoHashTable); + } + } + + public void SetMyCharacterViewId(int characterViewId) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.player != null) + { + _myPlayerInfoHashTable["game_character_viwe_id"] = characterViewId; + PhotonNetwork.player.SetCustomProperties(_myPlayerInfoHashTable); + } + } + + public void SetMyPlayerLevel(int playerLevel) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.player != null) + { + _myPlayerInfoHashTable["player_level"] = playerLevel; + PhotonNetwork.player.SetCustomProperties(_myPlayerInfoHashTable); + } + } + + public void SetMyCharacterLevel(int characterLevel) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.player != null) + { + _myPlayerInfoHashTable["character_level"] = characterLevel; + PhotonNetwork.player.SetCustomProperties(_myPlayerInfoHashTable); + } + } + + public void SetMySceneId(int sceneId) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.player != null) + { + _myPlayerInfoHashTable["scene_id"] = sceneId; + PhotonNetwork.player.SetCustomProperties(_myPlayerInfoHashTable); + } + } + + public void SetRoomDifficulty(int difficulty) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.room != null && PhotonNetwork.inRoom && PhotonNetwork.isMasterClient) + { + _myRoomInfoHashTable["difficulty"] = difficulty; + PhotonNetwork.room.SetCustomProperties(_myRoomInfoHashTable); + } + } + + public void SetRoomInfo(int sceneViewId, FieEnvironmentManager.GameMode gameMode, FieEnvironmentManager.Difficulty difficulty) + { + if (!PhotonNetwork.offlineMode && PhotonNetwork.room != null) + { + _myRoomInfoHashTable["network_manager_view_id"] = sceneViewId; + _myRoomInfoHashTable["mode"] = (int)gameMode; + _myRoomInfoHashTable["difficulty"] = (int)difficulty; + PhotonNetwork.room.SetCustomProperties(_myRoomInfoHashTable); + } + } + + protected override void StartUpEntity() + { + PlayerPrefs.SetString("CloudNetworkingId", "MasterData/fie_master_data"); + } + + public bool CheckPlayerScenesIsSame() + { + if (PhotonNetwork.offlineMode || !PhotonNetwork.inRoom) + { + return true; + } + if (PhotonNetwork.otherPlayers.Length <= 0) + { + return true; + } + int num = (int)PhotonNetwork.player.CustomProperties["scene_id"]; + bool result = true; + for (int i = 0; i < PhotonNetwork.otherPlayers.Length; i++) + { + if (!PhotonNetwork.otherPlayers[i].CustomProperties.ContainsKey("scene_id")) + { + result = false; + break; + } + int num2 = (int)PhotonNetwork.otherPlayers[i].CustomProperties["scene_id"]; + if (num2 != num) + { + result = false; + break; + } + } + return result; + } + + public void CreateNetowkRoom(FieNetworkCallback callback, string roomName = "") + { + if (_nowState == FieNetworkManagerState.IDLE) + { + if (roomName == string.Empty) + { + roomName = FieManagerBehaviour.I.CalcMd5(UnityEngine.Random.Range(0, 2147483647).ToString()); + } + roomName = "FiERoom_" + roomName; + RoomOptions roomOptions = new RoomOptions(); + roomOptions.MaxPlayers = 3; + TypedLobby typedLobby = new TypedLobby(); + typedLobby.Type = LobbyType.Default; + PhotonNetwork.CreateRoom(roomName, roomOptions, typedLobby); + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_INFORMATION_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_WAITING_FOR_CREATE_ROOM), 2f); + _createMatchCallback = callback; + _nowState = FieNetworkManagerState.TRANSACTING; + } + } + + public void JoinNetowkRoom(FieNetworkCallback callback, string password) + { + if (_nowState == FieNetworkManagerState.IDLE) + { + PhotonNetwork.JoinRandomRoom(); + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_INFORMATION_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_WAITING_FOR_MATCH), 2f); + _joinMatchCallback = callback; + _nowState = FieNetworkManagerState.TRANSACTING; + } + } + + public void Disconnect(FieNetworkCallback callback) + { + if (_nowState != 0) + { + _disconnectmatchCallback = callback; + if (_disconnectCoroutine != null) + { + StopCoroutine(_disconnectCoroutine); + } + _disconnectCoroutine = StartCoroutine(DisconnectCoroutine()); + } + } + + public void RegsitSpawnablePrefab(GameObject targetObject) + { + ClientScene.RegisterPrefab(targetObject); + } + + private void OnCreatedRoom() + { + if (_createMatchCallback != null) + { + FieNetowrkErrorCode errorCode = (PhotonNetwork.room == null) ? FieNetowrkErrorCode.ERROR_TO_CREATE_ROOM : FieNetowrkErrorCode.SUCCEED; + _createMatchCallback(errorCode); + } + _createMatchCallback = null; + base.photonView.viewID = PhotonNetwork.AllocateSceneViewID(); + base.photonView.RequestOwnership(); + SetRoomInfo(base.photonView.viewID, FieManagerBehaviour.I.currentGameMode, FieManagerBehaviour.I.currentDifficulty); + FieManagerBehaviour.I.RegistUser(PhotonNetwork.player); + _nowState = FieNetworkManagerState.IDLE; + } + + private void OnJoinedRoom() + { + if (_joinMatchCallback != null) + { + FieNetowrkErrorCode errorCode = (PhotonNetwork.room == null) ? FieNetowrkErrorCode.ERROR_TO_JOIN_ROOM : FieNetowrkErrorCode.SUCCEED; + _joinMatchCallback(errorCode); + } + int num = (int)PhotonNetwork.room.CustomProperties["network_manager_view_id"]; + if (num != base.photonView.viewID) + { + base.photonView.viewID = num; + base.photonView.TransferOwnership(PhotonNetwork.masterClient); + } + if (!PhotonNetwork.isMasterClient) + { + FieManagerBehaviour.I.SetDifficulty((FieEnvironmentManager.Difficulty)PhotonNetwork.room.CustomProperties["difficulty"]); + FieManagerBehaviour.I.currentGameMode = (FieEnvironmentManager.GameMode)PhotonNetwork.room.CustomProperties["mode"]; + } + _joinMatchCallback = null; + StartCoroutine(RebuildPlayersByRoomInfo()); + SetMyPlayerLevel(FieManagerBehaviour.I.onMemorySaveData.PlayerLevel); + _nowState = FieNetworkManagerState.IDLE; + } + + private void OnPhotonCreateRoomFailed(object[] codeAndMsg) + { + if (_createMatchCallback != null) + { + FieNetowrkErrorCode errorCode = FieNetowrkErrorCode.ERROR_TO_CREATE_ROOM; + _createMatchCallback(errorCode); + } + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_ERROR_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_ERROR_FAILD_TO_CREATE_ROOM), 4f); + _createMatchCallback = null; + _nowState = FieNetworkManagerState.IDLE; + } + + private void OnPhotonJoinRoomFailed(object[] codeAndMsg) + { + if (_joinMatchCallback != null) + { + FieNetowrkErrorCode errorCode = FieNetowrkErrorCode.ERROR_TO_JOIN_ROOM; + _joinMatchCallback(errorCode); + } + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_ERROR_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_ERROR_FAILD_TO_JOIN_ROOM), 4f); + _joinMatchCallback = null; + _nowState = FieNetworkManagerState.IDLE; + } + + public void ConnectToMasterServer() + { + if (!PhotonNetwork.connected) + { + string gameVersion = "FiE_" + FieManagerBehaviour.I.getVersionString(); + if (masterServerRegion == CloudRegionCode.none) + { + PhotonNetwork.ConnectToBestCloudServer(gameVersion); + } + else + { + PhotonNetwork.ConnectToRegion(masterServerRegion, gameVersion); + } + PhotonNetwork.sendRate = 30; + PhotonNetwork.sendRateOnSerialize = 30; + PhotonNetwork.logLevel = PhotonLogLevel.ErrorsOnly; + } + } + + private void OnPhotonRandomJoinFailed() + { + OnPhotonJoinRoomFailed(null); + } + + private void OnPhotonPlayerConnected(PhotonPlayer newPlayer) + { + } + + private IEnumerator RebuildPlayersByRoomInfo() + { + if (PhotonNetwork.room != null && PhotonNetwork.playerList != null && PhotonNetwork.playerList.Length > 0) + { + FieManagerBehaviour.I.InitializeUserData(); + yield return (object)new WaitForSeconds(1f); + /*Error: Unable to find new state assignment for yield return*/; + } + } + + public void SetPlyaersGameCharacterInfoToNetwork(FieUser user, FieGameCharacter userCharacter) + { + if (user != null && user.playerInfo != null && !(userCharacter == null)) + { + PhotonView component = userCharacter.GetComponent(); + if (!(component == null)) + { + if (!user.playerInfo.IsLocal) + { + ExitGames.Client.Photon.Hashtable hashtable = new ExitGames.Client.Photon.Hashtable(); + hashtable.Add("game_character_type", userCharacter.GetType().FullName); + hashtable.Add("game_character_viwe_id", component.viewID); + user.playerInfo.SetCustomProperties(hashtable); + } + else + { + SetMyCharacterTypeKey(userCharacter.GetType().FullName); + SetMyCharacterViewId(component.viewID); + } + } + } + } + + public KeyValuePair GetPlayersGameCharacterTypeFromNetwork(FieUser user) + { + KeyValuePair result = default(KeyValuePair); + if (user == null || user.playerInfo == null) + { + return result; + } + ExitGames.Client.Photon.Hashtable customProperties = user.playerInfo.CustomProperties; + if (customProperties == null || !customProperties.ContainsKey("game_character_type") || !customProperties.ContainsKey("game_character_viwe_id")) + { + return result; + } + string typeName = customProperties["game_character_type"] as string; + int key = (int)customProperties["game_character_viwe_id"]; + return new KeyValuePair(key, Type.GetType(typeName)); + } + + public void OnPhotonPlayerDisconnected(PhotonPlayer player) + { + FieManagerBehaviour.I.RemoveUser(player); + FieManagerBehaviour.I.CleanupUserData(narrowDistance: true); + FieManagerBehaviour.I.ReloadPlayerWindow(); + } + + public void OnCustomAuthenticationFailed(string debugMessage) + { + SetOfflineMode(); + } + + public void OnConnectionFail(DisconnectCause cause) + { + SetOfflineMode(); + } + + public void OnFailedToConnectToPhoton(DisconnectCause cause) + { + SetOfflineMode(); + } + + public void OnConnectedToMaster() + { + if (!PhotonNetwork.offlineMode) + { + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_INFORMATION_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_SUCCEED_TO_CONNECT_MASTER_SERVER), 3f); + if (this.connectedToMasterServerEvent != null) + { + this.connectedToMasterServerEvent(FieNetowrkErrorCode.SUCCEED); + } + } + else if (this.feiledToConnectToMasterServerEvent != null) + { + this.feiledToConnectToMasterServerEvent(FieNetowrkErrorCode.ERROR_TO_CONNECT_MASTER_SERVER); + } + } + + public void SetOfflineMode() + { + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_LOBBY_INFORMATION_TITLE_ANY_NETWORK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_BOOT_IN_OFFLINE_MODE), 3f); + if (this.feiledToConnectToMasterServerEvent != null) + { + this.feiledToConnectToMasterServerEvent(FieNetowrkErrorCode.ERROR_TO_CONNECT_MASTER_SERVER); + } + PhotonNetwork.offlineMode = true; + } + + public void RebuildPlayerInformationCommand() + { + base.photonView.RPC("RebuildPlayerInformationRPC", PhotonTargets.All, null); + } + + [PunRPC] + public void SendGameCharacterBuildDataRPC() + { + } + + [PunRPC] + public void RebuildPlayerInformationRPC() + { + FieManagerBehaviour.I.CleanupUserData(); + FieGameCharacter[] array = UnityEngine.Object.FindObjectsOfType(); + int num = 0; + PhotonPlayer[] playerList = PhotonNetwork.playerList; + foreach (PhotonPlayer photonPlayer in playerList) + { + if (photonPlayer != null) + { + if (!photonPlayer.IsLocal) + { + FieUser fieUser = FieManagerBehaviour.I.GetUserData(photonPlayer); + if (fieUser == null) + { + fieUser = FieManagerBehaviour.I.RegistUser(photonPlayer); + } + if (fieUser != null && array != null && array.Length > 0) + { + FieGameCharacter[] array2 = array; + foreach (FieGameCharacter fieGameCharacter in array2) + { + PhotonView component = fieGameCharacter.GetComponent(); + if (!(component == null) && component.owner.ID == fieUser.playerInfo.ID) + { + fieUser.usersCharacter = fieGameCharacter; + fieUser.usersCharacterPrefab = fieGameCharacter; + fieGameCharacter.position = FieManagerBehaviour.I.playerInitPosition; + fieGameCharacter.InitializeIntelligenceSystem(FieGameCharacter.IntelligenceType.Connection); + fieGameCharacter.transform.SetParent(FieManagerBehaviour.I.transform); + fieGameCharacter.SetOwnerUser(fieUser); + } + } + } + } + num++; + } + } + FieManagerBehaviour.I.ReloadPlayerWindow(); + } + + public void SendGameOverEvent() + { + if (PhotonNetwork.isMasterClient) + { + base.photonView.RPC("SendGameOverEventRpc", PhotonTargets.Others, null); + } + } + + [PunRPC] + public void SendGameOverEventRpc() + { + FieManagerBehaviour.I.SetGameOver(); + } + + public void SendRetryEvent() + { + if (PhotonNetwork.isMasterClient) + { + base.photonView.RPC("SendRetryEventRpc", PhotonTargets.Others, null); + } + } + + [PunRPC] + public void SendRetryEventRpc() + { + FieManagerBehaviour.I.SetRetry(); + } + + public void SendGameQuitEvent() + { + if (PhotonNetwork.isMasterClient) + { + base.photonView.RPC("SendGameQuitEventRpc", PhotonTargets.Others, null); + } + } + + [PunRPC] + public void SendGameQuitEventRpc() + { + FieManagerBehaviour.I.SetQuit(); + } + + private void OnApplicationQuit() + { + PhotonNetwork.Disconnect(); + } + + private void OnDestroy() + { + if (PhotonNetwork.inRoom) + { + PhotonNetwork.LeaveRoom(); + } + } + } +} diff --git a/src/Fie.Manager/FieSaveData.cs b/src/Fie.Manager/FieSaveData.cs new file mode 100644 index 0000000..470fde1 --- /dev/null +++ b/src/Fie.Manager/FieSaveData.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Fie.Manager +{ + public class FieSaveData + { + public int LanguageCode; + + public int PlayerLevel = 1; + + public string LastLoginedUserName = string.Empty; + + public string LastLoginedPasswordPassword = string.Empty; + + public Dictionary CharacterExp = new Dictionary(); + + public Dictionary CharacterSkillPoint = new Dictionary(); + + public Dictionary PromotedCount = new Dictionary(); + + public List unlockedSkills = new List(); + + public Dictionary AchivemenetProgress = new Dictionary(); + } +} diff --git a/src/Fie.Manager/FieSaveManager.cs b/src/Fie.Manager/FieSaveManager.cs new file mode 100644 index 0000000..0e6060c --- /dev/null +++ b/src/Fie.Manager/FieSaveManager.cs @@ -0,0 +1,561 @@ +using Fie.Object; +using Fie.Scene; +using GameDataEditor; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieSaveManager : FieManagerBehaviour + { + private static string password = string.Empty; + + private static string directory = "FieData"; + + private static string fileName = "FieSaveData.bin"; + + private static string backupFileName = "FieSaveData_Backup.bin"; + + public static List debugSkills = new List(); + + public Dictionary snapshottedExpList = new Dictionary(); + + public Dictionary currentExpList = new Dictionary(); + + private FieSaveData _onMemorySaveData = new FieSaveData(); + + public FieSaveData onMemorySaveData + { + get + { + return _onMemorySaveData; + } + set + { + _onMemorySaveData = value; + } + } + + protected override void StartUpEntity() + { + LoadAllSaveData(); + FieManagerBehaviour.I.FiePreparedForLoadSceneEvent += I_FiePreparedForLoadSceneEvent; + } + + private void I_FiePreparedForLoadSceneEvent(FieSceneBase targetScene) + { + SaveAllData(); + } + + private void LoadAllSaveData() + { + TryToLoad(ref _onMemorySaveData.LanguageCode, "LanguageCode"); + TryToLoad(ref _onMemorySaveData.PlayerLevel, "PlayerLevel"); + TryToLoad(ref _onMemorySaveData.LastLoginedUserName, "LastLoginedUserName"); + TryToLoad(ref _onMemorySaveData.LastLoginedPasswordPassword, "LastLoginedPasswordPassword"); + TryToLoadDictionary(ref _onMemorySaveData.CharacterExp, "CharacterExp"); + TryToLoadDictionary(ref _onMemorySaveData.CharacterSkillPoint, "CharacterSkillPoint"); + TryToLoadDictionary(ref _onMemorySaveData.PromotedCount, "PromotedCount"); + TryToLoadList(ref _onMemorySaveData.unlockedSkills, "SkillTreeUnlocked"); + TryToLoadDictionary(ref _onMemorySaveData.AchivemenetProgress, "AchivemenetProgress"); + ValidateSaveDataByMasterData(); + } + + private void ValidateSaveDataByMasterData() + { + bool flag = false; + if (_onMemorySaveData.CharacterExp == null) + { + _onMemorySaveData.CharacterExp = new Dictionary(); + flag = true; + } + if (_onMemorySaveData.CharacterSkillPoint == null) + { + _onMemorySaveData.CharacterSkillPoint = new Dictionary(); + flag = true; + } + if (_onMemorySaveData.PromotedCount == null) + { + _onMemorySaveData.PromotedCount = new Dictionary(); + flag = true; + } + Dictionary allMasterData = FieMasterData.I.GetAllMasterData(); + foreach (KeyValuePair item in allMasterData) + { + if (!_onMemorySaveData.CharacterExp.ContainsKey(item.Value.ID)) + { + _onMemorySaveData.CharacterExp[item.Value.ID] = 0; + flag = true; + } + if (!_onMemorySaveData.CharacterSkillPoint.ContainsKey(item.Value.ID)) + { + _onMemorySaveData.CharacterSkillPoint[item.Value.ID] = 0; + flag = true; + } + if (!_onMemorySaveData.PromotedCount.ContainsKey(item.Value.ID)) + { + _onMemorySaveData.PromotedCount[item.Value.ID] = 0; + flag = true; + } + } + if (_onMemorySaveData.AchivemenetProgress == null) + { + _onMemorySaveData.AchivemenetProgress = new Dictionary(); + flag = true; + } + Dictionary allMasterData2 = FieMasterData.I.GetAllMasterData(); + foreach (KeyValuePair item2 in allMasterData2) + { + if (!_onMemorySaveData.AchivemenetProgress.ContainsKey(item2.Value.ID)) + { + _onMemorySaveData.AchivemenetProgress[item2.Value.ID] = 0; + flag = true; + } + } + if (flag) + { + SaveAllData(); + } + } + + internal FieGameCharacterBuildData GetGameCharacterBuildData(GDEGameCharacterTypeData gameCharacterTypeData) + { + FieGameCharacterBuildData result = default(FieGameCharacterBuildData); + result.levelInfo = GetCharacterLevelInfo(gameCharacterTypeData); + result.skillPoint = onMemorySaveData.CharacterSkillPoint[gameCharacterTypeData.ID]; + result.promotedCount = onMemorySaveData.PromotedCount[gameCharacterTypeData.ID]; + return result; + } + + private void SaveAllData() + { + Save(_onMemorySaveData.LanguageCode, "LanguageCode"); + Save(_onMemorySaveData.PlayerLevel, "PlayerLevel"); + Save(_onMemorySaveData.LastLoginedUserName, "LastLoginedUserName"); + Save(_onMemorySaveData.LastLoginedPasswordPassword, "LastLoginedPasswordPassword"); + SaveDictionary(_onMemorySaveData.CharacterExp, "CharacterExp"); + SaveDictionary(_onMemorySaveData.CharacterSkillPoint, "CharacterSkillPoint"); + SaveDictionary(_onMemorySaveData.PromotedCount, "PromotedCount"); + SaveList(_onMemorySaveData.unlockedSkills, "SkillTreeUnlocked"); + SaveDictionary(_onMemorySaveData.AchivemenetProgress, "AchivemenetProgress"); + } + + private void Save(T value, string variableName) + { + ES2.Save(value, GetIdentifier(variableName)); + ES2.Save(value, GetIdentifier(variableName, isBackupMode: true)); + } + + private void SaveList(List value, string variableName) + { + ES2.Save(value, GetIdentifier(variableName)); + ES2.Save(value, GetIdentifier(variableName, isBackupMode: true)); + } + + private void SaveDictionary(Dictionary value, string variableName) + { + ES2.Save(value, GetIdentifier(variableName)); + ES2.Save(value, GetIdentifier(variableName, isBackupMode: true)); + } + + private bool IsExists(string variableName, bool isBackupMode = false) + { + return ES2.Exists(GetIdentifier(variableName, isBackupMode)); + } + + private void TryToLoad(ref T variable, string variableName) + { + if (IsExists(variableName)) + { + try + { + variable = ES2.Load(GetIdentifier(variableName)); + return; + } + catch + { + } + if (IsExists(variableName, isBackupMode: true)) + { + Debug.LogWarning("The save data was not found at master save data. FiE save system will try to load that from backup. The variable name :" + variableName); + try + { + variable = ES2.Load(GetIdentifier(variableName, isBackupMode: true)); + } + catch + { + Debug.LogWarning("Faild to load a save data from backup. The save data was completery broken. It might be initialized. The variable name :" + variableName); + } + } + else + { + Debug.Log("The variable dose not exist on save datas. It might be initialize. The valiable name : " + variableName); + } + } + } + + private void TryToLoadList(ref List variable, string variableName) + { + if (IsExists(variableName)) + { + try + { + variable = ES2.LoadList(GetIdentifier(variableName)); + return; + } + catch + { + } + if (IsExists(variableName, isBackupMode: true)) + { + Debug.LogWarning("The save data was not found at master save data. FiE save system will try to load that from backup. The variable name :" + variableName); + try + { + variable = ES2.LoadList(GetIdentifier(variableName, isBackupMode: true)); + } + catch + { + Debug.LogWarning("Failed to load a save data from backup. The save data was completery broken. It might be initialized. The variable name :" + variableName); + } + } + else + { + Debug.Log("The variable dose not exist on save datas. It might be initialize. The valiable name : " + variableName); + } + } + } + + private void TryToLoadDictionary(ref Dictionary variable, string variableName) + { + if (IsExists(variableName)) + { + try + { + variable = ES2.LoadDictionary(GetIdentifier(variableName)); + return; + } + catch + { + } + if (IsExists(variableName, isBackupMode: true)) + { + Debug.LogWarning("The save data was not found at master save data. FiE save system will try to load that from backup. The variable name :" + variableName); + try + { + variable = ES2.LoadDictionary(GetIdentifier(variableName, isBackupMode: true)); + } + catch + { + Debug.LogWarning("Failed to load a save data from backup. The save data was completery broken. It might be initialized. The variable name :" + variableName); + } + } + else + { + Debug.Log("The variable dose not exist on save datas. It might be initialize. The valiable name : " + variableName); + } + } + } + + private string GetIdentifier(string variableName, bool isBackupMode = false) + { + return directory + "/" + ((!isBackupMode) ? fileName : backupFileName) + "?tag=" + variableName; + } + + private void OnApplicationQuit() + { + SaveAllData(); + } + + private void OnDestroy() + { + SaveAllData(); + } + + public void UnlockSkills(params GDESkillTreeData[] unlockSkills) + { + if (unlockSkills != null && unlockSkills.Length > 0) + { + for (int i = 0; i < unlockSkills.Length; i++) + { + if (!_onMemorySaveData.unlockedSkills.Contains(unlockSkills[i].ID)) + { + _onMemorySaveData.unlockedSkills.Add(unlockSkills[i].ID); + } + } + SaveAllData(); + } + } + + public void LockSkills(params GDESkillTreeData[] lockSkills) + { + if (lockSkills != null && lockSkills.Length > 0 && _onMemorySaveData.unlockedSkills.Count > 0) + { + List list = new List(); + for (int i = 0; i < lockSkills.Length; i++) + { + if (_onMemorySaveData.unlockedSkills.Contains(lockSkills[i].ID)) + { + list.Add(lockSkills[i].ID); + } + } + if (list.Count > 0) + { + for (int j = 0; j < list.Count; j++) + { + _onMemorySaveData.unlockedSkills.Remove(list[j]); + } + } + SaveAllData(); + } + } + + public FieLevelInfo GetCharacterLevelInfo(GDEGameCharacterTypeData gameCharacterTypeData) + { + return GetCharacterLevelInfo((FieConstValues.FieGameCharacter)gameCharacterTypeData.ID); + } + + public FieLevelInfo GetCharacterLevelInfo(FieConstValues.FieGameCharacter gameCharacterTypeID) + { + FieLevelInfo result = default(FieLevelInfo); + if (!_onMemorySaveData.CharacterExp.ContainsKey((int)gameCharacterTypeID)) + { + return result; + } + int totalExp = _onMemorySaveData.CharacterExp[(int)gameCharacterTypeID]; + return GetLevelInfoByTotalExp(totalExp); + } + + public void IncreaseOrReduceSkillPoints(GDEGameCharacterTypeData gameCharacterTypeData, int skillPoint) + { + if (gameCharacterTypeData != null && !(gameCharacterTypeData.Key == string.Empty) && _onMemorySaveData.CharacterSkillPoint.ContainsKey(gameCharacterTypeData.ID)) + { + int num = _onMemorySaveData.CharacterSkillPoint[gameCharacterTypeData.ID] + skillPoint; + if (num < 0) + { + Debug.LogError("Setted skill point is out of range. Calculated Skill Point : " + skillPoint.ToString()); + } + num = Mathf.Max(num, 0); + _onMemorySaveData.CharacterSkillPoint[gameCharacterTypeData.ID] = num; + SaveAllData(); + } + } + + public void ApplyBuildDataFromSaveData(int gameCharacterID, ref GDESkillTreeData[] _unlockedSkills) + { + if (debugSkills != null && debugSkills.Count > 0) + { + _unlockedSkills = (from skill in debugSkills + where skill.GameCharacterType.ID == gameCharacterID + select skill).ToArray(); + } + else + { + _unlockedSkills = FieMasterData.FindMasterDataList(delegate(GDESkillTreeData data) + { + for (int i = 0; i < _onMemorySaveData.unlockedSkills.Count; i++) + { + if (data.GameCharacterType.ID == gameCharacterID && _onMemorySaveData.unlockedSkills[i] == data.ID) + { + return true; + } + } + return false; + }).ToArray(); + } + } + + private FieLevelInfo GetDefaultLevelInfoData() + { + FieLevelInfo result = default(FieLevelInfo); + result.level = 1; + result.levelCap = 1; + result.totalExp = 0; + result.requiredExpToNextLevel = 1; + result.currentExpToNextLevel = 1; + return result; + } + + public FieLevelInfo GetLevelInfoByTotalExp(int totalExp) + { + FieLevelInfo defaultLevelInfoData = GetDefaultLevelInfoData(); + defaultLevelInfoData.totalExp = totalExp; + Dictionary allMasterData = FieMasterData.I.GetAllMasterData(); + if (allMasterData == null || allMasterData.Count <= 0) + { + return defaultLevelInfoData; + } + IEnumerable source = from data in allMasterData + orderby data.Value.Level + select data.Value; + GDELevelTableData[] array = source.ToArray(); + if (array == null || array.Length <= 0) + { + return defaultLevelInfoData; + } + defaultLevelInfoData.levelCap = array[array.Length - 1].Level; + int num = 0; + int num2 = 0; + bool flag = false; + int num3 = 0; + for (int i = 0; i < array.Length; i++) + { + num3 += array[i].ExpRequirement; + if (!flag) + { + num2 = num; + num += array[i].ExpRequirement; + if (totalExp >= num) + { + defaultLevelInfoData.level = array[i].Level; + } + else + { + flag = true; + } + } + } + totalExp = Mathf.Min(totalExp, num3); + if (defaultLevelInfoData.level == defaultLevelInfoData.levelCap) + { + defaultLevelInfoData.requiredExpToNextLevel = 0; + defaultLevelInfoData.currentExpToNextLevel = 0; + } + else + { + defaultLevelInfoData.requiredExpToNextLevel = num - num2; + defaultLevelInfoData.currentExpToNextLevel = totalExp - num2; + } + return defaultLevelInfoData; + } + + public void ResetCurrentGameData() + { + currentExpList = new Dictionary(); + snapshottedExpList = new Dictionary(); + } + + public void SnapshotCurrentExp(FieGameCharacter gameCharacter, int currentExp) + { + if (!(gameCharacter == null) && gameCharacter.ownerUser != null) + { + if (!snapshottedExpList.ContainsKey(gameCharacter.ownerUser.userHash)) + { + snapshottedExpList[gameCharacter.ownerUser.userHash] = 0; + } + snapshottedExpList[gameCharacter.ownerUser.userHash] = currentExp; + } + } + + public void AddCurrentGameExp(FieGameCharacter gameCharacter, int exp) + { + if (!(gameCharacter == null) && gameCharacter.ownerUser != null) + { + if (!currentExpList.ContainsKey(gameCharacter.ownerUser.userHash)) + { + currentExpList[gameCharacter.ownerUser.userHash] = 0; + } + Dictionary dictionary; + string userHash; + (dictionary = currentExpList)[userHash = gameCharacter.ownerUser.userHash] = dictionary[userHash] + exp; + } + } + + public Dictionary GetSnapShottedExp() + { + return snapshottedExpList; + } + + public Dictionary GetCurrentGameExp() + { + Dictionary dictionary = new Dictionary(); + foreach (KeyValuePair currentExp in currentExpList) + { + if (FieManagerBehaviour.I.getUserNumberByHash(currentExp.Key) != -1) + { + dictionary.Add(currentExp.Key, currentExp.Value); + } + } + if (dictionary.Count <= 0) + { + return dictionary; + } + IOrderedEnumerable> source = from x in dictionary + orderby x.Value descending + select x; + return source.ToDictionary((KeyValuePair pair) => pair.Key, (KeyValuePair pair) => pair.Value); + } + + public void FlushExpToSaveData(FieGameCharacter _gainExpTarget) + { + if (!(_gainExpTarget == null)) + { + int num = 0; + Dictionary currentGameExp = GetCurrentGameExp(); + if (currentGameExp != null && currentGameExp.Count() > 0) + { + foreach (KeyValuePair item in currentGameExp) + { + num += item.Value; + } + if (num > 0) + { + FieLevelInfo levelInfoByTotalExp = GetLevelInfoByTotalExp(_onMemorySaveData.CharacterExp[(int)_gainExpTarget.getGameCharacterID()]); + FieLevelInfo levelInfoByTotalExp2 = GetLevelInfoByTotalExp(_onMemorySaveData.CharacterExp[(int)_gainExpTarget.getGameCharacterID()] + num); + if (levelInfoByTotalExp.level < levelInfoByTotalExp2.level) + { + List list = new List(); + for (int i = levelInfoByTotalExp.level; i < levelInfoByTotalExp2.level; i++) + { + list.Add(i + 1); + } + int num2 = 0; + Dictionary allMasterData = FieMasterData.I.GetAllMasterData(); + foreach (int item2 in list) + { + foreach (KeyValuePair item3 in allMasterData) + { + if (item3.Value.Level == item2) + { + num2 += item3.Value.SkillPoint; + } + } + } + Dictionary characterSkillPoint; + int gameCharacterID; + (characterSkillPoint = _onMemorySaveData.CharacterSkillPoint)[gameCharacterID = (int)_gainExpTarget.getGameCharacterID()] = characterSkillPoint[gameCharacterID] + num2; + } + _onMemorySaveData.CharacterExp[(int)_gainExpTarget.getGameCharacterID()] = levelInfoByTotalExp2.totalExp; + SaveAllData(); + } + } + } + } + + public void PromoteGameCharacter(FieConstValues.FieGameCharacter gamecharacterId) + { + if (onMemorySaveData.CharacterExp.ContainsKey((int)gamecharacterId)) + { + bool flag = false; + int totalExp = onMemorySaveData.CharacterExp[(int)gamecharacterId]; + FieLevelInfo levelInfoByTotalExp = GetLevelInfoByTotalExp(totalExp); + if (levelInfoByTotalExp.level == levelInfoByTotalExp.levelCap) + { + flag = true; + } + if (flag) + { + onMemorySaveData.CharacterExp[(int)gamecharacterId] = 0; + onMemorySaveData.CharacterSkillPoint[(int)gamecharacterId] = 0; + onMemorySaveData.unlockedSkills.Clear(); + Dictionary promotedCount; + int key; + (promotedCount = onMemorySaveData.PromotedCount)[key = (int)gamecharacterId] = promotedCount[key] + 1; + onMemorySaveData.PlayerLevel++; + SaveAllData(); + } + } + } + } +} diff --git a/src/Fie.Manager/FieSceneManager.cs b/src/Fie.Manager/FieSceneManager.cs new file mode 100644 index 0000000..65472b0 --- /dev/null +++ b/src/Fie.Manager/FieSceneManager.cs @@ -0,0 +1,175 @@ +using Fie.Scene; +using System; +using System.Collections; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieSceneManager : FieManagerBehaviour + { + public class FieLoadingSceneJob + { + public bool allowSceneActivation; + + public bool isDoneLoading; + } + + public delegate void FiePreparedForLoadSceneDelegate(FieSceneBase targetScene); + + public delegate void FieSceneEventDelegate(); + + public FieSceneBase latestScene; + + private bool _isNowLoading; + + private bool isForceWaitingInLoadScreen; + + private FieLoadingSceneJob _currentLoadingJob; + + public bool isNowLoading => _isNowLoading; + + public FieLoadingSceneJob currentLoadingJob => _currentLoadingJob; + + public event FiePreparedForLoadSceneDelegate FiePreparedForLoadSceneEvent; + + public event FiePreparedForLoadSceneDelegate FieSceneWasLoadedEvent; + + protected override void StartUpEntity() + { + } + + private IEnumerator LoadSceneTask(FieSceneBase targetScene, FieFaderManager.FadeType fadeOutType, FieFaderManager.FadeType fadeInType, float fadeTime = 0.5f, bool useLoadScreen = false, float minFadeScreenViewSec = 0f) + { + if (targetScene != null && _currentLoadingJob != null) + { + _isNowLoading = true; + FieManagerBehaviour.I.isEnableControll = false; + FieSceneLink sceneInfo = targetScene.GetSceneLinkInfo(); + Application.backgroundLoadingPriority = ThreadPriority.Low; + AsyncOperation async = SceneManager.LoadSceneAsync((int)sceneInfo.linkedScene, LoadSceneMode.Single); + if (async != null) + { + async.allowSceneActivation = false; + if (async.progress < 0.9f) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + _currentLoadingJob.isDoneLoading = true; + if (!_currentLoadingJob.allowSceneActivation) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + if (fadeOutType != 0) + { + FieManagerBehaviour.I.InitializeFader(fadeOutType, fadeTime); + if (!FieManagerBehaviour.I.isEndUpdateFader()) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + if (useLoadScreen) + { + FieManagerBehaviour.I.ShowLoadScreen(minFadeScreenViewSec); + FieManagerBehaviour.I.InitializeFader(FieFaderManager.FadeType.IN_FROM_AUTOMATIC, fadeTime); + if (!FieManagerBehaviour.I.isEndUpdateFader()) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + if (!PhotonNetwork.offlineMode && PhotonNetwork.inRoom) + { + FieManagerBehaviour.I.SetMySceneId((int)sceneInfo.linkedScene); + bool isSameScene = false; + float waitingTime2 = 0f; + if (!isSameScene) + { + FieManagerBehaviour.I.CheckPlayerScenesIsSame(); + waitingTime2 += Time.deltaTime; + if (!(waitingTime2 > 60f)) + { + yield return (object)new WaitForSeconds(1f); + /*Error: Unable to find new state assignment for yield return*/; + } + } + } + FieManagerFactory.I.KillPopcornFxAll(); + if (this.FiePreparedForLoadSceneEvent == null) + { + async.allowSceneActivation = true; + latestScene = targetScene; + if (!async.isDone) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + yield return (object)new WaitForSeconds(0.5f); + /*Error: Unable to find new state assignment for yield return*/; + } + this.FiePreparedForLoadSceneEvent(targetScene); + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + } + } + + public bool isLobby() + { + if (latestScene == null) + { + return false; + } + FieSceneLink sceneLinkInfo = latestScene.GetSceneLinkInfo(); + return sceneLinkInfo.linkedScene == FieConstValues.DefinedScenes.FIE_LOBBY; + } + + public bool isTitle() + { + if (latestScene == null) + { + return false; + } + FieSceneLink sceneLinkInfo = latestScene.GetSceneLinkInfo(); + return sceneLinkInfo.linkedScene == FieConstValues.DefinedScenes.FIE_TITLE; + } + + public FieLoadingSceneJob LoadScene(FieSceneBase loadScene, bool allowSceneActivation = true) + { + return LoadScene(loadScene, allowSceneActivation, FieFaderManager.FadeType.NONE, FieFaderManager.FadeType.NONE); + } + + public FieLoadingSceneJob LoadScene(FieSceneBase loadScene, bool allowSceneActivation, FieFaderManager.FadeType fadeOutType, float fadeTime = 0.5f) + { + return LoadScene(loadScene, allowSceneActivation, fadeOutType, FieFaderManager.FadeType.IN_FROM_WHITE, fadeTime); + } + + public FieLoadingSceneJob LoadScene(FieSceneBase loadScene, bool allowSceneActivation, FieFaderManager.FadeType fadeOutType, FieFaderManager.FadeType fadeInType, float fadeTime = 0.5f, bool useFadeScreen = false, float minFadeScreenViewSec = 0f) + { + if (_isNowLoading) + { + return currentLoadingJob; + } + try + { + _currentLoadingJob = new FieLoadingSceneJob(); + _currentLoadingJob.allowSceneActivation = allowSceneActivation; + StartCoroutine(LoadSceneTask(loadScene, fadeOutType, fadeInType, fadeTime, useFadeScreen, minFadeScreenViewSec)); + } + catch (Exception ex) + { + Debug.Log(ex.Message); + } + return currentLoadingJob; + } + + private void SetForceWaitInLoadScreenFlag(bool forceWait) + { + isForceWaitingInLoadScreen = forceWait; + } + } +} diff --git a/src/Fie.Manager/FieUserManager.cs b/src/Fie.Manager/FieUserManager.cs new file mode 100644 index 0000000..6881794 --- /dev/null +++ b/src/Fie.Manager/FieUserManager.cs @@ -0,0 +1,510 @@ +using Fie.Object; +using Fie.User; +using Fie.Utility; +using GameDataEditor; +using System.Collections.Generic; +using System.Security.Cryptography; +using System.Text; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieUserManager : FieManagerBehaviour + { + public delegate void UserNumChangeDelegate(int beforeNum, int afterNum); + + public const int MAXIMUM_PLAYER_NUM = 3; + + private FieUser[] _userDatas = new FieUser[3]; + + private Dictionary _userNumCache = new Dictionary(); + + private int _nowPlayerNum; + + private int _myPlayerNumber; + + private string _myHash; + + private string _myName; + + public string myHash => _myHash; + + public string myName => myName; + + public int myPlayerNumber => _myPlayerNumber; + + public int nowPlayerNum + { + get + { + return _nowPlayerNum; + } + set + { + int nowPlayerNum = _nowPlayerNum; + _nowPlayerNum = Mathf.Min(Mathf.Max(1, value), 3); + if (nowPlayerNum != _nowPlayerNum && this.UserNumChangeEvent != null) + { + this.UserNumChangeEvent(nowPlayerNum, _nowPlayerNum); + _userNumCache = new Dictionary(); + } + } + } + + public FieGameCharacter gameOwnerCharacter + { + get + { + if (this == null) + { + return null; + } + if (_userDatas == null) + { + return null; + } + if (_userDatas[myPlayerNumber] == null) + { + return null; + } + return _userDatas[_myPlayerNumber].usersCharacter; + } + } + + public event UserNumChangeDelegate UserNumChangeEvent; + + public FieUser[] getAllUserData() + { + return _userDatas; + } + + public FieUser RegistUser(PhotonPlayer player) + { + if (_nowPlayerNum >= 3) + { + return null; + } + string text = GenerateUserHashByPlayerInfo(player); + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (fieUser.userHash != null && fieUser.userHash == text) + { + return fieUser; + } + } + int num = 0; + FieUser[] userDatas2 = _userDatas; + foreach (FieUser fieUser2 in userDatas2) + { + if (fieUser2.playerInfo == null) + { + break; + } + num++; + } + string nickName = player.NickName; + _userDatas[num].playerInfo = player; + _userDatas[num].userHash = text; + _userDatas[num].userName = ((!(player.NickName == string.Empty)) ? player.NickName : GetDefaultName(num)); + int num2 = 0; + FieUser[] userDatas3 = _userDatas; + foreach (FieUser fieUser3 in userDatas3) + { + if (fieUser3.playerInfo != null) + { + num2++; + } + } + if (PhotonNetwork.player.ID == player.ID) + { + SetMyHash(text); + } + nowPlayerNum = num2; + int num3 = 0; + FieUser[] userDatas4 = _userDatas; + foreach (FieUser fieUser4 in userDatas4) + { + if (fieUser4.userHash == _myHash) + { + _myPlayerNumber = num3; + } + num3++; + } + return _userDatas[num]; + } + + public void UnregistUser(PhotonPlayer player) + { + if (player != null && _nowPlayerNum > 0) + { + string text = GenerateUserHashByPlayerInfo(player); + bool flag = false; + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (fieUser.userHash == text) + { + flag = true; + break; + } + } + if (flag) + { + _userDatas[FieManagerBehaviour.I.getUserNumberByHash(text)] = new FieUser(); + } + int num = 0; + FieUser[] userDatas2 = _userDatas; + foreach (FieUser fieUser2 in userDatas2) + { + if (fieUser2.playerInfo != null) + { + num++; + } + } + nowPlayerNum = num; + } + } + + public FieUser GetUserData(int userNumber) + { + if (!ValidateUserNumber(userNumber)) + { + return null; + } + return _userDatas[userNumber]; + } + + public FieUser GetUserData(PhotonPlayer playerInfo) + { + string b = GenerateUserHashByPlayerInfo(playerInfo); + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (fieUser.userHash != null && fieUser.userHash == b) + { + return fieUser; + } + } + return null; + } + + public int getUserNumberByHash(string hash) + { + if (_userNumCache.ContainsKey(hash)) + { + return _userNumCache[hash]; + } + int result = -1; + for (int i = 0; i < _userDatas.Length; i++) + { + if (_userDatas[i].userHash == hash) + { + result = i; + _userNumCache[_userDatas[i].userHash] = i; + break; + } + } + return result; + } + + protected override void StartUpEntity() + { + InitializeUserData(); + } + + public void RemoveUser(PhotonPlayer targetPlayer) + { + if (targetPlayer != null) + { + for (int i = 0; i < _userDatas.Length; i++) + { + if (_userDatas[i].playerInfo != null && _userDatas[i].playerInfo.ID == targetPlayer.ID) + { + _userDatas[i] = new FieUser(); + _userDatas[i].userHash = string.Empty; + _userDatas[i].userName = string.Empty; + _userDatas[i].usersCharacterPrefab = null; + _userDatas[i].usersCharacter = null; + } + } + } + } + + public void CleanupUserData(bool narrowDistance = false) + { + if (PhotonNetwork.connected && PhotonNetwork.room != null) + { + for (int i = 0; i < _userDatas.Length; i++) + { + if (_userDatas[i] != null && _userDatas[i].playerInfo == null) + { + _userDatas[i] = new FieUser(); + _userDatas[i].userHash = string.Empty; + _userDatas[i].userName = string.Empty; + _userDatas[i].usersCharacterPrefab = null; + _userDatas[i].usersCharacter = null; + } + } + if (narrowDistance) + { + FieUser[] array = new FieUser[3]; + for (int j = 0; j < array.Length; j++) + { + array[j] = new FieUser(); + array[j].userHash = string.Empty; + array[j].userName = string.Empty; + array[j].usersCharacterPrefab = null; + array[j].usersCharacter = null; + } + int num = 0; + for (int k = 0; k < _userDatas.Length; k++) + { + if (_userDatas[k] != null && _userDatas[k].playerInfo != null) + { + array[num] = _userDatas[k]; + num++; + } + } + _userDatas = array; + } + int num2 = 0; + for (int l = 0; l < _userDatas.Length; l++) + { + if (_userDatas[l] != null && _userDatas[l].playerInfo != null) + { + _userDatas[l].userName = ((!(_userDatas[l].playerInfo.NickName == string.Empty)) ? _userDatas[l].playerInfo.NickName : GetDefaultName(l)); + num2++; + } + } + nowPlayerNum = num2; + } + } + + public void SetMyHash(string hash) + { + _myHash = hash; + } + + public string GenerateUserHash() + { + string str = Random.Range(-2147483648, 2147483647).ToString(); + string str2 = Random.Range(-2147483648, 2147483647).ToString(); + string str3 = Random.Range(-2147483648, 2147483647).ToString(); + return CalcMd5(str + str2 + str3); + } + + public string GenerateUserHashByPlayerInfo(PhotonPlayer playerInfo) + { + return CalcMd5(playerInfo.ID.ToString()); + } + + public string GetUserName(int userNumber) + { + if (!ValidateUserNumber(userNumber)) + { + return string.Empty; + } + return _userDatas[userNumber].userName; + } + + public void SetUserName(int userNumber, string userName) + { + if (ValidateUserNumber(userNumber)) + { + _userDatas[userNumber].userName = userName; + } + } + + public void SetMyName(string name) + { + _myName = name; + if (PhotonNetwork.player != null) + { + PhotonNetwork.player.NickName = _myName; + } + for (int i = 0; i < 3; i++) + { + if (_userDatas[i] != null && _userDatas[i].playerInfo != null && _userDatas[i].playerInfo.ID == PhotonNetwork.player.ID) + { + _userDatas[i].userName = _myName; + } + } + } + + public FieGameCharacter GetUserCharacterPrefab(int userNumber) + { + if (!ValidateUserNumber(userNumber)) + { + return null; + } + return _userDatas[userNumber].usersCharacterPrefab; + } + + public void SetUserCharacterPrefab(int userNumber, FieGameCharacter userCharacterPrefab) + { + if (ValidateUserNumber(userNumber)) + { + _userDatas[userNumber].usersCharacterPrefab = userCharacterPrefab; + } + } + + public FieGameCharacter GetUserCharacter(int userNumber) + { + if (!ValidateUserNumber(userNumber)) + { + return null; + } + return _userDatas[userNumber].usersCharacter; + } + + public void SetUserCharacter(int userNumber, FieGameCharacter userCharacter) + { + if (ValidateUserNumber(userNumber)) + { + _userDatas[userNumber].usersCharacter = userCharacter; + if (userCharacter != null) + { + userCharacter.forces = FieEmittableObjectBase.EmitObjectTag.PLAYER; + } + if (_userDatas[userNumber].playerInfo != null && _userDatas[userNumber].playerInfo.IsLocal) + { + FieManagerBehaviour.I.SetPlyaersGameCharacterInfoToNetwork(_userDatas[userNumber], userCharacter); + } + } + } + + public void ValidateUserName(int playerNumber) + { + if (_userDatas[playerNumber].userName == string.Empty) + { + _userDatas[playerNumber].userName = GetDefaultName(playerNumber); + } + } + + public void InitializeUserData() + { + for (int i = 0; i < 3; i++) + { + if (_userDatas[i] == null) + { + _userDatas[i] = new FieUser(); + _userDatas[i].userHash = string.Empty; + _userDatas[i].userName = string.Empty; + _userDatas[i].usersCharacterPrefab = null; + _userDatas[i].usersCharacter = null; + } + } + } + + public bool AmIHost() + { + if (!PhotonNetwork.connected || PhotonNetwork.room == null || PhotonNetwork.playerList == null || PhotonNetwork.playerList.Length <= 0) + { + return true; + } + if (PhotonNetwork.masterClient.ID == PhotonNetwork.player.ID) + { + return true; + } + return false; + } + + public string GetDefaultName(int playerNumber) + { + return "Player " + (playerNumber + 1).ToString(); + } + + public List GetAllPlayerCharacters() where T : FieGameCharacter + { + if (_userDatas == null || _userDatas.Length <= 0) + { + return null; + } + List list = new List(); + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (fieUser != null) + { + T val = fieUser.usersCharacter as T; + if (!((UnityEngine.Object)val == (UnityEngine.Object)null) && !(val.detector.friendTag != "Player")) + { + list.Add(val); + } + } + } + return list; + } + + public FieGameCharacter GetExistingGameCharacterRandom(GDEGameCharacterTypeData gameCharacterType) + { + if (gameCharacterType == null) + { + return null; + } + if (_nowPlayerNum <= 0) + { + return null; + } + Lottery lottery = new Lottery(); + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (fieUser != null && fieUser.usersCharacter != null && fieUser.usersCharacter.getCharacterTypeData().Key == gameCharacterType.Key) + { + lottery.AddItem(fieUser.usersCharacter); + } + } + if (!lottery.IsExecutable()) + { + return null; + } + return lottery.Lot(); + } + + public void AddFriendshipPointToOtherPlayer(FieGameCharacter gainedCharacter, float friendhsip) + { + FieUser[] userDatas = _userDatas; + foreach (FieUser fieUser in userDatas) + { + if (!(fieUser.usersCharacter == null) && fieUser.usersCharacter.GetInstanceID() != gainedCharacter.GetInstanceID() && fieUser.usersCharacter != null) + { + if (fieUser.usersCharacter.photonView == null || fieUser.usersCharacter.photonView.isMine) + { + fieUser.usersCharacter.friendshipStats.safeAddFriendship(friendhsip, triggerEvent: false); + } + else + { + object[] parameters = new object[1] + { + friendhsip + }; + fieUser.usersCharacter.photonView.RPC("AddFriendshipRPC", PhotonTargets.Others, parameters); + } + } + } + } + + private bool ValidateUserNumber(int number) + { + return number >= 0 && number < 3; + } + + public string CalcMd5(string srcStr) + { + MD5 mD = MD5.Create(); + byte[] bytes = Encoding.UTF8.GetBytes(srcStr); + byte[] array = mD.ComputeHash(bytes); + StringBuilder stringBuilder = new StringBuilder(); + byte[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + byte b = array2[i]; + stringBuilder.Append(b.ToString("x2")); + } + return stringBuilder.ToString(); + } + } +} diff --git a/src/Fie.Manager/FieVibrationManager.cs b/src/Fie.Manager/FieVibrationManager.cs new file mode 100644 index 0000000..5f17378 --- /dev/null +++ b/src/Fie.Manager/FieVibrationManager.cs @@ -0,0 +1,82 @@ +using Fie.Object; +using Rewired; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Manager +{ + [FieManagerExists(FieManagerExistSceneFlag.NEVER_DESTROY)] + public sealed class FieVibrationManager : FieManagerBehaviour + { + private const int DEFAULT_CONTROLLER_INDEX = 0; + + private const float VIBRATION_SIN_WAVE_SPEED_PER_SEC = 360f; + + private const float VIBRATION_THRESHOLD_SMALL = 0.01f; + + private const float VIBRATION_THRESHOLD_MIDDLE = 0.25f; + + private const float VIBRATION_THRESHOLD_LARGE = 0.5f; + + private Dictionary _currentCoroutines = new Dictionary(); + + private IEnumerator VibrationCoroutine(int controllerIndex, float duration, float force) + { + int targetControllerIndex = Mathf.Clamp(controllerIndex, 0, 3); + float sinRate = 0f; + if (duration > 0f) + { + SetVibration(targetControllerIndex, Mathf.Sin(sinRate) * force, Mathf.Sin(sinRate + 45f) * force); + float num = sinRate + 360f * Time.deltaTime; + float num2 = duration - Time.deltaTime; + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + SetVibration(targetControllerIndex, 0f, 0f); + } + + protected override void StartUpEntity() + { + if (FieManagerBehaviour.I.gameOwnerCharacter != null) + { + FieManagerBehaviour.I.gameOwnerCharacter.damageSystem.damagedEvent -= DamageCallbackForVibration; + FieManagerBehaviour.I.gameOwnerCharacter.damageSystem.damagedEvent += DamageCallbackForVibration; + } + } + + private void DamageCallbackForVibration(FieGameCharacter attacker, FieDamage damage) + { + if (damage.damage > 0f) + { + RequestVibration(0.4f, 1f); + } + } + + public void RequestVibration(float duration, float force) + { + int num = 0; + if (_currentCoroutines.ContainsKey(num) && _currentCoroutines[num] != null) + { + StopCoroutine(_currentCoroutines[num]); + _currentCoroutines[num] = null; + } + Coroutine value = StartCoroutine(VibrationCoroutine(num, duration, Mathf.Clamp(force, 0f, 1f))); + _currentCoroutines[num] = value; + } + + private void OnApplicationQuit() + { + int controllerId = 0; + SetVibration(controllerId, 0f, 0f); + } + + private void SetVibration(int controllerId, float leftMoterForce, float rightMoterForce) + { + foreach (Joystick joystick in FieManagerBehaviour.I.GetPlayer(controllerId).controllers.Joysticks) + { + joystick.SetVibration(leftMoterForce, rightMoterForce); + } + } + } +} diff --git a/src/Fie.Object.Abilities/FieAbilitiesContainer.cs b/src/Fie.Object.Abilities/FieAbilitiesContainer.cs new file mode 100644 index 0000000..7f17e35 --- /dev/null +++ b/src/Fie.Object.Abilities/FieAbilitiesContainer.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object.Abilities +{ + public class FieAbilitiesContainer + { + public delegate bool ActivateCheckCallback(FieGameCharacter gameCharacter); + + private FieGameCharacter ownerCharacter; + + private Dictionary _abilitiesList = new Dictionary(); + + private Dictionary _abilitiesTypes = new Dictionary(); + + private Dictionary _abilitiesEntities = new Dictionary(); + + private Dictionary _activationCheckCallbacks = new Dictionary(); + + private Dictionary _abilitiesCooldownController = new Dictionary(); + + public FieAbilitiesContainer(FieGameCharacter owner) + { + ownerCharacter = owner; + } + + public void UpdateCooldown(float deltaTime) + { + foreach (KeyValuePair item in _abilitiesCooldownController) + { + item.Value.Update(deltaTime); + } + } + + public float GetCooltime() where T : FieStateMachineAbilityInterface + { + if (!_abilitiesCooldownController.ContainsKey(typeof(T))) + { + return 3.40282347E+38f; + } + return _abilitiesCooldownController[typeof(T)].cooldown; + } + + public float GetCooltime(FieAbilitiesSlot.SlotType slot) + { + if (!_abilitiesList.ContainsKey(slot)) + { + return 3.40282347E+38f; + } + if (!_abilitiesCooldownController.ContainsKey(_abilitiesList[slot])) + { + return 3.40282347E+38f; + } + return _abilitiesCooldownController[_abilitiesList[slot]].cooldown; + } + + public FieAbilitiesCooldown GetCooldownController(FieAbilitiesSlot.SlotType slot) + { + if (!_abilitiesList.ContainsKey(slot)) + { + return null; + } + if (!_abilitiesCooldownController.ContainsKey(_abilitiesList[slot])) + { + return null; + } + return _abilitiesCooldownController[_abilitiesList[slot]]; + } + + public float SetCooldown(float coolTime) where T : FieStateMachineAbilityBase + { + if (!_abilitiesCooldownController.ContainsKey(typeof(T))) + { + return 3.40282347E+38f; + } + if (ownerCharacter == null) + { + return 3.40282347E+38f; + } + float num = coolTime; + if (ownerCharacter != null && ownerCharacter.unlockedSkills != null && ownerCharacter.unlockedSkills.Length > 0) + { + FieAbilityIDAttribute fieAbilityIDAttribute = (FieAbilityIDAttribute)Attribute.GetCustomAttribute(typeof(T), typeof(FieAbilityIDAttribute)); + if (fieAbilityIDAttribute != null) + { + for (int i = 0; i < ownerCharacter.unlockedSkills.Length; i++) + { + if (ownerCharacter.unlockedSkills[i].Ability.ID == (int)fieAbilityIDAttribute.abilityID) + { + int iD = ownerCharacter.unlockedSkills[i].SkillType.ID; + if (iD == 2) + { + num += coolTime * ownerCharacter.unlockedSkills[i].Value1; + } + } + } + } + } + num = Mathf.Max(num, 0f); + float num2 = num; + _abilitiesCooldownController[typeof(T)].cooldown = num2; + return num2; + } + + public void IncreaseOrReduceCooldownAll(float cooltime) + { + if (_abilitiesCooldownController != null && _abilitiesCooldownController.Count > 0) + { + foreach (KeyValuePair item in _abilitiesCooldownController) + { + item.Value.cooldown = Mathf.Max(0f, item.Value.cooldown + cooltime); + } + } + } + + public void AssignAbility(FieAbilitiesSlot.SlotType slot, FieStateMachineAbilityInterface abilityInstance, bool isForceAssign = false) + { + if (abilityInstance != null) + { + if (_abilitiesList.ContainsKey(slot) && isForceAssign) + { + _abilitiesList.Remove(slot); + } + _abilitiesList[slot] = abilityInstance.GetType(); + _abilitiesTypes[abilityInstance.GetType()] = true; + _abilitiesEntities[abilityInstance.GetType()] = abilityInstance; + _abilitiesCooldownController[abilityInstance.GetType()] = new FieAbilitiesCooldown(); + } + } + + public Type getAbility(FieAbilitiesSlot.SlotType slot) + { + if (_abilitiesList.ContainsKey(slot)) + { + return _abilitiesList[slot]; + } + return null; + } + + public bool isAbility(Type type) + { + if (_abilitiesTypes.ContainsKey(type)) + { + return true; + } + return false; + } + + public void setActivationCallback(Type type, ActivateCheckCallback callback) + { + if (_abilitiesTypes.ContainsKey(type)) + { + _activationCheckCallbacks[type] = callback; + } + } + + public bool checkToActivate(FieGameCharacter gameCharacter, Type type) + { + if (gameCharacter == null || !_abilitiesEntities.ContainsKey(type)) + { + return false; + } + switch (_abilitiesEntities[type].getActivationType()) + { + case FieAbilityActivationType.COOLDOWN: + return _abilitiesCooldownController[type].cooldown <= 0f; + case FieAbilityActivationType.SPECEFIC_METHOD: + { + Type type2 = _abilitiesEntities[type].GetType(); + if (_activationCheckCallbacks.ContainsKey(type2)) + { + return _activationCheckCallbacks[type2](gameCharacter); + } + break; + } + } + return false; + } + + internal void ResetAllCoolDown() + { + foreach (KeyValuePair item in _abilitiesCooldownController) + { + item.Value.cooldown = 0f; + } + } + } +} diff --git a/src/Fie.Object.Abilities/FieAbilitiesCooldown.cs b/src/Fie.Object.Abilities/FieAbilitiesCooldown.cs new file mode 100644 index 0000000..2186842 --- /dev/null +++ b/src/Fie.Object.Abilities/FieAbilitiesCooldown.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace Fie.Object.Abilities +{ + public class FieAbilitiesCooldown + { + public delegate void CooldownCompleteDelegate(); + + public delegate void CooldownChangeDelegate(float before, float after); + + private bool _isEndCooldown = true; + + private float _cooldown; + + public float cooldown + { + get + { + return _cooldown; + } + set + { + float num = Mathf.Max(0f, value); + if (_cooldown != value && this.cooldownChangeEvent != null) + { + this.cooldownChangeEvent(_cooldown, num); + } + _cooldown = num; + if (_cooldown > 0f) + { + _isEndCooldown = false; + } + } + } + + public bool canUseAbility => _cooldown <= 0f; + + public event CooldownCompleteDelegate cooldownCompleteEvent; + + public event CooldownChangeDelegate cooldownChangeEvent; + + public void Update(float time) + { + if (!_isEndCooldown) + { + _cooldown = Mathf.Max(_cooldown - time, 0f); + if (_cooldown <= 0f) + { + if (this.cooldownCompleteEvent != null) + { + this.cooldownCompleteEvent(); + } + _isEndCooldown = true; + } + } + } + } +} diff --git a/src/Fie.Object.Abilities/FieAbilitiesSlot.cs b/src/Fie.Object.Abilities/FieAbilitiesSlot.cs new file mode 100644 index 0000000..a485c68 --- /dev/null +++ b/src/Fie.Object.Abilities/FieAbilitiesSlot.cs @@ -0,0 +1,13 @@ +namespace Fie.Object.Abilities +{ + public class FieAbilitiesSlot + { + public enum SlotType + { + SLOT_1, + SLOT_2, + SLOT_3, + MAX_SLOT_NUM + } + } +} diff --git a/src/Fie.Object/FieAbilityActivationType.cs b/src/Fie.Object/FieAbilityActivationType.cs new file mode 100644 index 0000000..000b813 --- /dev/null +++ b/src/Fie.Object/FieAbilityActivationType.cs @@ -0,0 +1,8 @@ +namespace Fie.Object +{ + public enum FieAbilityActivationType + { + COOLDOWN, + SPECEFIC_METHOD + } +} diff --git a/src/Fie.Object/FieAbilityIDAttribute.cs b/src/Fie.Object/FieAbilityIDAttribute.cs new file mode 100644 index 0000000..2894607 --- /dev/null +++ b/src/Fie.Object/FieAbilityIDAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Fie.Object +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class FieAbilityIDAttribute : Attribute + { + public readonly FieConstValues.FieAbility abilityID; + + public FieAbilityIDAttribute(FieConstValues.FieAbility abilityID) + { + this.abilityID = abilityID; + } + } +} diff --git a/src/Fie.Object/FieAnimationContainerBase.cs b/src/Fie.Object/FieAnimationContainerBase.cs new file mode 100644 index 0000000..54334d6 --- /dev/null +++ b/src/Fie.Object/FieAnimationContainerBase.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Fie.Object +{ + public abstract class FieAnimationContainerBase + { + public enum BaseAnimTrack + { + MOTION, + EMOTION, + MAX_BASE_TRACK + } + + public enum BaseAnimList + { + IDLE, + MAX_BASE_ANIMATION + } + + private Dictionary animationList = new Dictionary(); + + public Dictionary getAnimationList() + { + return animationList; + } + + public FieSkeletonAnimationObject getAnimation(int animationId) + { + if (animationList.ContainsKey(animationId)) + { + return null; + } + return animationList[animationId]; + } + + public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject) + { + animationList.Add(animationID, animationObject); + } + } +} diff --git a/src/Fie.Object/FieAttribute.cs b/src/Fie.Object/FieAttribute.cs new file mode 100644 index 0000000..1061397 --- /dev/null +++ b/src/Fie.Object/FieAttribute.cs @@ -0,0 +1,10 @@ +namespace Fie.Object +{ + public enum FieAttribute + { + NONE, + MAGIC, + WING, + EARTH + } +} diff --git a/src/Fie.Object/FieDamage.cs b/src/Fie.Object/FieDamage.cs new file mode 100644 index 0000000..0f571d8 --- /dev/null +++ b/src/Fie.Object/FieDamage.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace Fie.Object +{ + [Serializable] + public class FieDamage + { + public enum FieAttributeDamageState + { + DEFAULT, + EFFECTIVE, + NONEFFECTIVE + } + + public const float DEFAULT_DAMAGE_FLUCTUATING_RATE = 0.05f; + + public FieAttribute attribute; + + public FieAttributeDamageState attributeDamageState; + + public float damage; + + public float finallyDamage; + + public float stagger; + + public float hate; + + public float fluctuatingRate; + + public List statusEffects = new List(); + + public FieDamage() + { + attributeDamageState = FieAttributeDamageState.DEFAULT; + attribute = FieAttribute.NONE; + damage = (stagger = (hate = 0f)); + fluctuatingRate = 0.05f; + finallyDamage = 0f; + } + + public FieDamage(FieAttribute initAttribute, float initDamage, float initStagger, float initHate, float initFluctuatingRate, List statusEffects) + { + attributeDamageState = FieAttributeDamageState.DEFAULT; + attribute = initAttribute; + damage = initDamage; + stagger = initStagger; + hate = initHate; + fluctuatingRate = initFluctuatingRate; + finallyDamage = 0f; + this.statusEffects = statusEffects; + } + + public FieDamage(float initStagger, float initHate) + { + attributeDamageState = FieAttributeDamageState.DEFAULT; + attribute = FieAttribute.NONE; + stagger = initStagger; + hate = initHate; + damage = 0f; + fluctuatingRate = 0.05f; + finallyDamage = 0f; + } + } +} diff --git a/src/Fie.Object/FieDamageSystem.cs b/src/Fie.Object/FieDamageSystem.cs new file mode 100644 index 0000000..47be1ee --- /dev/null +++ b/src/Fie.Object/FieDamageSystem.cs @@ -0,0 +1,646 @@ +using Fie.Manager; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public class FieDamageSystem : MonoBehaviour + { + public struct DamageMagniContainer + { + public int abilityID; + + public float magni; + + public DamageMagniContainer(int abilityID, float magni) + { + this.abilityID = abilityID; + this.magni = magni; + } + } + + public delegate void ReviveDelegate(); + + public delegate void DeathDelegate(FieGameCharacter killer, FieDamage damage); + + public delegate void StaggerDelegate(FieDamage damage); + + public delegate bool DamageCheckDelegate(FieGameCharacter attacker, FieDamage damage); + + public delegate void BeforeDamageDelegate(FieGameCharacter attacker, ref FieDamage damage); + + public delegate void DamageDelegate(FieGameCharacter attacker, FieDamage damage); + + public delegate void StatusEffectDelegate(FieStatusEffectEntityBase statusEffect, FieGameCharacter attacker, FieDamage damage); + + public const float HITPOINT_GATE_RATE = 0.05f; + + public const float HITPOINT_GATE_DELAY = 12f; + + public const float HITPOINT_GATE_IMMUNITY_SEC = 0.3f; + + public const float SHIELD_GATE_DELAY = 8f; + + public const float DEFAULT_DYING_SEC = 12f; + + public const float DEFAULT_REVIVE_SEC = 3f; + + private Dictionary _statusEffectCallbacks = new Dictionary(); + + private FieGameCharacter _ownerCharacter; + + private FieGameCharacter _latestPerpetrator; + + private FieDamage _latestDamage; + + private FieHealthStats _healthStats = new FieHealthStats(); + + private FieHealthStats _healthStatsSandbox = new FieHealthStats(); + + private bool _isDead; + + private float _dyingCount; + + private float _reviveCount; + + private float _currentRegenerateDelay; + + private float _hitPointGateDelay; + + private float _hitPointGateImunitySec; + + private float _shieldGateDelay; + + private bool _isEnableRegenerate = true; + + private bool _isEnableHitPointGate = true; + + private bool _isEnableShieldGate = true; + + private bool _isEnableHealthImmunity; + + private bool _isEnableStaggerImmunity; + + private bool _revivable; + + private float _dyingNeedSec = 12f; + + private float _reviveNeedSec = 3f; + + private Dictionary> _attackMagniStack = new Dictionary>(); + + private Dictionary> _defenceMagniStack = new Dictionary>(); + + private Dictionary _takenDamages = new Dictionary(); + + private FieHealthStats healthStats + { + get + { + if (_ownerCharacter == null || _ownerCharacter.photonView == null || !_ownerCharacter.photonView.isMine) + { + return _healthStatsSandbox; + } + return _healthStats; + } + } + + public bool isEnableRegenerate + { + get + { + return _isEnableRegenerate; + } + set + { + _isEnableRegenerate = value; + } + } + + public bool isEnableHitPointGate + { + get + { + return _isEnableHitPointGate; + } + set + { + _isEnableHitPointGate = value; + } + } + + public bool isEnableShieldGate + { + get + { + return _isEnableShieldGate; + } + set + { + _isEnableShieldGate = value; + } + } + + public bool isEnableHealthImmunity + { + get + { + return _isEnableHealthImmunity; + } + set + { + _isEnableHealthImmunity = value; + } + } + + public bool isEnableStaggerImmunity + { + get + { + return _isEnableStaggerImmunity; + } + set + { + _isEnableStaggerImmunity = value; + } + } + + public float dyingNeedSec + { + get + { + return _dyingNeedSec; + } + set + { + _dyingNeedSec = Mathf.Max(value, 0f); + } + } + + public float reviveNeedSec + { + get + { + return _reviveNeedSec; + } + set + { + _reviveNeedSec = Mathf.Max(value, 0f); + } + } + + public bool isDying + { + get + { + if (healthStats == null) + { + return true; + } + return healthStats.hitPoint <= 0f; + } + } + + public bool isDead => _isDead; + + public bool revivable + { + get + { + return _revivable; + } + set + { + if (_revivable != value) + { + _reviveCount = 0f; + _revivable = value; + } + } + } + + public Dictionary takenDamage => _takenDamages; + + public event DeathDelegate deathEvent; + + public event ReviveDelegate reviveEvent; + + public event StaggerDelegate staggerEvent; + + public event DamageCheckDelegate damageCheckEvent; + + public event BeforeDamageDelegate beforeDamageEvent; + + public event DamageDelegate damagedEvent; + + private IEnumerator addAttackMagniStackCoroutine(int skillID, int abilityID, float magni, float duration, bool isEnableStack = false) + { + if (!_attackMagniStack.ContainsKey(skillID) || _attackMagniStack[skillID] == null) + { + _attackMagniStack[skillID] = new Queue(); + } + int stackedCount = _attackMagniStack[skillID].Count; + if (stackedCount > 0 && !isEnableStack) + { + if (stackedCount == 1) + { + _attackMagniStack[skillID].Dequeue(); + } + else + { + _attackMagniStack[skillID].Clear(); + } + } + _attackMagniStack[skillID].Enqueue(new DamageMagniContainer(abilityID, magni)); + yield return (object)new WaitForSeconds(duration); + /*Error: Unable to find new state assignment for yield return*/; + } + + private IEnumerator addDefenceMagniStackCoroutine(int skillID, float magni, float duration, bool isEnableStack = false) + { + if (!_defenceMagniStack.ContainsKey(skillID) || _defenceMagniStack[skillID] == null) + { + _defenceMagniStack[skillID] = new Queue(); + } + int stackedCount = _defenceMagniStack[skillID].Count; + if (stackedCount > 0 && !isEnableStack) + { + if (stackedCount == 1) + { + _defenceMagniStack[skillID].Dequeue(); + } + else + { + _defenceMagniStack[skillID].Clear(); + } + } + _defenceMagniStack[skillID].Enqueue(magni); + yield return (object)new WaitForSeconds(duration); + /*Error: Unable to find new state assignment for yield return*/; + } + + public void AddAttackMagni(int skillID, float magni, float duration, int abilityID = -1, bool isEnableStack = false) + { + StartCoroutine(addAttackMagniStackCoroutine(skillID, abilityID, magni, duration, isEnableStack)); + } + + public void AddDefenceMagni(int skillID, float magni, float duration, bool isEnableStack = false) + { + StartCoroutine(addDefenceMagniStackCoroutine(skillID, magni, duration, isEnableStack)); + } + + public float GetAttackMagni(int abilityID = -1) + { + float num = 0f; + if (_attackMagniStack == null || _attackMagniStack.Count <= 0) + { + return num; + } + foreach (KeyValuePair> item in _attackMagniStack) + { + if (item.Value != null && item.Value.Count > 0) + { + foreach (DamageMagniContainer item2 in item.Value) + { + DamageMagniContainer current2 = item2; + if (current2.abilityID == abilityID || current2.abilityID == -1) + { + num += current2.magni; + } + } + } + } + return num; + } + + public float GetDeffenceMagni() + { + float num = 0f; + if (_defenceMagniStack == null || _defenceMagniStack.Count <= 0) + { + return num; + } + foreach (KeyValuePair> item in _defenceMagniStack) + { + if (item.Value != null && item.Value.Count > 0) + { + foreach (float item2 in item.Value) + { + num += item2; + } + } + } + return num; + } + + public void Regen(float regenPoint) + { + if (healthStats.shield <= 0f) + { + float num = Mathf.Clamp(healthStats.hitPoint + regenPoint, 0f, healthStats.maxHitPoint); + regenPoint -= num - healthStats.hitPoint; + healthStats.hitPoint = num; + } + healthStats.shield = Mathf.Clamp(healthStats.shield + regenPoint, 0f, healthStats.maxShield); + } + + public void initHealthSystem(FieGameCharacter ownerCharacter, ref FieHealthStats parameters) + { + _ownerCharacter = ownerCharacter; + _healthStats = parameters; + resetHealthSystem(); + } + + public void resetHealthSystem() + { + healthStats.hitPoint = healthStats.maxHitPoint; + healthStats.shield = healthStats.maxShield; + _isEnableRegenerate = true; + _isEnableHitPointGate = true; + _isEnableShieldGate = true; + _isEnableHealthImmunity = false; + _isEnableStaggerImmunity = false; + _revivable = false; + _isDead = false; + _dyingCount = 0f; + _reviveCount = 0f; + _currentRegenerateDelay = 0f; + _hitPointGateDelay = 0f; + _hitPointGateImunitySec = 0f; + _shieldGateDelay = 0f; + _dyingNeedSec = 12f; + _reviveNeedSec = 3f; + } + + public void calcHitPoitDirect(float additionalHitpoint) + { + if (!(_ownerCharacter.photonView != null) || _ownerCharacter.photonView.isMine) + { + healthStats.hitPoint += additionalHitpoint; + healthStats.hitPoint = Mathf.Max(Mathf.Min(healthStats.hitPoint, healthStats.maxHitPoint), 0f); + } + } + + public void calcShieldDirect(float additionalShield) + { + if (!(_ownerCharacter.photonView != null) || _ownerCharacter.photonView.isMine) + { + healthStats.shield += additionalShield; + healthStats.shield = Mathf.Max(Mathf.Min(healthStats.shield, healthStats.maxShield), 0f); + } + } + + public void setRegenerateDelay(float delayTime, bool roundToBigger = false) + { + if (!roundToBigger || !(delayTime < _currentRegenerateDelay)) + { + _currentRegenerateDelay = Mathf.Max(delayTime, 0f); + } + } + + public void ResetStaggerEvent() + { + this.staggerEvent = null; + } + + public void updateHealthSystem(float time) + { + if (isDying) + { + if (!_isDead) + { + _isDead = true; + if (this.deathEvent != null) + { + this.deathEvent(_latestPerpetrator, _latestDamage); + } + } + } + else + { + if (healthStats.stagger > 0f) + { + healthStats.stagger -= healthStats.staggerResistance * healthStats.staggerAttenuationPerSec * time; + healthStats.stagger = Mathf.Max(healthStats.stagger, 0f); + } + if (_hitPointGateImunitySec > 0f) + { + _hitPointGateImunitySec -= time; + } + if (_hitPointGateDelay > 0f) + { + _hitPointGateDelay -= time; + } + if (_shieldGateDelay > 0f) + { + _shieldGateDelay -= time; + } + if (_currentRegenerateDelay > 0f) + { + _currentRegenerateDelay -= time; + } + else if (_isEnableRegenerate) + { + if (healthStats.hitPoint < healthStats.maxHitPoint) + { + healthStats.hitPoint += healthStats.maxHitPoint * healthStats.hitPointRegeneratePerSec * time; + } + if (healthStats.hitPoint >= healthStats.maxHitPoint && healthStats.shield < healthStats.maxShield) + { + healthStats.shield += healthStats.maxShield * healthStats.shieldRegeneratePerSec * time; + } + healthStats.hitPoint = Mathf.Min(healthStats.hitPoint, healthStats.maxHitPoint); + healthStats.shield = Mathf.Min(healthStats.shield, healthStats.maxShield); + } + } + } + + public FieDamageSystem addDamage(FieGameCharacter attacker, FieDamage damageObject, bool isPenetration = false) + { + if (damageObject == null) + { + return this; + } + bool flag = false; + if (this.damageCheckEvent != null && !this.damageCheckEvent(attacker, damageObject)) + { + return this; + } + if (damageObject.statusEffects != null) + { + foreach (FieStatusEffectEntityBase statusEffect in damageObject.statusEffects) + { + flag |= statusEffect.ApplyStatusEffect(this, attacker, damageObject); + } + } + if (flag) + { + return this; + } + damageObject.damage *= Mathf.Max(0f, 1f - GetDeffenceMagni()); + if (this.beforeDamageEvent != null) + { + this.beforeDamageEvent(attacker, ref damageObject); + } + healthStats.stagger += damageObject.stagger; + if (_healthStats.stagger >= _healthStats.staggerResistance && !isEnableStaggerImmunity) + { + if (this.staggerEvent != null) + { + this.staggerEvent(damageObject); + } + healthStats.stagger = 0f; + } + if (damageObject.damage > 0f && !isEnableHealthImmunity) + { + float num = damageObject.damage + damageObject.damage * (((UnityEngine.Random.Range(0, 100) < 50) ? (-1f) : 1f) * UnityEngine.Random.Range(0f, damageObject.fluctuatingRate)); + damageObject.finallyDamage = 0f; + bool flag2 = false; + if (_healthStats.shield > 0f) + { + float num2 = 1f; + switch (damageObject.attribute) + { + case FieAttribute.MAGIC: + if (_healthStats.shieldType == FieAttribute.WING) + { + num2 += _healthStats.weakAttributeDamageMagnify; + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.EFFECTIVE; + } + else if (_healthStats.shieldType == FieAttribute.EARTH) + { + num2 += _healthStats.strongAttributeDamageMagnify; + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.NONEFFECTIVE; + } + break; + case FieAttribute.WING: + if (_healthStats.shieldType == FieAttribute.EARTH) + { + num2 += _healthStats.weakAttributeDamageMagnify; + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.EFFECTIVE; + } + else if (_healthStats.shieldType == FieAttribute.MAGIC) + { + num2 += _healthStats.strongAttributeDamageMagnify; + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.NONEFFECTIVE; + } + break; + case FieAttribute.EARTH: + if (_healthStats.shieldType == FieAttribute.MAGIC) + { + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.EFFECTIVE; + num2 += _healthStats.weakAttributeDamageMagnify; + } + else if (_healthStats.shieldType == FieAttribute.WING) + { + num2 += _healthStats.strongAttributeDamageMagnify; + damageObject.attributeDamageState = FieDamage.FieAttributeDamageState.NONEFFECTIVE; + } + break; + } + num = damageObject.damage * num2; + float num3 = Mathf.Max(_healthStats.shield - num, 0f); + if (num3 <= 0f) + { + num = Mathf.Abs(_healthStats.shield - num); + flag2 = true; + } + if (_isEnableShieldGate && _shieldGateDelay <= 0f && !isPenetration && FieManagerBehaviour.I.currentDifficulty < FieEnvironmentManager.Difficulty.NIGHTMARE) + { + flag2 = false; + if (num3 <= 0f) + { + _shieldGateDelay = 8f; + } + } + float shield = _healthStats.shield; + healthStats.shield = num3; + damageObject.finallyDamage += shield - healthStats.shield; + } + else + { + flag2 = true; + } + if (flag2 && num > 0f) + { + float hitPoint = _healthStats.hitPoint; + float num4 = hitPoint; + if (_isEnableHitPointGate && !isPenetration && FieManagerBehaviour.I.currentDifficulty != FieEnvironmentManager.Difficulty.CHAOS) + { + if (_hitPointGateDelay <= 0f && _healthStats.hitPoint - num <= _healthStats.maxHitPoint * 0.05f) + { + _hitPointGateImunitySec = 0.3f; + _hitPointGateDelay = 12f; + } + float b = (!(_hitPointGateImunitySec > 0f)) ? 0f : (_healthStats.maxHitPoint * 0.05f); + healthStats.hitPoint = Mathf.Max(_healthStats.hitPoint - num, b); + num4 = healthStats.hitPoint; + } + else + { + num4 = _healthStats.hitPoint - num; + healthStats.hitPoint = Mathf.Max(_healthStats.hitPoint - num, 0f); + } + damageObject.finallyDamage += hitPoint - num4; + } + _currentRegenerateDelay = _healthStats.regenerateDelay; + } + if (this.damagedEvent != null) + { + this.damagedEvent(attacker, damageObject); + } + if (attacker != null && damageObject.finallyDamage > 0f) + { + _latestPerpetrator = attacker; + if (!_takenDamages.ContainsKey(attacker)) + { + _takenDamages[attacker] = 0f; + } + Dictionary takenDamages; + FieGameCharacter key; + (takenDamages = _takenDamages)[key = attacker] = takenDamages[key] + damageObject.finallyDamage; + } + if (damageObject != null) + { + _latestDamage = damageObject; + } + return this; + } + + public void addStatusEffectCallback(StatusEffectDelegate callback) where T : FieStatusEffectEntityBase + { + _statusEffectCallbacks[typeof(T)] = callback; + } + + public void applyStatusEffectCallback(T statusEffectObject, FieGameCharacter attacker, FieDamage damage) where T : FieStatusEffectEntityBase + { + if (statusEffectObject != null) + { + Type type = statusEffectObject.GetType(); + if (_statusEffectCallbacks.ContainsKey(type) && _statusEffectCallbacks[type] != null) + { + _statusEffectCallbacks[type](statusEffectObject, attacker, damage); + } + } + } + + public void Heal(float healingRate) + { + } + + private void initializeByRevive() + { + healthStats.hitPoint = healthStats.maxHitPoint; + healthStats.shield = 0f; + _isDead = false; + _revivable = false; + _reviveCount = 0f; + _dyingCount = 0f; + _currentRegenerateDelay = healthStats.regenerateDelay; + _hitPointGateDelay = 0f; + _hitPointGateImunitySec = 0f; + } + } +} diff --git a/src/Fie.Object/FieEmitObjectPoniesArrival.cs b/src/Fie.Object/FieEmitObjectPoniesArrival.cs new file mode 100644 index 0000000..3068ce5 --- /dev/null +++ b/src/Fie.Object/FieEmitObjectPoniesArrival.cs @@ -0,0 +1,34 @@ +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Object +{ + [FiePrefabInfo("Prefabs/PlayerCommon/FiePlayerArrival")] + public class FieEmitObjectPoniesArrival : FieEmittableObjectBase + { + [SerializeField] + private float ARRIVAL_EFFECT_DURATION = 3.5f; + + [SerializeField] + private PlaygroundParticlesC _myPlayGround; + + public override void awakeEmitObject() + { + destoryEmitObject(ARRIVAL_EFFECT_DURATION); + } + + public void SetSubMeshObject(GameObject submeshObject) + { + if (!(_myPlayGround == null) && _myPlayGround.manipulators.Count > 0) + { + foreach (ManipulatorObjectC manipulator in _myPlayGround.manipulators) + { + if (manipulator.type == MANIPULATORTYPEC.Property && manipulator.property.type == MANIPULATORPROPERTYTYPEC.MeshTarget) + { + manipulator.property.meshTarget.gameObject = submeshObject; + } + } + } + } + } +} diff --git a/src/Fie.Object/FieEmitObjectPoniesGainedFriendship.cs b/src/Fie.Object/FieEmitObjectPoniesGainedFriendship.cs new file mode 100644 index 0000000..a7fd683 --- /dev/null +++ b/src/Fie.Object/FieEmitObjectPoniesGainedFriendship.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fie.Object +{ + [FiePrefabInfo("Prefabs/PlayerCommon/FiePoniesGainedFriendship")] + public class FieEmitObjectPoniesGainedFriendship : FieEmittableObjectBase + { + [SerializeField] + private float GAINED_EFFECT_DURATION = 2.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(GAINED_EFFECT_DURATION); + } + } +} diff --git a/src/Fie.Object/FieEmitObjectPoniesRevive.cs b/src/Fie.Object/FieEmitObjectPoniesRevive.cs new file mode 100644 index 0000000..579b740 --- /dev/null +++ b/src/Fie.Object/FieEmitObjectPoniesRevive.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fie.Object +{ + [FiePrefabInfo("Prefabs/PlayerCommon/FiePoniesRevive")] + public class FieEmitObjectPoniesRevive : FieEmittableObjectBase + { + [SerializeField] + private float REVIVE_EFFECT_DURATION = 2.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(REVIVE_EFFECT_DURATION); + } + } +} diff --git a/src/Fie.Object/FieEmittableObjectBase.cs b/src/Fie.Object/FieEmittableObjectBase.cs new file mode 100644 index 0000000..9ccc8f1 --- /dev/null +++ b/src/Fie.Object/FieEmittableObjectBase.cs @@ -0,0 +1,581 @@ +using Fie.Manager; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; + +namespace Fie.Object +{ + [FiePrefabInfo("")] + public abstract class FieEmittableObjectBase : MonoBehaviour + { + public delegate void FieEmittableObjectCallback(FieEmittableObjectBase emitObject); + + public delegate void FieEmittableObjectReclectCallback(); + + private class FieEmittableObjectInitParam + { + public FieldInfo info; + + public T param; + + public FieEmittableObjectInitParam(FieldInfo setInfo, T setParam) + { + info = setInfo; + param = setParam; + } + } + + public enum EmitObjectType + { + NONEFFECTIVE, + RANGED_ATTACK, + RANGED_ATTACK_REFLECTIVE, + MELEE + } + + public enum EmitObjectTag + { + PLAYER, + ENEMY, + EMIT_OBJECT_TAG_MAX + } + + public enum EmitObjectEventList + { + HIT, + DESTROY + } + + public enum HittingType + { + NON_HIT, + ONETIME_PER_LIFE, + ONETIME_PER_ENEMY, + INTERVAL + } + + public enum FriendshipGainedType + { + NONE, + HITTING, + OTHER + } + + public delegate void EmitObjectDestroyDelegate(FieEmittableObjectBase emitObject); + + public delegate void EmitObjectHitDelegate(FieEmittableObjectBase emitObject, FieGameCharacter hitCharacter); + + private delegate void InitializeDelegate(); + + private static string[] _tagTypeToStringList = new string[2] + { + "Player", + "Enemy" + }; + + [NonSerialized] + private FieGameCharacter _ownerCharacter; + + [SerializeField] + private EmitObjectType _emitObjectType; + + [SerializeField] + private EmitObjectTag _defaultAllyTag; + + [SerializeField] + private EmitObjectTag _defaultHostileTag = EmitObjectTag.ENEMY; + + [SerializeField] + private HittingType _hittingType; + + [SerializeField] + private float _hitInterval = 1f; + + [SerializeField] + private FriendshipGainedType _friendshipGainedType; + + [SerializeField] + private float _gainedFriendshipPoint; + + public FieAttribute damageAttribute; + + public float defaultDamage; + + public float defaultStagger; + + public float defaultHate; + + public float defaultGainedFriendshipPoint; + + public float baseDamage; + + public float baseStagger; + + public float baseHate; + + public float baseGainedFriendshipPoint; + + [Range(0f, 100f)] + public float damageFluctuatingRate = 0.05f; + + [SerializeField] + public FieConstValues.FieAbility ability = FieConstValues.FieAbility.NONE; + + private EmitObjectType _initEmitObjectType; + + private EmitObjectTag _initDefaultAllyTag; + + private EmitObjectTag _initDefaultHostileTag = EmitObjectTag.ENEMY; + + private FieAttribute _initDamageAttribute; + + private bool _isEnableCollision; + + private float _initDefaultDamage; + + private float _initDefaultStagger; + + private float _initDefaultHate; + + private float _initDefaultGainedFriendshipPoint; + + private EmitObjectTag nowAllyTag; + + private EmitObjectTag nowHostileTag; + + private bool _isDestroyed; + + protected Vector3 directionalVec = Vector3.zero; + + protected Transform initTransform; + + protected Transform targetTransform; + + protected Dictionary _hitList = new Dictionary(); + + private InitializeDelegate initializeDelegate; + + private List _statusEffects = new List(); + + public FieGameCharacter ownerCharacter + { + get + { + return _ownerCharacter; + } + set + { + _ownerCharacter = value; + ChangeTagInfoByOwnerCharacter(_ownerCharacter); + } + } + + public EmitObjectType emitObjectType + { + get + { + return _emitObjectType; + } + set + { + _emitObjectType = value; + } + } + + public float HitInterval => _hitInterval; + + public float gainedFriendshipPoint + { + get + { + float num = defaultGainedFriendshipPoint; + if (ownerCharacter != null && ownerCharacter.unlockedSkills != null && ownerCharacter.unlockedSkills.Length > 0 && ability != FieConstValues.FieAbility.NONE) + { + for (int i = 0; i < ownerCharacter.unlockedSkills.Length; i++) + { + if (ownerCharacter.unlockedSkills[i].Ability.ID == (int)ability) + { + int iD = ownerCharacter.unlockedSkills[i].SkillType.ID; + if (iD == 5) + { + num += defaultGainedFriendshipPoint * ownerCharacter.unlockedSkills[i].Value1; + } + } + } + } + return num; + } + } + + public bool isDestroyed => _isDestroyed; + + public event FieEmittableObjectCallback awakeningEvent; + + public event FieEmittableObjectReclectCallback reflectEvent; + + public event EmitObjectDestroyDelegate emitObjectDestoryEvent; + + public event EmitObjectHitDelegate emitObjectHitEvent; + + private IEnumerator SetActiveWithDelay(bool activeState, float delay) + { + yield return (object)new WaitForSeconds(delay); + /*Error: Unable to find new state assignment for yield return*/; + } + + public void Initialize(Transform initTransform, Vector3 directionalVec) + { + Initialize(initTransform, directionalVec, null); + } + + public void Initialize(Transform initTransform, Vector3 directionalVec, Transform targetTransform) + { + if (initializeDelegate != null) + { + initializeDelegate(); + } + this.initTransform = initTransform; + this.directionalVec = directionalVec; + this.targetTransform = targetTransform; + nowAllyTag = _defaultAllyTag; + nowHostileTag = _defaultHostileTag; + _isDestroyed = false; + base.transform.position = this.initTransform.position; + if (_ownerCharacter != null) + { + ChangeTagInfoByOwnerCharacter(_ownerCharacter); + } + if (this.awakeningEvent != null) + { + this.awakeningEvent(this); + } + } + + public FieDamage getDefaultDamageObject() + { + FieDamage fieDamage = new FieDamage(damageAttribute, defaultDamage, defaultStagger, defaultHate, damageFluctuatingRate, _statusEffects); + if (ownerCharacter != null && ownerCharacter.unlockedSkills != null && ownerCharacter.unlockedSkills.Length > 0 && ability != FieConstValues.FieAbility.NONE) + { + for (int i = 0; i < ownerCharacter.unlockedSkills.Length; i++) + { + if (ownerCharacter.unlockedSkills[i].Ability.ID == (int)ability) + { + switch (ownerCharacter.unlockedSkills[i].SkillType.ID) + { + case 1: + fieDamage.damage += defaultDamage * ownerCharacter.unlockedSkills[i].Value1; + break; + case 4: + fieDamage.hate += defaultHate * ownerCharacter.unlockedSkills[i].Value1; + break; + case 3: + fieDamage.stagger += defaultStagger * ownerCharacter.unlockedSkills[i].Value1; + break; + } + } + } + } + if (ownerCharacter != null && ownerCharacter.damageSystem != null) + { + fieDamage.damage *= Mathf.Max(0f, 1f + ownerCharacter.damageSystem.GetAttackMagni((int)ability)); + } + if (ownerCharacter != null && ownerCharacter.forces == EmitObjectTag.ENEMY) + { + fieDamage.damage *= FieManagerBehaviour.I.currentEnemyDamageMagnify; + } + return fieDamage; + } + + protected FieGameCharacter addDamageToCharacter(FieGameCharacter gameCharacter, FieDamage damageObject, bool isPenetration = false) + { + if (gameCharacter == null) + { + return null; + } + int instanceID = gameCharacter.GetInstanceID(); + switch (_hittingType) + { + case HittingType.ONETIME_PER_LIFE: + if (_hitList.Count > 0) + { + return null; + } + break; + case HittingType.ONETIME_PER_ENEMY: + if (_hitList.ContainsKey(instanceID)) + { + return null; + } + _hitList[instanceID] = Time.time; + break; + case HittingType.INTERVAL: + if (_hitList.ContainsKey(instanceID) && _hitList[instanceID] + _hitInterval > Time.time) + { + return null; + } + break; + } + _hitList[instanceID] = Time.time; + float gainedFriendshipPoint = this.gainedFriendshipPoint; + if (gainedFriendshipPoint > 0f && ownerCharacter != null) + { + FriendshipGainedType friendshipGainedType = _friendshipGainedType; + if (friendshipGainedType == FriendshipGainedType.HITTING) + { + ownerCharacter.friendshipStats.safeAddFriendship(gainedFriendshipPoint); + } + } + gameCharacter.AddDamage(ownerCharacter, damageObject, isPenetration); + return gameCharacter; + } + + protected FieGameCharacter addDamageToCollisionCharacter(Collider collider, FieDamage damageObject, bool isPenetration = false) + { + if (!_isEnableCollision) + { + return null; + } + if (damageObject == null) + { + return null; + } + FieCollider component = collider.gameObject.GetComponent(); + if (component == null) + { + return null; + } + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (parentGameCharacter == null) + { + return null; + } + parentGameCharacter = addDamageToCharacter(parentGameCharacter, damageObject, isPenetration); + if (parentGameCharacter == null) + { + return null; + } + parentGameCharacter.latestDamageWorldPoint = collider.ClosestPointOnBounds(base.transform.position); + return parentGameCharacter; + } + + protected void callHitEvent(FieGameCharacter hitCharacter) + { + if (this.emitObjectHitEvent != null) + { + this.emitObjectHitEvent(this, hitCharacter); + } + } + + protected void destoryEmitObject() + { + destoryEmitObject(0f); + } + + protected void destoryEmitObject(float duration) + { + if (!_isDestroyed) + { + if (this.emitObjectDestoryEvent != null) + { + this.emitObjectDestoryEvent(this); + } + StartCoroutine(SetActiveWithDelay(activeState: false, duration)); + _isDestroyed = true; + } + } + + public string getAllyTagString() + { + return _tagTypeToStringList[(int)nowAllyTag]; + } + + public string getHostileTagString() + { + return _tagTypeToStringList[(int)nowHostileTag]; + } + + public void setAllyTag(EmitObjectTag setTag) + { + nowAllyTag = setTag; + } + + public void setHostileTag(EmitObjectTag setTag) + { + nowHostileTag = setTag; + } + + public EmitObjectTag getArrayTag() + { + return nowAllyTag; + } + + public EmitObjectTag getHostileTag() + { + return nowHostileTag; + } + + public void setInitTransform(Transform transform) + { + initTransform = transform; + } + + public void setTargetTransform(Transform transform) + { + targetTransform = transform; + } + + public void setDirectionalVector(Vector3 vector) + { + directionalVec = vector; + } + + public Vector3 getDirectionalVector() + { + return directionalVec; + } + + private void ChangeTagInfoByOwnerCharacter(FieGameCharacter ownerCharacter) + { + if (!(ownerCharacter == null) && !(ownerCharacter.detector == null)) + { + nowAllyTag = ((!(ownerCharacter.detector.friendTag == "Player")) ? EmitObjectTag.ENEMY : EmitObjectTag.PLAYER); + nowHostileTag = ((ownerCharacter.detector.enemyTag == "Enemy") ? EmitObjectTag.ENEMY : EmitObjectTag.PLAYER); + } + } + + protected bool reflectEmitObject(FieEmittableObjectBase emitObject, EmitObjectType reflectObjectType = EmitObjectType.RANGED_ATTACK_REFLECTIVE) + { + if (emitObject.getHostileTagString() == getAllyTagString() && emitObject.emitObjectType == reflectObjectType) + { + emitObject.setAllyTag(getArrayTag()); + emitObject.setHostileTag(getHostileTag()); + if (emitObject.ownerCharacter != null) + { + Vector3 directionalVector = emitObject.ownerCharacter.centerTransform.position - emitObject.transform.position; + directionalVector.Normalize(); + emitObject.setTargetTransform(emitObject.ownerCharacter.centerTransform); + emitObject.setDirectionalVector(directionalVector); + emitObject.ownerCharacter = ownerCharacter; + } + else + { + emitObject.setDirectionalVector(emitObject.getDirectionalVector() * -1f); + } + emitObject.InvokeReflectedEvent(); + return true; + } + return false; + } + + private void InvokeReflectedEvent() + { + if (this.reflectEvent != null) + { + this.reflectEvent(); + } + } + + public void InitializeInitializer() where T : FieEmittableObjectBase + { + List> intInitializer = new List>(); + List> stringInitializer = new List>(); + List> boolInitializer = new List>(); + List> floatInitializer = new List>(); + List> vector3Initializer = new List>(); + List> quaternionInitializer = new List>(); + FieldInfo[] fields = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + FieldInfo[] array = fields; + foreach (FieldInfo fieldInfo in array) + { + if (fieldInfo.FieldType == typeof(int)) + { + intInitializer.Add(new FieEmittableObjectInitParam(fieldInfo, (int)fieldInfo.GetValue(this))); + } + else if (fieldInfo.FieldType == typeof(string)) + { + stringInitializer.Add(new FieEmittableObjectInitParam(fieldInfo, (string)fieldInfo.GetValue(this))); + } + else if (fieldInfo.FieldType == typeof(bool)) + { + boolInitializer.Add(new FieEmittableObjectInitParam(fieldInfo, (bool)fieldInfo.GetValue(this))); + } + else if (fieldInfo.FieldType == typeof(float)) + { + floatInitializer.Add(new FieEmittableObjectInitParam(fieldInfo, (float)fieldInfo.GetValue(this))); + } + else if (fieldInfo.FieldType == typeof(Vector3)) + { + vector3Initializer.Add(new FieEmittableObjectInitParam(fieldInfo, (Vector3)fieldInfo.GetValue(this))); + } + else if (fieldInfo.FieldType == typeof(Quaternion)) + { + quaternionInitializer.Add(new FieEmittableObjectInitParam(fieldInfo, (Quaternion)fieldInfo.GetValue(this))); + } + } + _initEmitObjectType = _emitObjectType; + _initDefaultAllyTag = _defaultAllyTag; + _initDefaultHostileTag = _defaultHostileTag; + _initDamageAttribute = damageAttribute; + _isEnableCollision = false; + _initDefaultDamage = defaultDamage; + _initDefaultStagger = defaultStagger; + _initDefaultHate = defaultHate; + _initDefaultGainedFriendshipPoint = _gainedFriendshipPoint; + initializeDelegate = delegate + { + initTransform = null; + targetTransform = null; + this.emitObjectDestoryEvent = null; + this.emitObjectHitEvent = null; + foreach (FieEmittableObjectInitParam item in intInitializer) + { + item.info.SetValue(this, item.param); + } + foreach (FieEmittableObjectInitParam item2 in stringInitializer) + { + item2.info.SetValue(this, item2.param); + } + foreach (FieEmittableObjectInitParam item3 in boolInitializer) + { + item3.info.SetValue(this, item3.param); + } + foreach (FieEmittableObjectInitParam item4 in floatInitializer) + { + item4.info.SetValue(this, item4.param); + } + foreach (FieEmittableObjectInitParam item5 in vector3Initializer) + { + item5.info.SetValue(this, item5.param); + } + foreach (FieEmittableObjectInitParam item6 in quaternionInitializer) + { + item6.info.SetValue(this, item6.param); + } + _hitList = new Dictionary(); + _emitObjectType = _initEmitObjectType; + _defaultAllyTag = _initDefaultAllyTag; + _defaultHostileTag = _initDefaultHostileTag; + damageAttribute = _initDamageAttribute; + _isEnableCollision = (_hittingType != HittingType.NON_HIT); + defaultDamage = (baseDamage = _initDefaultDamage); + defaultStagger = (baseStagger = _initDefaultStagger); + defaultHate = (baseHate = _initDefaultHate); + defaultGainedFriendshipPoint = (baseGainedFriendshipPoint = _initDefaultGainedFriendshipPoint); + }; + } + + public void AddStatusEffect(FieStatusEffectEntityBase statusEffectEntity) + { + if (statusEffectEntity != null) + { + _statusEffects.Add(statusEffectEntity); + } + } + + public virtual void awakeEmitObject() + { + } + } +} diff --git a/src/Fie.Object/FieEmotion.cs b/src/Fie.Object/FieEmotion.cs new file mode 100644 index 0000000..f97c238 --- /dev/null +++ b/src/Fie.Object/FieEmotion.cs @@ -0,0 +1,91 @@ +namespace Fie.Object +{ + public class FieEmotion + { + public enum EmotionStatus + { + AUTO, + MANUAL + } + + private FieGameCharacter _ownerCharacter; + + private int _nowDefaultEmoteAnimationID = -1; + + private FieSkeletonAnimationObject _latestAutoAnimation; + + private EmotionStatus _emotionState; + + public EmotionStatus emotionState => _emotionState; + + public FieEmotion(FieGameCharacter ownerCharacter) + { + _ownerCharacter = ownerCharacter; + } + + public void StopAutoAnimation() + { + if (_latestAutoAnimation != null) + { + _ownerCharacter.animationManager.UnbindAnimation(_latestAutoAnimation.trackID); + } + _emotionState = EmotionStatus.MANUAL; + } + + public void RestartAutoAnimation() + { + _emotionState = EmotionStatus.AUTO; + if (_latestAutoAnimation != null) + { + SetEmoteAnimation(_latestAutoAnimation); + } + } + + public void SetDefaultEmoteAnimationID(int newDefaultEmoteAnimId) + { + FieSkeletonAnimationObject animationData = _ownerCharacter.animationManager.GetAnimationData(newDefaultEmoteAnimId); + if (animationData != null) + { + _latestAutoAnimation = animationData; + _nowDefaultEmoteAnimationID = newDefaultEmoteAnimId; + } + } + + public void RestoreEmotionFromDefaultData() + { + SetEmoteAnimation(_nowDefaultEmoteAnimationID); + } + + public void SetEmoteAnimation(int emoteAnimId, bool isForceSet = false) + { + if (!(_ownerCharacter == null)) + { + FieSkeletonAnimationObject animationData = _ownerCharacter.animationManager.GetAnimationData(emoteAnimId); + if (animationData != null) + { + SetEmoteAnimation(animationData); + } + } + } + + private void SetEmoteAnimation(FieSkeletonAnimationObject data, bool isForceSet = false) + { + if (data != null && data.trackID == 1 && !(_ownerCharacter == null)) + { + _latestAutoAnimation = data; + if (isForceSet || _emotionState == EmotionStatus.AUTO) + { + if (isForceSet) + { + _emotionState = EmotionStatus.AUTO; + if (_ownerCharacter.voiceController != null) + { + _ownerCharacter.voiceController.Interrupt(); + } + } + _ownerCharacter.animationManager.SetAnimation(data, isLoop: true, isForceSet: true); + } + } + } + } +} diff --git a/src/Fie.Object/FieFriendshipdStats.cs b/src/Fie.Object/FieFriendshipdStats.cs new file mode 100644 index 0000000..17e4b11 --- /dev/null +++ b/src/Fie.Object/FieFriendshipdStats.cs @@ -0,0 +1,51 @@ +using Fie.Manager; +using UnityEngine; + +namespace Fie.Object +{ + public class FieFriendshipdStats + { + public delegate void FriendshipCalcCallback(float friendship); + + public const int MAXIMUM_FRIENDSHIP_SEGMENT = 6; + + public const float FRIENDSHIP_SEGMENTATION_THRESHOLD = 30f; + + public float friendship; + + public event FriendshipCalcCallback friendshipAddEvent; + + public void safeAddFriendship(float additionalFriendship, bool triggerEvent = true) + { + if (additionalFriendship > 0f) + { + additionalFriendship *= FieManagerBehaviour.I.currentFriendshipPointMagnify; + } + friendship = Mathf.Clamp(friendship + additionalFriendship, 0f, getMaxFriendship()); + if (triggerEvent && this.friendshipAddEvent != null) + { + this.friendshipAddEvent(additionalFriendship); + } + } + + public void resetFriendship() + { + friendship = 0f; + } + + public float getMaxFriendship() + { + return 180f; + } + + public void addFriendshipPoint(int num) + { + safeAddFriendship((float)num * 30f); + } + + public int getCurrentFriendshipPoint() + { + return (int)(friendship / 30f); + } + } +} diff --git a/src/Fie.Object/FieGameCharacterBuildData.cs b/src/Fie.Object/FieGameCharacterBuildData.cs new file mode 100644 index 0000000..b2ecd2c --- /dev/null +++ b/src/Fie.Object/FieGameCharacterBuildData.cs @@ -0,0 +1,13 @@ +using Fie.Manager; + +namespace Fie.Object +{ + public struct FieGameCharacterBuildData + { + public FieLevelInfo levelInfo; + + public int skillPoint; + + public int promotedCount; + } +} diff --git a/src/Fie.Object/FieHealthStats.cs b/src/Fie.Object/FieHealthStats.cs new file mode 100644 index 0000000..4b84cc8 --- /dev/null +++ b/src/Fie.Object/FieHealthStats.cs @@ -0,0 +1,216 @@ +using System; +using UnityEngine; + +namespace Fie.Object +{ + [Serializable] + public class FieHealthStats + { + public const float DEFAULT_REGENERATE_DELAY = 3f; + + public const float DEFAULT_HITPOINT_REGENERATE_PER_SEC = 0.15f; + + public const float DEFAULT_SHIED_REGENERATE_PER_SEC = 0.2f; + + public const float DEFAULT_STAGGER_ATTENUATION_RATE_PER_SEC = 0.3f; + + public const float WEAK_ATTRIBUTE_DAMAGE_MAGNIFY = 0.3f; + + public const float STRONG_ATTRIBUTE_DAMAGE_MAGNIFY = -0.3f; + + public const float MAXIMUM_WEAK_ATTRIBUTE_DAMAGE_MAGNIFY = 10f; + + private FieAttribute _shieldType; + + private float _hitPoint; + + private float _shield; + + private float _stagger; + + [SerializeField] + private float _maxHitPoint; + + [SerializeField] + private float _maxShield; + + [SerializeField] + private float _staggerResistance; + + [SerializeField] + private float _regenerateDelay = 3f; + + [SerializeField] + private float _hitPointRegeneratePerSec = 0.2f; + + [SerializeField] + private float _shieldRegeneratePerSec = 0.2f; + + [SerializeField] + private float _staggerAttenuationPerSec = 0.3f; + + [SerializeField] + private float _weakAttributeDamageMagnify = 0.3f; + + [SerializeField] + private float _strongAttributeDamageMagnify = -0.3f; + + public FieAttribute shieldType + { + get + { + return _shieldType; + } + set + { + _shieldType = value; + } + } + + public float hitPoint + { + get + { + return _hitPoint; + } + set + { + _hitPoint = Mathf.Max(value, 0f); + } + } + + public float shield + { + get + { + return _shield; + } + set + { + _shield = Mathf.Max(value, 0f); + } + } + + public float stagger + { + get + { + return _stagger; + } + set + { + _stagger = Mathf.Max(value, 0f); + } + } + + public float maxHitPoint + { + get + { + return _maxHitPoint; + } + set + { + _maxHitPoint = Mathf.Max(value, 1f); + } + } + + public float maxShield + { + get + { + return _maxShield; + } + set + { + _maxShield = Mathf.Max(value, 1f); + } + } + + public float staggerResistance + { + get + { + return _staggerResistance; + } + set + { + _staggerResistance = Mathf.Max(value, 1f); + } + } + + public float regenerateDelay + { + get + { + return _regenerateDelay; + } + set + { + _regenerateDelay = Mathf.Max(value, 0f); + } + } + + public float hitPointRegeneratePerSec + { + get + { + return _hitPointRegeneratePerSec; + } + set + { + _hitPointRegeneratePerSec = Mathf.Max(value, 0f); + } + } + + public float shieldRegeneratePerSec + { + get + { + return _shieldRegeneratePerSec; + } + set + { + _shieldRegeneratePerSec = Mathf.Max(value, 0f); + } + } + + public float staggerAttenuationPerSec + { + get + { + return _staggerAttenuationPerSec; + } + set + { + _staggerAttenuationPerSec = Mathf.Max(value, 0f); + } + } + + public float weakAttributeDamageMagnify + { + get + { + return _weakAttributeDamageMagnify; + } + set + { + _weakAttributeDamageMagnify = Mathf.Clamp(value, 0f, 10f); + } + } + + public float strongAttributeDamageMagnify + { + get + { + return _strongAttributeDamageMagnify; + } + set + { + _strongAttributeDamageMagnify = Mathf.Clamp(value, -1f, 0f); + } + } + + public float nowHelthAndShieldRatePerMax => (hitPoint + shield) / Mathf.Max(maxHitPoint + maxShield, 0.1f); + } +} diff --git a/src/Fie.Object/FieInGamePreloadEnemyContainer.cs b/src/Fie.Object/FieInGamePreloadEnemyContainer.cs new file mode 100644 index 0000000..4342f2a --- /dev/null +++ b/src/Fie.Object/FieInGamePreloadEnemyContainer.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public class FieInGamePreloadEnemyContainer : MonoBehaviour + { + [SerializeField] + public List _preloadList; + } +} diff --git a/src/Fie.Object/FieInputControllerBase.cs b/src/Fie.Object/FieInputControllerBase.cs new file mode 100644 index 0000000..f6883a6 --- /dev/null +++ b/src/Fie.Object/FieInputControllerBase.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fie.Object +{ + public class FieInputControllerBase : MonoBehaviour + { + public FieGameCharacter _ownerCharacter; + + public FieGameCharacter ownerCharacter => _ownerCharacter; + + public void SetOwner(FieGameCharacter character) + { + _ownerCharacter = character; + } + } +} diff --git a/src/Fie.Object/FieMoveForce.cs b/src/Fie.Object/FieMoveForce.cs new file mode 100644 index 0000000..cf30faa --- /dev/null +++ b/src/Fie.Object/FieMoveForce.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace Fie.Object +{ + public class FieMoveForce + { + private Vector3 _moveForce; + + private float _duration; + + private float _restDuration; + + public bool isEnable => _restDuration > 0f; + + public Vector3 moveForce => (!isEnable) ? Vector3.zero : (_moveForce * restForceRate); + + public float restForceRate => 1f - Mathf.Abs(_restDuration - _duration) / Mathf.Max(0.01f, _duration); + + public FieMoveForce(Vector3 moveForce, float duration = 0f) + { + _moveForce = moveForce; + _duration = (_restDuration = duration); + } + + public void Update(float fixedTime) + { + _restDuration -= fixedTime; + } + } +} diff --git a/src/Fie.Object/FieNetworkObjectBase.cs b/src/Fie.Object/FieNetworkObjectBase.cs new file mode 100644 index 0000000..82ebc68 --- /dev/null +++ b/src/Fie.Object/FieNetworkObjectBase.cs @@ -0,0 +1,60 @@ +using Photon; +using UnityEngine; + +namespace Fie.Object +{ + public abstract class FieNetworkObjectBase : Photon.MonoBehaviour, FieObjectInterface + { + private FieObjectBaseState _baseState; + + private FieObjectGroundState _groundState; + + [SerializeField] + private FieObjectFlipState _flipState; + + private PhotonTransformView _photonTransformView; + + public PhotonTransformView photonTransformView => _photonTransformView; + + public FieObjectBaseState baseState + { + get + { + return _baseState; + } + set + { + _baseState = value; + } + } + + public FieObjectGroundState groundState + { + get + { + return _groundState; + } + set + { + _groundState = value; + } + } + + public FieObjectFlipState flipState + { + get + { + return _flipState; + } + set + { + _flipState = value; + } + } + + protected virtual void Awake() + { + _photonTransformView = GetComponent(); + } + } +} diff --git a/src/Fie.Object/FieObjectBaseState.cs b/src/Fie.Object/FieObjectBaseState.cs new file mode 100644 index 0000000..284e6dd --- /dev/null +++ b/src/Fie.Object/FieObjectBaseState.cs @@ -0,0 +1,9 @@ +namespace Fie.Object +{ + public enum FieObjectBaseState + { + None = -1, + Idle, + Move + } +} diff --git a/src/Fie.Object/FieObjectFlipState.cs b/src/Fie.Object/FieObjectFlipState.cs new file mode 100644 index 0000000..77d7916 --- /dev/null +++ b/src/Fie.Object/FieObjectFlipState.cs @@ -0,0 +1,8 @@ +namespace Fie.Object +{ + public enum FieObjectFlipState + { + Left, + Right + } +} diff --git a/src/Fie.Object/FieObjectGroundState.cs b/src/Fie.Object/FieObjectGroundState.cs new file mode 100644 index 0000000..e379e62 --- /dev/null +++ b/src/Fie.Object/FieObjectGroundState.cs @@ -0,0 +1,9 @@ +namespace Fie.Object +{ + public enum FieObjectGroundState + { + None = -1, + Grounding, + Flying + } +} diff --git a/src/Fie.Object/FieObjectInterface.cs b/src/Fie.Object/FieObjectInterface.cs new file mode 100644 index 0000000..2fcc4b5 --- /dev/null +++ b/src/Fie.Object/FieObjectInterface.cs @@ -0,0 +1,23 @@ +namespace Fie.Object +{ + public interface FieObjectInterface + { + FieObjectBaseState baseState + { + get; + set; + } + + FieObjectGroundState groundState + { + get; + set; + } + + FieObjectFlipState flipState + { + get; + set; + } + } +} diff --git a/src/Fie.Object/FiePlayableGameCharacterInterface.cs b/src/Fie.Object/FiePlayableGameCharacterInterface.cs new file mode 100644 index 0000000..dd541d5 --- /dev/null +++ b/src/Fie.Object/FiePlayableGameCharacterInterface.cs @@ -0,0 +1,6 @@ +namespace Fie.Object +{ + public interface FiePlayableGameCharacterInterface + { + } +} diff --git a/src/Fie.Object/FiePlayerSpawnPoint.cs b/src/Fie.Object/FiePlayerSpawnPoint.cs new file mode 100644 index 0000000..9f7e4d8 --- /dev/null +++ b/src/Fie.Object/FiePlayerSpawnPoint.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace Fie.Object +{ + public class FiePlayerSpawnPoint : MonoBehaviour + { + [SerializeField] + public int spawnPointNumber; + } +} diff --git a/src/Fie.Object/FieSkeletonAnimationController.cs b/src/Fie.Object/FieSkeletonAnimationController.cs new file mode 100644 index 0000000..b34e7be --- /dev/null +++ b/src/Fie.Object/FieSkeletonAnimationController.cs @@ -0,0 +1,198 @@ +using Spine; +using Spine.Unity; +using System.Collections.Generic; + +namespace Fie.Object +{ + public class FieSkeletonAnimationController + { + public delegate void CommonAnimationEventDelegate(TrackEntry entry); + + private SkeletonUtility _skeletonUtility; + + private Dictionary _animationObjectList = new Dictionary(); + + private Dictionary _currentAnimationEntries = new Dictionary(); + + private Dictionary _currentEntryList = new Dictionary(); + + public event CommonAnimationEventDelegate commonAnimationEvent; + + public FieSkeletonAnimationController(SkeletonUtility baseSkeleton, FieAnimationContainerBase animationContainer) + { + _skeletonUtility = baseSkeleton; + _animationObjectList = animationContainer.getAnimationList(); + } + + public void SetAnimationTimeScale(float timeScale = 1f) + { + if (_skeletonUtility != null) + { + _skeletonUtility.skeletonAnimation.timeScale = timeScale; + } + } + + public void AddAnimationContainer(FieAnimationContainerBase animationContainer) + { + if (animationContainer != null) + { + foreach (KeyValuePair animation in animationContainer.getAnimationList()) + { + _animationObjectList[animation.Key] = animation.Value; + } + } + } + + public TrackEntry SetAnimation(int animationId, bool isLoop = false, bool isForceSet = false) + { + if (!_animationObjectList.ContainsKey(animationId)) + { + return null; + } + return SetAnimation(_animationObjectList[animationId], isLoop, isForceSet); + } + + public FieSkeletonAnimationObject GetAnimationData(int animationId) + { + if (!_animationObjectList.ContainsKey(animationId)) + { + return null; + } + return _animationObjectList[animationId]; + } + + public TrackEntry SetAnimation(FieSkeletonAnimationObject animation, bool isLoop = false, bool isForceSet = false) + { + if (animation == null) + { + return null; + } + bool flag = false; + if (!isForceSet) + { + foreach (KeyValuePair currentAnimationEntry in _currentAnimationEntries) + { + if (currentAnimationEntry.Key == animation.trackID && currentAnimationEntry.Value.Animation.name == animation.animationName) + { + flag = true; + } + } + } + if (flag) + { + return null; + } + if (_skeletonUtility.skeletonAnimation.state == null) + { + return null; + } + TrackEntry trackEntry = _skeletonUtility.skeletonAnimation.state.SetAnimation(animation.trackID, animation.animationName, isLoop); + if (trackEntry == null) + { + return null; + } + _currentAnimationEntries[animation.trackID] = trackEntry; + _currentAnimationEntries.Remove(animation.trackID); + _currentAnimationEntries.Add(animation.trackID, trackEntry); + if (this.commonAnimationEvent != null) + { + this.commonAnimationEvent(trackEntry); + } + return trackEntry; + } + + public bool IsEndAnimation(int trackID) + { + if (_currentAnimationEntries.ContainsKey(trackID) && _currentAnimationEntries[trackID] != null) + { + return _currentAnimationEntries[trackID].EndTime <= _currentAnimationEntries[trackID].Time; + } + return true; + } + + public bool SetAnimationTimescale(int animationID, float timescale) + { + if (!_animationObjectList.ContainsKey(animationID)) + { + return false; + } + bool result = false; + foreach (KeyValuePair currentAnimationEntry in _currentAnimationEntries) + { + if (currentAnimationEntry.Value.Animation.name == _animationObjectList[animationID].animationName) + { + currentAnimationEntry.Value.TimeScale = timescale; + result = true; + } + } + return result; + } + + public void ResetAllAnimationTimescale() + { + if (_currentAnimationEntries.Count > 0) + { + foreach (KeyValuePair currentAnimationEntry in _currentAnimationEntries) + { + currentAnimationEntry.Value.TimeScale = 1f; + } + } + } + + public void UnbindAnimation(int animationTrack = -1) + { + if (animationTrack >= 0) + { + TrackEntry current = _skeletonUtility.skeletonAnimation.state.GetCurrent(animationTrack); + if (current != null) + { + _skeletonUtility.skeletonAnimation.state.ClearTrack(animationTrack); + } + } + else + { + _skeletonUtility.skeletonAnimation.state.ClearTracks(); + } + if (_currentAnimationEntries.ContainsKey(animationTrack)) + { + _currentAnimationEntries.Remove(animationTrack); + } + } + + public string GetCurrentAnimationName(int animationTrack) + { + if (_skeletonUtility.skeletonAnimation.state == null) + { + return string.Empty; + } + TrackEntry current = _skeletonUtility.skeletonAnimation.state.GetCurrent(animationTrack); + if (current == null) + { + return string.Empty; + } + return current.ToString(); + } + + public TrackEntry SetAnimationChain(int firstAnimationID, int secondAnimationID, bool isLoop = false, bool isForceSet = false) + { + if (!_animationObjectList.ContainsKey(firstAnimationID)) + { + return null; + } + if (!_animationObjectList.ContainsKey(secondAnimationID)) + { + return null; + } + TrackEntry trackEntry = SetAnimation(firstAnimationID, isForceSet); + if (trackEntry == null) + { + return null; + } + trackEntry.Complete += delegate + { + SetAnimation(secondAnimationID, isLoop); + }; + return trackEntry; + } + } +} diff --git a/src/Fie.Object/FieSkeletonAnimationObject.cs b/src/Fie.Object/FieSkeletonAnimationObject.cs new file mode 100644 index 0000000..b9592a0 --- /dev/null +++ b/src/Fie.Object/FieSkeletonAnimationObject.cs @@ -0,0 +1,33 @@ +namespace Fie.Object +{ + public class FieSkeletonAnimationObject + { + private int _trackID; + + private string _animationName; + + private float _animationSpeed = 1f; + + public int trackID => _trackID; + + public string animationName => _animationName; + + public float animationSpeed + { + get + { + return _animationSpeed; + } + set + { + _animationSpeed = value; + } + } + + public FieSkeletonAnimationObject(int trackID, string animationName) + { + _trackID = trackID; + _animationName = animationName; + } + } +} diff --git a/src/Fie.Object/FieStateMachineAbilityBase.cs b/src/Fie.Object/FieStateMachineAbilityBase.cs new file mode 100644 index 0000000..4f4abda --- /dev/null +++ b/src/Fie.Object/FieStateMachineAbilityBase.cs @@ -0,0 +1,17 @@ +namespace Fie.Object +{ + [FieAbilityID(FieConstValues.FieAbility.NONE)] + public abstract class FieStateMachineAbilityBase : FieStateMachineGameCharacterBase, FieStateMachineAbilityInterface + { + public float defaultCoolDown; + + public abstract FieAbilityActivationType getActivationType(); + + public abstract string getSignature(); + + public virtual float getCooldown() + { + return defaultCoolDown; + } + } +} diff --git a/src/Fie.Object/FieStateMachineAbilityInterface.cs b/src/Fie.Object/FieStateMachineAbilityInterface.cs new file mode 100644 index 0000000..8abdc61 --- /dev/null +++ b/src/Fie.Object/FieStateMachineAbilityInterface.cs @@ -0,0 +1,11 @@ +namespace Fie.Object +{ + public interface FieStateMachineAbilityInterface + { + FieAbilityActivationType getActivationType(); + + string getSignature(); + + float getCooldown(); + } +} diff --git a/src/Fie.Object/FieStateMachineAnyConsider.cs b/src/Fie.Object/FieStateMachineAnyConsider.cs new file mode 100644 index 0000000..e9761f3 --- /dev/null +++ b/src/Fie.Object/FieStateMachineAnyConsider.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; + +namespace Fie.Object +{ + public abstract class FieStateMachineAnyConsider : FieStateMachineInterface + { + event StateChangeDelegate FieStateMachineInterface.stateChangeEvent + { + add + { + stateChangeEvent += value; + } + remove + { + stateChangeEvent -= value; + } + } + + private event StateChangeDelegate stateChangeEvent; + + public abstract void terminateAndCallStateChangeEvent(FieGameCharacter gameCharacter, Type fromState, Type toState); + + public abstract void updateState(ref T gameCharacter) where T : FieGameCharacter; + + public abstract void initialize(FieGameCharacter gameCharacter); + + public abstract void terminate(FieGameCharacter gameCharacter); + + public abstract bool isEnd(); + + public abstract bool isFinished(); + + public abstract float getDelay(); + + public abstract bool isNotNetworkSync(); + + public abstract Type getNextState(); + + public abstract List getIgnoreStateList(); + + public abstract List getAllowedStateList(); + } +} diff --git a/src/Fie.Object/FieStateMachineCommonIdle.cs b/src/Fie.Object/FieStateMachineCommonIdle.cs new file mode 100644 index 0000000..6b74940 --- /dev/null +++ b/src/Fie.Object/FieStateMachineCommonIdle.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace Fie.Object +{ + public class FieStateMachineCommonIdle : FieStateMachineGameCharacterBase + { + public override void updateState(ref T gameCharacter) + { + gameCharacter.animationManager.SetAnimation(0, isLoop: true); + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return null; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Object/FieStateMachineGameCharacterBase.cs b/src/Fie.Object/FieStateMachineGameCharacterBase.cs new file mode 100644 index 0000000..2f32cb6 --- /dev/null +++ b/src/Fie.Object/FieStateMachineGameCharacterBase.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public abstract class FieStateMachineGameCharacterBase : FieStateMachineInterface + { + protected List targetGameCharacterList = new List(); + + event StateChangeDelegate FieStateMachineInterface.stateChangeEvent + { + add + { + stateChangeEvent += value; + } + remove + { + stateChangeEvent -= value; + } + } + + private event StateChangeDelegate stateChangeEvent; + + public void terminateAndCallStateChangeEvent(FieGameCharacter gameCharacter, Type fromType, Type toType) + { + if (this.stateChangeEvent != null) + { + this.stateChangeEvent(fromType, toType); + } + terminate(gameCharacter); + } + + public abstract void updateState(ref T gameCharacter) where T : FieGameCharacter; + + public abstract bool isEnd(); + + public abstract Type getNextState(); + + public virtual void initialize(FieGameCharacter gameCharacter) + { + } + + public virtual void terminate(FieGameCharacter gameCharacter) + { + } + + protected void autoFlipToEnemy(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + FieGameCharacter lockonEnemyGameCharacter = gameCharacter.detector.getLockonEnemyGameCharacter(); + if (lockonEnemyGameCharacter != null) + { + Vector3 vector = lockonEnemyGameCharacter.transform.position - gameCharacter.transform.position; + if (vector.x > 0f) + { + gameCharacter.setFlip(FieObjectFlipState.Right); + } + else + { + gameCharacter.setFlip(FieObjectFlipState.Left); + } + } + } + } + + public void addTargetGameCharacter(FieGameCharacter targetGameCharacter) + { + targetGameCharacterList.Add(targetGameCharacter); + } + + public virtual List getAllowedStateList() + { + return new List(); + } + + public virtual float getDelay() + { + return 0f; + } + + public virtual bool isFinished() + { + return isEnd(); + } + + public virtual bool isNotNetworkSync() + { + return false; + } + } +} diff --git a/src/Fie.Object/FieStateMachineInterface.cs b/src/Fie.Object/FieStateMachineInterface.cs new file mode 100644 index 0000000..779939b --- /dev/null +++ b/src/Fie.Object/FieStateMachineInterface.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace Fie.Object +{ + public interface FieStateMachineInterface + { + event StateChangeDelegate stateChangeEvent; + + void initialize(FieGameCharacter gameCharacter); + + void terminate(FieGameCharacter gameCharacter); + + void terminateAndCallStateChangeEvent(FieGameCharacter gameCharacter, Type fromState, Type toState); + + void updateState(ref T gameCharacter) where T : FieGameCharacter; + + bool isFinished(); + + bool isEnd(); + + Type getNextState(); + + List getAllowedStateList(); + + float getDelay(); + + bool isNotNetworkSync(); + } +} diff --git a/src/Fie.Object/FieStateMachineManager.cs b/src/Fie.Object/FieStateMachineManager.cs new file mode 100644 index 0000000..25babb7 --- /dev/null +++ b/src/Fie.Object/FieStateMachineManager.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public class FieStateMachineManager + { + public delegate bool FieStateMachineActivateCheckDelegate(); + + private class TypeByParams + { + public Type type; + + public float delay; + + public FieStateMachineActivateCheckDelegate checkDelegate; + } + + private const int MAXIMUM_STATE_MACHINE_PER_MANAGER = 64; + + private FieGameCharacter _fieGameCharacter; + + private FieGameCharacter.StateMachineType _stateMachineType; + + private FieStateMachineInterface _currentStateMachine; + + private TypeByParams[] _typeByParams = new TypeByParams[64]; + + public FieGameCharacter.StateMachineType stateMachineType => _stateMachineType; + + public FieStateMachineManager(FieGameCharacter gameCharacter, FieGameCharacter.StateMachineType type) + { + for (int i = 0; i < 64; i++) + { + _typeByParams[i] = new TypeByParams(); + } + _fieGameCharacter = gameCharacter; + _stateMachineType = type; + _currentStateMachine = _fieGameCharacter.getDefaultState(_stateMachineType); + } + + private TypeByParams GetTypeByParam(Type type) + { + for (int i = 0; i < 64; i++) + { + if (_typeByParams[i].type == type) + { + return _typeByParams[i]; + } + } + TypeByParams typeByParams = null; + for (int j = 0; j < 64; j++) + { + if (_typeByParams[j].type == null) + { + typeByParams = _typeByParams[j]; + typeByParams.type = type; + break; + } + } + return typeByParams; + } + + private void SetTypeByDelay(Type type, float delay = 0f) + { + TypeByParams typeByParam = GetTypeByParam(type); + if (typeByParam != null) + { + typeByParam.delay = delay; + } + } + + private void SetTypeByActivateCheckDelegate(Type type, FieStateMachineActivateCheckDelegate callback) + { + TypeByParams typeByParam = GetTypeByParam(type); + if (typeByParam != null) + { + typeByParam.checkDelegate = callback; + } + } + + public void SetActivateCheckEvent(FieStateMachineActivateCheckDelegate activateCheckCallback) where T : FieStateMachineInterface + { + SetTypeByActivateCheckDelegate(typeof(T), activateCheckCallback); + } + + public FieStateMachineInterface setState(Type state, bool isForceSet, bool isDupulicate = false) + { + Type entityState = _fieGameCharacter.getEntityState(state); + if (entityState == null) + { + return null; + } + if (!isDupulicate && entityState == _currentStateMachine.GetType()) + { + return null; + } + TypeByParams typeByParam = GetTypeByParam(entityState); + if (typeByParam != null && typeByParam.checkDelegate != null && !typeByParam.checkDelegate()) + { + return null; + } + if (!isForceSet) + { + List allowedStateList = _currentStateMachine.getAllowedStateList(); + if (!allowedStateList.Contains(typeof(FieStateMachineAnyConsider)) && !allowedStateList.Contains(entityState)) + { + return null; + } + if (getStateDelay(entityState) > 0f) + { + return null; + } + } + return _fieGameCharacter.sendStateChangeCommand(this, entityState); + } + + public FieStateMachineInterface SetStateDynamic(Type nextStateType) + { + FieStateMachineInterface fieStateMachineInterface = Activator.CreateInstance(nextStateType) as FieStateMachineInterface; + if (fieStateMachineInterface == null) + { + return null; + } + SetTypeByDelay(_currentStateMachine.GetType(), _currentStateMachine.getDelay()); + _currentStateMachine.terminateAndCallStateChangeEvent(_fieGameCharacter, _currentStateMachine.GetType(), fieStateMachineInterface.GetType()); + _currentStateMachine = fieStateMachineInterface; + _currentStateMachine.initialize(_fieGameCharacter); + _currentStateMachine.updateState(ref _fieGameCharacter); + return _currentStateMachine; + } + + public void updateState() + { + if (_currentStateMachine.isEnd()) + { + Type nextState = _currentStateMachine.getNextState(); + if (nextState != null) + { + setState(nextState, isForceSet: true); + } + else + { + SetTypeByDelay(_currentStateMachine.GetType(), _currentStateMachine.getDelay()); + _currentStateMachine.terminateAndCallStateChangeEvent(_fieGameCharacter, _currentStateMachine.GetType(), _fieGameCharacter.getDefaultState(_stateMachineType).GetType()); + _currentStateMachine = _fieGameCharacter.getDefaultState(_stateMachineType); + _currentStateMachine.initialize(_fieGameCharacter); + } + } + _currentStateMachine.updateState(ref _fieGameCharacter); + for (int i = 0; i < _typeByParams.Length; i++) + { + _typeByParams[i].delay = Mathf.Max(0f, _typeByParams[i].delay - Time.deltaTime); + } + } + + public float getStateDelay(Type state) + { + if (state == null) + { + return 0f; + } + return GetTypeByParam(state)?.delay ?? 0f; + } + + public FieStateMachineInterface getCurrentStateMachine() + { + return _currentStateMachine; + } + + public Type nowStateType() + { + return _currentStateMachine.GetType(); + } + } +} diff --git a/src/Fie.Object/FieStateMachinePoniesIdle.cs b/src/Fie.Object/FieStateMachinePoniesIdle.cs new file mode 100644 index 0000000..8519d2a --- /dev/null +++ b/src/Fie.Object/FieStateMachinePoniesIdle.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public class FieStateMachinePoniesIdle : FieStateMachineGameCharacterBase + { + public const float IDLING_THLESHOLD_SEC = 5f; + + private float idleCount; + + public override void updateState(ref T gameCharacter) + { + idleCount = Mathf.Min(idleCount + Time.deltaTime, 5f); + if (idleCount >= 5f) + { + gameCharacter.animationManager.SetAnimation(1, isLoop: true); + } + else + { + gameCharacter.animationManager.SetAnimation(0, isLoop: true); + } + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return null; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Object/FieStateMachineStatusEffectPull.cs b/src/Fie.Object/FieStateMachineStatusEffectPull.cs new file mode 100644 index 0000000..f4484e6 --- /dev/null +++ b/src/Fie.Object/FieStateMachineStatusEffectPull.cs @@ -0,0 +1,87 @@ +using Fie.Enemies; +using Fie.Utility; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Object +{ + public class FieStateMachineStatusEffectPull : FieStateMachineGameCharacterBase + { + private enum PullState + { + PULL_START, + PULLING, + PULL_END + } + + private Tweener _pullTweener = new Tweener(); + + private Vector3 _pullPoint = Vector3.zero; + + private PullState _pullState; + + private float _duration; + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = true; + } + + public void setDuration(float duration) + { + _duration = duration; + _pullTweener.InitTweener(_duration, _pullTweener.getStartParamVec3(), _pullPoint); + } + + public void setPullPoint(Vector3 point) + { + _pullPoint = point; + _pullTweener.InitTweener(_duration, _pullTweener.getStartParamVec3(), _pullPoint); + } + + public override void updateState(ref T gameCharacter) + { + switch (_pullState) + { + case PullState.PULL_START: + if (gameCharacter is FieObjectEnemies) + { + gameCharacter.animationManager.SetAnimation(3, isLoop: false, isForceSet: true); + } + _pullTweener.InitTweener(_duration, gameCharacter.position, _pullPoint); + _pullState = PullState.PULLING; + break; + case PullState.PULLING: + if (_pullPoint != Vector3.zero) + { + Vector3 vector = _pullTweener.UpdateParameterVec3(Time.deltaTime); + gameCharacter.currentMovingVec += (vector - gameCharacter.position) * (1f / Time.deltaTime); + gameCharacter.GetComponent().MovePosition(vector); + } + break; + } + _duration -= Time.deltaTime; + } + + public override bool isEnd() + { + return _duration <= 0f; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Object/FieStatusEffectEntityBase.cs b/src/Fie.Object/FieStatusEffectEntityBase.cs new file mode 100644 index 0000000..81d7c74 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectEntityBase.cs @@ -0,0 +1,20 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public abstract class FieStatusEffectEntityBase + { + public bool isActive = true; + + public bool isOnlyStatusEffect; + + public float duration; + + public bool ApplyStatusEffect(FieDamageSystem healthSystem, FieGameCharacter attacker, FieDamage damage) + { + healthSystem.applyStatusEffectCallback(this, attacker, damage); + return isOnlyStatusEffect; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsBase.cs b/src/Fie.Object/FieStatusEffectsBase.cs new file mode 100644 index 0000000..1da8265 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsBase.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +namespace Fie.Object +{ + public class FieStatusEffectsBase : MonoBehaviour + { + [SerializeField] + protected bool _isActive = true; + + [SerializeField] + protected bool _isOnlyStatusEffect; + + [SerializeField] + protected float _duration; + + protected FieStatusEffectEntityBase _entity; + + protected void Awake() + { + FieEmittableObjectBase component = GetComponent(); + if (!(component == null)) + { + if (_entity == null) + { + _entity = GetStatusEffectEntity(); + } + _entity.isOnlyStatusEffect = _isOnlyStatusEffect; + _entity.duration = _duration; + component.AddStatusEffect(_entity); + } + } + + public virtual FieStatusEffectEntityBase GetStatusEffectEntity() + { + return null; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttack.cs b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttack.cs new file mode 100644 index 0000000..5a091da --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttack.cs @@ -0,0 +1,126 @@ +using UnityEngine; + +namespace Fie.Object +{ + public sealed class FieStatusEffectsBuffAndDebuffToAttack : FieStatusEffectsBase + { + [SerializeField] + private int _skillID = -1; + + [SerializeField] + private int _abilityID = -1; + + [SerializeField] + private float _magni; + + [SerializeField] + private bool _isEnableStack; + + public bool isActive + { + get + { + return _isActive; + } + set + { + _isActive = value; + if (_entity != null) + { + _entity.isActive = _isActive; + } + } + } + + public float duration + { + get + { + return _duration; + } + set + { + _duration = value; + if (_entity != null) + { + _entity.duration = _duration; + } + } + } + + public int skillID + { + get + { + return _skillID; + } + set + { + _skillID = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToAttackEntity).skillID = _skillID; + } + } + } + + public int abilityID + { + get + { + return _abilityID; + } + set + { + _abilityID = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToAttackEntity).abilityID = _abilityID; + } + } + } + + public float magni + { + get + { + return _magni; + } + set + { + _magni = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToAttackEntity).magni = _magni; + } + } + } + + public bool isEnableStack + { + get + { + return _isEnableStack; + } + set + { + _isEnableStack = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToAttackEntity).isEnableStack = _isEnableStack; + } + } + } + + public new void Awake() + { + _entity = new FieStatusEffectsBuffAndDebuffToAttackEntity(); + base.Awake(); + } + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + return _entity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttackEntity.cs b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttackEntity.cs new file mode 100644 index 0000000..feec46e --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToAttackEntity.cs @@ -0,0 +1,16 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsBuffAndDebuffToAttackEntity : FieStatusEffectEntityBase + { + public int skillID = -1; + + public int abilityID = -1; + + public float magni; + + public bool isEnableStack; + } +} diff --git a/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffence.cs b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffence.cs new file mode 100644 index 0000000..3b2bd6a --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffence.cs @@ -0,0 +1,107 @@ +using UnityEngine; + +namespace Fie.Object +{ + public sealed class FieStatusEffectsBuffAndDebuffToDeffence : FieStatusEffectsBase + { + [SerializeField] + public int _skillID = -1; + + [SerializeField] + public float _magni; + + [SerializeField] + public bool _isEnableStack; + + public bool isActive + { + get + { + return _isActive; + } + set + { + _isActive = value; + if (_entity != null) + { + _entity.isActive = _isActive; + } + } + } + + public float duration + { + get + { + return _duration; + } + set + { + _duration = value; + if (_entity != null) + { + _entity.duration = _duration; + } + } + } + + public int skillID + { + get + { + return _skillID; + } + set + { + _skillID = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToDeffenceEntity).skillID = _skillID; + } + } + } + + public float magni + { + get + { + return _magni; + } + set + { + _magni = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToDeffenceEntity).magni = _magni; + } + } + } + + public bool isEnableStack + { + get + { + return _isEnableStack; + } + set + { + _isEnableStack = value; + if (_entity != null) + { + (_entity as FieStatusEffectsBuffAndDebuffToDeffenceEntity).isEnableStack = _isEnableStack; + } + } + } + + public new void Awake() + { + _entity = new FieStatusEffectsBuffAndDebuffToDeffenceEntity(); + base.Awake(); + } + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + return _entity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffenceEntity.cs b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffenceEntity.cs new file mode 100644 index 0000000..d9c8731 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsBuffAndDebuffToDeffenceEntity.cs @@ -0,0 +1,14 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsBuffAndDebuffToDeffenceEntity : FieStatusEffectEntityBase + { + public int skillID = -1; + + public float magni; + + public bool isEnableStack; + } +} diff --git a/src/Fie.Object/FieStatusEffectsGrab.cs b/src/Fie.Object/FieStatusEffectsGrab.cs new file mode 100644 index 0000000..6d0e415 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsGrab.cs @@ -0,0 +1,12 @@ +namespace Fie.Object +{ + public sealed class FieStatusEffectsGrab : FieStatusEffectsBase + { + public new FieStatusEffectsGrabEntity _entity; + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + return _entity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsGrabEntity.cs b/src/Fie.Object/FieStatusEffectsGrabEntity.cs new file mode 100644 index 0000000..05d715d --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsGrabEntity.cs @@ -0,0 +1,9 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsGrabEntity : FieStatusEffectEntityBase + { + } +} diff --git a/src/Fie.Object/FieStatusEffectsPull.cs b/src/Fie.Object/FieStatusEffectsPull.cs new file mode 100644 index 0000000..060b68f --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsPull.cs @@ -0,0 +1,12 @@ +namespace Fie.Object +{ + public sealed class FieStatusEffectsPull : FieStatusEffectsBase + { + public new FieStatusEffectsPullEntity _entity; + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + return _entity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsPullEntity.cs b/src/Fie.Object/FieStatusEffectsPullEntity.cs new file mode 100644 index 0000000..9618fa4 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsPullEntity.cs @@ -0,0 +1,31 @@ +using System; +using UnityEngine; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsPullEntity : FieStatusEffectEntityBase + { + public float x; + + public float y; + + public float z; + + public float pullDuration; + + public Vector3 pullPosition + { + get + { + return new Vector3(x, y, z); + } + set + { + x = value.x; + y = value.y; + z = value.z; + } + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsRift.cs b/src/Fie.Object/FieStatusEffectsRift.cs new file mode 100644 index 0000000..c37cdea --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsRift.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace Fie.Object +{ + public sealed class FieStatusEffectsRift : FieStatusEffectsBase + { + [SerializeField] + private float _riftForceRate = 1f; + + [SerializeField] + private bool _resetMoveForce; + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + FieStatusEffectsRiftEntity fieStatusEffectsRiftEntity = new FieStatusEffectsRiftEntity(); + fieStatusEffectsRiftEntity.riftForceRate = _riftForceRate; + fieStatusEffectsRiftEntity.resetMoveForce = _resetMoveForce; + return fieStatusEffectsRiftEntity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsRiftEntity.cs b/src/Fie.Object/FieStatusEffectsRiftEntity.cs new file mode 100644 index 0000000..16d3745 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsRiftEntity.cs @@ -0,0 +1,12 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsRiftEntity : FieStatusEffectEntityBase + { + public float riftForceRate = 1f; + + public bool resetMoveForce; + } +} diff --git a/src/Fie.Object/FieStatusEffectsTimeScaler.cs b/src/Fie.Object/FieStatusEffectsTimeScaler.cs new file mode 100644 index 0000000..7cce6a5 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsTimeScaler.cs @@ -0,0 +1,69 @@ +using UnityEngine; + +namespace Fie.Object +{ + public sealed class FieStatusEffectsTimeScaler : FieStatusEffectsBase + { + [SerializeField] + private float _targetTimeScale = 1f; + + public bool isActive + { + get + { + return _isActive; + } + set + { + _isActive = value; + if (_entity != null) + { + _entity.isActive = _isActive; + } + } + } + + public float duration + { + get + { + return _duration; + } + set + { + _duration = value; + if (_entity != null) + { + _entity.duration = _duration; + } + } + } + + public float targetTimeScale + { + get + { + return _targetTimeScale; + } + set + { + _targetTimeScale = value; + if (_entity != null) + { + (_entity as FieStatusEffectsTimeScalerEntity).targetTimeScale = _targetTimeScale; + } + } + } + + public new void Awake() + { + _entity = new FieStatusEffectsTimeScalerEntity(); + base.Awake(); + } + + public override FieStatusEffectEntityBase GetStatusEffectEntity() + { + return _entity; + } + } +} diff --git a/src/Fie.Object/FieStatusEffectsTimeScalerEntity.cs b/src/Fie.Object/FieStatusEffectsTimeScalerEntity.cs new file mode 100644 index 0000000..e496fa4 --- /dev/null +++ b/src/Fie.Object/FieStatusEffectsTimeScalerEntity.cs @@ -0,0 +1,10 @@ +using System; + +namespace Fie.Object +{ + [Serializable] + public class FieStatusEffectsTimeScalerEntity : FieStatusEffectEntityBase + { + public float targetTimeScale = 1f; + } +} diff --git a/src/Fie.Object/StateChangeDelegate.cs b/src/Fie.Object/StateChangeDelegate.cs new file mode 100644 index 0000000..0696056 --- /dev/null +++ b/src/Fie.Object/StateChangeDelegate.cs @@ -0,0 +1,6 @@ +using System; + +namespace Fie.Object +{ + public delegate void StateChangeDelegate(Type fromState, Type toState); +} diff --git a/src/Fie.Object/StatusEeffectType.cs b/src/Fie.Object/StatusEeffectType.cs new file mode 100644 index 0000000..3e207d7 --- /dev/null +++ b/src/Fie.Object/StatusEeffectType.cs @@ -0,0 +1,12 @@ +namespace Fie.Object +{ + public enum StatusEeffectType + { + NONE = -1, + Rifted, + Burning, + Stunned, + Paralyzed, + MAX_STATUS_EFFECTS + } +} diff --git a/src/Fie.PlayMaker/FieActivityManagerForPlaymaker.cs b/src/Fie.PlayMaker/FieActivityManagerForPlaymaker.cs new file mode 100644 index 0000000..07b903b --- /dev/null +++ b/src/Fie.PlayMaker/FieActivityManagerForPlaymaker.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using GameDataEditor; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieActivityManagerForPlaymaker : FsmStateAction + { + public enum ActivityActionType + { + SHOW, + HIDE + } + + [RequiredField] + public ActivityActionType activityType; + + [RequiredField] + public string titleTextKey; + + [RequiredField] + public string noteTextKey; + + [RequiredField] + public float showingTime; + + [RequiredField] + public bool forceSet; + + [RequiredField] + public FsmEvent nextEvent; + + public override void OnUpdate() + { + switch (activityType) + { + case ActivityActionType.SHOW: + if (forceSet || !FieManagerBehaviour.I.IsShowingAnyActivity()) + { + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(titleTextKey), FieMasterData.I.GetMasterData(noteTextKey), showingTime); + base.Fsm.Event(nextEvent); + Finish(); + } + break; + case ActivityActionType.HIDE: + FieManagerBehaviour.I.RequestToHideActivity(); + base.Fsm.Event(nextEvent); + Finish(); + break; + } + } + } +} diff --git a/src/Fie.PlayMaker/FieFaderManagerForPlayMaker.cs b/src/Fie.PlayMaker/FieFaderManagerForPlayMaker.cs new file mode 100644 index 0000000..b68ae3f --- /dev/null +++ b/src/Fie.PlayMaker/FieFaderManagerForPlayMaker.cs @@ -0,0 +1,45 @@ +using Fie.Manager; +using HutongGames.PlayMaker; +using UnityEngine; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieFaderManagerForPlayMaker : FsmStateAction + { + public FieFaderManager.FadeType fadeType; + + public float fadeTime = 1f; + + public float delay; + + private float delayCount; + + private bool isLaunched; + + public override void Reset() + { + delayCount = 0f; + isLaunched = false; + } + + public override void OnUpdate() + { + if (!isLaunched) + { + if (delayCount <= delay) + { + delayCount += Time.deltaTime; + } + else + { + if (delayCount >= delay && fadeType != 0) + { + FieManagerBehaviour.I.LaunchFader(fadeType, fadeTime); + } + isLaunched = true; + } + } + } + } +} diff --git a/src/Fie.PlayMaker/FieLanguageChangerForPlaymaker.cs b/src/Fie.PlayMaker/FieLanguageChangerForPlaymaker.cs new file mode 100644 index 0000000..700537a --- /dev/null +++ b/src/Fie.PlayMaker/FieLanguageChangerForPlaymaker.cs @@ -0,0 +1,20 @@ +using Fie.Manager; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieLanguageChangerForPlaymaker : FsmStateAction + { + public override void OnEnter() + { + FieEnvironmentManager.Language targetLanguage = FieEnvironmentManager.Language.French; + if (FieManagerBehaviour.I.currentLanguage == FieEnvironmentManager.Language.French) + { + targetLanguage = FieEnvironmentManager.Language.Japanese; + } + FieManagerBehaviour.I.SetLanguageSetting(targetLanguage); + Finish(); + } + } +} diff --git a/src/Fie.PlayMaker/FieLobbyCharacterSelectUIControllerForPlayMaker.cs b/src/Fie.PlayMaker/FieLobbyCharacterSelectUIControllerForPlayMaker.cs new file mode 100644 index 0000000..f56e74c --- /dev/null +++ b/src/Fie.PlayMaker/FieLobbyCharacterSelectUIControllerForPlayMaker.cs @@ -0,0 +1,66 @@ +using Fie.UI; +using HutongGames.PlayMaker; +using UnityEngine; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieLobbyCharacterSelectUIControllerForPlayMaker : FsmStateAction + { + public enum FieLobbyElementSelectUIActionType + { + ENABLE, + DISABLE, + INCREASE, + DECREASE, + DECIDE + } + + public FieLobbyElementSelectUIActionType eventType; + + [RequiredField] + [CheckForComponent(typeof(FieLobbyCharacterSelectUIController))] + public FsmOwnerDefault controllerObject; + + private FieLobbyCharacterSelectUIController _controllerComponent; + + public override void Reset() + { + controllerObject = null; + } + + public override void OnEnter() + { + if (!base.Finished && controllerObject != null) + { + GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(controllerObject); + if (!(ownerDefaultTarget == null)) + { + _controllerComponent = ownerDefaultTarget.GetComponent(); + if (_controllerComponent != null) + { + switch (eventType) + { + case FieLobbyElementSelectUIActionType.ENABLE: + _controllerComponent.isEnable = true; + break; + case FieLobbyElementSelectUIActionType.DISABLE: + _controllerComponent.isEnable = false; + break; + case FieLobbyElementSelectUIActionType.INCREASE: + _controllerComponent.IncreaseElementIndex(); + break; + case FieLobbyElementSelectUIActionType.DECREASE: + _controllerComponent.DecreaseElementIndex(); + break; + case FieLobbyElementSelectUIActionType.DECIDE: + _controllerComponent.Decide(); + break; + } + } + Finish(); + } + } + } + } +} diff --git a/src/Fie.PlayMaker/FieLobbyElementSelectUIButtonForPlaymaker.cs b/src/Fie.PlayMaker/FieLobbyElementSelectUIButtonForPlaymaker.cs new file mode 100644 index 0000000..223e98d --- /dev/null +++ b/src/Fie.PlayMaker/FieLobbyElementSelectUIButtonForPlaymaker.cs @@ -0,0 +1,31 @@ +using Fie.UI; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieLobbyElementSelectUIButtonForPlaymaker : FsmStateAction + { + [RequiredField] + public FieLobbyCharacterSelectUIController controller; + + [RequiredField] + public FsmEvent SucseedEvent; + + [RequiredField] + public FsmEvent FeildEvent; + + public override void OnEnter() + { + if (controller.isDecidable()) + { + base.Fsm.Event(SucseedEvent); + } + else + { + base.Fsm.Event(FeildEvent); + } + Finish(); + } + } +} diff --git a/src/Fie.PlayMaker/FieLobbyNameEntryUIControllerForPlayMaker.cs b/src/Fie.PlayMaker/FieLobbyNameEntryUIControllerForPlayMaker.cs new file mode 100644 index 0000000..13dbb49 --- /dev/null +++ b/src/Fie.PlayMaker/FieLobbyNameEntryUIControllerForPlayMaker.cs @@ -0,0 +1,38 @@ +using Fie.UI; +using HutongGames.PlayMaker; +using UnityEngine; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieLobbyNameEntryUIControllerForPlayMaker : FsmStateAction + { + [RequiredField] + [CheckForComponent(typeof(FieLobbyNameEntryUIController))] + public FsmOwnerDefault controllerObject; + + private FieLobbyNameEntryUIController _controllerComponent; + + public override void Reset() + { + controllerObject = null; + } + + public override void OnEnter() + { + if (!base.Finished && controllerObject != null) + { + GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(controllerObject); + if (!(ownerDefaultTarget == null)) + { + _controllerComponent = ownerDefaultTarget.GetComponent(); + if (_controllerComponent != null) + { + _controllerComponent.Decide(); + } + Finish(); + } + } + } + } +} diff --git a/src/Fie.PlayMaker/FieLobbySelectableUIForPlaymaker.cs b/src/Fie.PlayMaker/FieLobbySelectableUIForPlaymaker.cs new file mode 100644 index 0000000..bd7e33b --- /dev/null +++ b/src/Fie.PlayMaker/FieLobbySelectableUIForPlaymaker.cs @@ -0,0 +1,40 @@ +using Fie.UI; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieLobbySelectableUIForPlaymaker : FsmStateAction + { + public bool waitingMode; + + public FsmEvent transitionEvent; + + [RequiredField] + public FieLobbySelectableUIController controller; + + [RequiredField] + public FieLobbySelectableUIController.SelectableWindowState _targetState; + + public override void OnEnter() + { + if (!waitingMode) + { + controller.ChangeState(_targetState); + Finish(); + } + } + + public override void OnUpdate() + { + if (waitingMode) + { + if (controller.currentState == _targetState) + { + base.Fsm.Event(transitionEvent); + } + Finish(); + } + } + } +} diff --git a/src/Fie.PlayMaker/FieNetworkManagerForPlaymaker.cs b/src/Fie.PlayMaker/FieNetworkManagerForPlaymaker.cs new file mode 100644 index 0000000..bab5cdf --- /dev/null +++ b/src/Fie.PlayMaker/FieNetworkManagerForPlaymaker.cs @@ -0,0 +1,74 @@ +using Fie.Manager; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieNetworkManagerForPlaymaker : FsmStateAction + { + public enum FieNetworkActionType + { + CREATE_GLOBAL_MATCH, + CREATE_LOCAL_MATCH, + JOIN_MATCH, + DISCONNECT + } + + [RequiredField] + public FsmEvent SucseedEvent; + + [RequiredField] + public FsmEvent FeildEvent; + + public FieNetworkActionType actionType; + + public override void OnEnter() + { + switch (actionType) + { + case FieNetworkActionType.CREATE_GLOBAL_MATCH: + if (!PhotonNetwork.offlineMode) + { + FieManagerBehaviour.I.CreateNetowkRoom(delegate(FieNetworkManager.FieNetowrkErrorCode errorCode) + { + ClacNetworkResponse(errorCode == FieNetworkManager.FieNetowrkErrorCode.SUCCEED); + }, string.Empty); + } + else + { + PhotonPlayer player = PhotonNetwork.player; + player.name = "Player 1"; + FieManagerBehaviour.I.RegistUser(player); + ClacNetworkResponse(); + } + break; + case FieNetworkActionType.JOIN_MATCH: + if (PhotonNetwork.offlineMode) + { + ClacNetworkResponse(response: false); + } + else + { + FieManagerBehaviour.I.JoinNetowkRoom(delegate(FieNetworkManager.FieNetowrkErrorCode errorCode) + { + ClacNetworkResponse(errorCode == FieNetworkManager.FieNetowrkErrorCode.SUCCEED); + }, null); + } + break; + } + } + + private void ClacNetworkResponse(bool response = true) + { + if (response) + { + base.Fsm.Event(SucseedEvent); + } + else + { + base.Fsm.Event(FeildEvent); + } + Finish(); + } + } +} diff --git a/src/Fie.PlayMaker/FieResultActionForPlaymaker.cs b/src/Fie.PlayMaker/FieResultActionForPlaymaker.cs new file mode 100644 index 0000000..a0aecdf --- /dev/null +++ b/src/Fie.PlayMaker/FieResultActionForPlaymaker.cs @@ -0,0 +1,15 @@ +using HutongGames.PlayMaker; +using UnityEngine.SceneManagement; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieResultActionForPlaymaker : FsmStateAction + { + public override void OnEnter() + { + SceneManager.LoadScene(0, LoadSceneMode.Single); + Finish(); + } + } +} diff --git a/src/Fie.PlayMaker/FieSceneManagerForPlaymaker.cs b/src/Fie.PlayMaker/FieSceneManagerForPlaymaker.cs new file mode 100644 index 0000000..b2063bc --- /dev/null +++ b/src/Fie.PlayMaker/FieSceneManagerForPlaymaker.cs @@ -0,0 +1,59 @@ +using Fie.Manager; +using Fie.Scene; +using HutongGames.PlayMaker; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieSceneManagerForPlaymaker : FsmStateAction + { + public FieFaderManager.FadeType outFadeType; + + public FieFaderManager.FadeType inFadeType; + + public float fadeTime; + + public bool useLoadScreen; + + public float minLoadScreenViewSec; + + public FieConstValues.DefinedScenes nextScene; + + private readonly Dictionary _sceneList = new Dictionary + { + { + FieConstValues.DefinedScenes.FIE_TITLE, + new FieSceneTitle() + }, + { + FieConstValues.DefinedScenes.FIE_LOBBY, + new FieSceneLobby() + } + }; + + public override void OnEnter() + { + if (nextScene != FieConstValues.DefinedScenes.UNDEFINED) + { + if (!_sceneList.ContainsKey(nextScene)) + { + Debug.LogError("A requested scene class dosen't exist. Name : " + nextScene.ToString()); + } + else if (inFadeType != 0) + { + FieManagerBehaviour.I.LoadScene(_sceneList[nextScene], allowSceneActivation: true, outFadeType, inFadeType, fadeTime, useLoadScreen, minLoadScreenViewSec); + } + else if (outFadeType != 0) + { + FieManagerBehaviour.I.LoadScene(_sceneList[nextScene], allowSceneActivation: true, outFadeType, fadeTime); + } + else + { + FieManagerBehaviour.I.LoadScene(_sceneList[nextScene]); + } + } + } + } +} diff --git a/src/Fie.PlayMaker/FieTitleActionForPlaymaker.cs b/src/Fie.PlayMaker/FieTitleActionForPlaymaker.cs new file mode 100644 index 0000000..ac487f3 --- /dev/null +++ b/src/Fie.PlayMaker/FieTitleActionForPlaymaker.cs @@ -0,0 +1,32 @@ +using Fie.Manager; +using Fie.Scene; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieTitleActionForPlaymaker : FsmStateAction + { + public float fadeTime; + + [RequiredField] + public FsmEvent EventToSend; + + private FieSceneManager.FieLoadingSceneJob _loadSceneJob; + + public override void OnEnter() + { + _loadSceneJob = FieManagerBehaviour.I.LoadScene(new FieSceneLobby(), allowSceneActivation: false, FieFaderManager.FadeType.OUT_TO_WHITE, FieFaderManager.FadeType.IN_FROM_WHITE, fadeTime); + } + + public override void OnUpdate() + { + if (_loadSceneJob.isDoneLoading) + { + _loadSceneJob.allowSceneActivation = true; + base.Fsm.Event(EventToSend); + Finish(); + } + } + } +} diff --git a/src/Fie.PlayMaker/FieTitleLoginActionForPlayMaker.cs b/src/Fie.PlayMaker/FieTitleLoginActionForPlayMaker.cs new file mode 100644 index 0000000..8506fa3 --- /dev/null +++ b/src/Fie.PlayMaker/FieTitleLoginActionForPlayMaker.cs @@ -0,0 +1,40 @@ +using Fie.Title; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieTitleLoginActionForPlayMaker : FsmStateAction + { + [RequiredField] + public FieTitleAuthController _titleAuthActionComponent; + + [RequiredField] + public FsmEvent EventToSend; + + public override void OnEnter() + { + if (!base.Finished) + { + if (_titleAuthActionComponent != null) + { + _titleAuthActionComponent.finishedEvent += loginCallback; + } + FieTitleAuthController.RecomendedLoginState recomendedLoginState = _titleAuthActionComponent.GetRecomendedLoginState(); + _titleAuthActionComponent.SetupLoginComponents(recomendedLoginState); + } + } + + private void loginCallback() + { + base.Fsm.Event(EventToSend); + Finish(); + } + + public override void OnExit() + { + _titleAuthActionComponent.finishedEvent -= loginCallback; + base.OnExit(); + } + } +} diff --git a/src/Fie.PlayMaker/FieUIMouseEventForPlayMaker.cs b/src/Fie.PlayMaker/FieUIMouseEventForPlayMaker.cs new file mode 100644 index 0000000..ab4f901 --- /dev/null +++ b/src/Fie.PlayMaker/FieUIMouseEventForPlayMaker.cs @@ -0,0 +1,99 @@ +using Fie.UI; +using HutongGames.PlayMaker; +using UnityEngine; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieUIMouseEventForPlayMaker : FsmStateAction + { + public enum FieUIEventTypeForPlayMaker + { + OVER, + EXIT, + CLICK, + SHOW, + HIDE + } + + public FieUIEventTypeForPlayMaker eventType; + + [RequiredField] + [CheckForComponent(typeof(FieUIMouseEvent))] + public FsmOwnerDefault mouseEventObject; + + [RequiredField] + public FsmEvent eventToSend; + + private FieUIMouseEvent _mouseEventComponent; + + public override void Reset() + { + mouseEventObject = null; + eventToSend = null; + } + + public override void Awake() + { + if (mouseEventObject != null) + { + GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(mouseEventObject); + if (!(ownerDefaultTarget == null)) + { + _mouseEventComponent = ownerDefaultTarget.GetComponent(); + if (_mouseEventComponent != null) + { + _mouseEventComponent.mouseOverEvent -= MouseEventCallback; + _mouseEventComponent.mouseExitEvent -= MouseEventCallback; + _mouseEventComponent.mouseClickEvent -= MouseEventCallback; + switch (eventType) + { + case FieUIEventTypeForPlayMaker.OVER: + _mouseEventComponent.mouseOverEvent += MouseEventCallback; + break; + case FieUIEventTypeForPlayMaker.EXIT: + _mouseEventComponent.mouseExitEvent += MouseEventCallback; + break; + case FieUIEventTypeForPlayMaker.CLICK: + _mouseEventComponent.mouseClickEvent += MouseEventCallback; + break; + } + } + } + } + } + + public override void OnEnter() + { + if (eventType == FieUIEventTypeForPlayMaker.SHOW || eventType == FieUIEventTypeForPlayMaker.HIDE) + { + _mouseEventComponent._isEnable = (eventType == FieUIEventTypeForPlayMaker.SHOW); + base.Fsm.Event(eventToSend); + Finish(); + } + } + + public override void OnUpdate() + { + if (!(_mouseEventComponent == null) && _mouseEventComponent._isEnable) + { + if (_mouseEventComponent.mouseOverState == FieUIMouseEvent.FieUIMouseOverState.MOUSE_OVER && eventType == FieUIEventTypeForPlayMaker.OVER) + { + base.Fsm.Event(eventToSend); + Finish(); + } + if (_mouseEventComponent.mouseOverState == FieUIMouseEvent.FieUIMouseOverState.MOUSE_IDLE && eventType == FieUIEventTypeForPlayMaker.EXIT) + { + base.Fsm.Event(eventToSend); + Finish(); + } + } + } + + private void MouseEventCallback(bool isHit, Vector3 point) + { + base.Fsm.Event(eventToSend); + Finish(); + } + } +} diff --git a/src/Fie.PlayMaker/FieUIOptionWindowForPlayMaker.cs b/src/Fie.PlayMaker/FieUIOptionWindowForPlayMaker.cs new file mode 100644 index 0000000..12f05f5 --- /dev/null +++ b/src/Fie.PlayMaker/FieUIOptionWindowForPlayMaker.cs @@ -0,0 +1,64 @@ +using Fie.UI; +using HutongGames.PlayMaker; + +namespace Fie.PlayMaker +{ + [ActionCategory("Friendship is Epic")] + public class FieUIOptionWindowForPlayMaker : FsmStateAction + { + public enum OptionScreenActionType + { + OPEN, + WAIT_FOR_CLOSE + } + + [RequiredField] + public OptionScreenActionType _optionScreenActionType; + + [RequiredField] + public FieUIOptionWindow _optionScreenComponent; + + [RequiredField] + public FsmEvent EventToSend; + + public override void OnEnter() + { + if (!base.Finished) + { + if (_optionScreenComponent == null) + { + base.Fsm.Event(EventToSend); + Finish(); + } + else + { + switch (_optionScreenActionType) + { + case OptionScreenActionType.OPEN: + _optionScreenComponent.gameObject.SetActive(value: true); + _optionScreenComponent.ShowOptionalScreen(); + base.Fsm.Event(EventToSend); + Finish(); + break; + case OptionScreenActionType.WAIT_FOR_CLOSE: + _optionScreenComponent.gameObject.SetActive(value: true); + _optionScreenComponent.optionScreenCloseEvent += closedCallback; + break; + } + } + } + } + + private void closedCallback() + { + base.Fsm.Event(EventToSend); + Finish(); + } + + public override void OnExit() + { + _optionScreenComponent.optionScreenCloseEvent -= closedCallback; + base.OnExit(); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieApplejack.cs b/src/Fie.Ponies.Applejack/FieApplejack.cs new file mode 100644 index 0000000..930fde4 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieApplejack.cs @@ -0,0 +1,209 @@ +using Fie.AI; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.UI; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Applejack")] + public class FieApplejack : FiePonies, FiePlayableGameCharacterInterface + { + private bool _isHeavyKickMode; + + private float _kickDamageRatio = 1f; + + private float _reducingCooltimeWithKick; + + private float _reducingShieldRateWithKick; + + private bool _hasTountSkill; + + private bool _isTauntMode; + + private float _tauntDamageRate; + + public bool isHeavyKickMode => _isHeavyKickMode; + + public float kickDamageRatio => _kickDamageRatio; + + public bool hasTountSkill => _hasTountSkill; + + public bool isTauntMode + { + get + { + return _isTauntMode; + } + set + { + _isTauntMode = value; + } + } + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineApplejackBaseAttack); + } + + public override Type getStormState() + { + return typeof(FieStateMachineApplejackEvasion); + } + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieApplejackAnimationContainer()); + _staggerCancelableStateList.Add(typeof(FieStateMachineApplejackFireRope)); + _staggerCancelableStateList.Add(typeof(FieStateMachineApplejackFireAir)); + abstractStateList.Add(typeof(FieStateMachinePoniesJump), typeof(FieStateMachineApplejackJump)); + abstractStateList.Add(typeof(FieStateMachinePoniesEvasion), typeof(FieStateMachineApplejackEvasion)); + abstractStateList.Add(typeof(FieStateMachinePoniesBaseAttack), typeof(FieStateMachineApplejackBaseAttack)); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_1, new FieStateMachineApplejackRope()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_2, new FieStateMachineApplejackYeehaw()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_3, new FieStateMachineApplejackStomp()); + syncBindedAbilities(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + base.emotionController.SetDefaultEmoteAnimationID(15); + base.emotionController.RestoreEmotionFromDefaultData(); + ReCalcSkillData(); + base.damageSystem.beforeDamageEvent += this.ApplyYeehawTauntSkill; + base.detector.intoTheBattleEvent += Detector_intoTheBattleEvent; + } + + protected override void ReCalcSkillData() + { + _isHeavyKickMode = false; + _kickDamageRatio = 1f; + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.HONESTY_ATTACK_PASSIVE_LV4_HIGH_RISK_AND_HIGH_RETURN); + if (skill != null) + { + _isHeavyKickMode = true; + _kickDamageRatio = skill.Value1; + } + GDESkillTreeData skill2 = GetSkill(FieConstValues.FieSkill.HONESTY_ATTACK_PASSIVE_LV4_BATTLE_CYCLE); + if (skill2 != null) + { + _reducingCooltimeWithKick = skill2.Value1; + _reducingShieldRateWithKick = skill2.Value2; + } + GDESkillTreeData skill3 = GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV4_TAUNT); + if (skill3 != null) + { + _tauntDamageRate = skill3.Value1; + } + } + + private void ApplyYeehawTauntSkill(FieGameCharacter attacker, ref FieDamage damage) + { + if (damage != null && attacker != null && isTauntMode) + { + FieDamage damageObject = new FieDamage(FieAttribute.NONE, damage.damage * _tauntDamageRate, 0f, 0f, 0f, null); + attacker.AddDamage(this, damageObject); + } + } + + internal void ApplyShoutAdditionalDamage(ref FieDamage damageObject) + { + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV2_1); + if (skill != null) + { + damageObject.damage += skill.Value1; + } + } + + public void applySideEffectOfStep() + { + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.HONESTY_DIFFENCE_PASSIVE_LV4_OFFENSIVE_STEP); + if (skill != null) + { + base.damageSystem.AddAttackMagni(1031, skill.Value2, skill.Value1, -1, isEnableStack: true); + base.damageSystem.calcShieldDirect(healthStats.maxShield * (0f - skill.Value3)); + base.damageSystem.setRegenerateDelay(healthStats.regenerateDelay * 0.5f, roundToBigger: true); + } + GDESkillTreeData skill2 = GetSkill(FieConstValues.FieSkill.HONESTY_DIFFENCE_PASSIVE_LV4_DEFFENSIVE_STEP); + if (skill2 != null) + { + base.damageSystem.AddDefenceMagni(1032, skill2.Value2, skill2.Value1, isEnableStack: true); + base.abilitiesContainer.IncreaseOrReduceCooldownAll(skill2.Value3); + } + } + + private void Detector_intoTheBattleEvent(FieGameCharacter targetCharacter) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ENEMY_DETECTED)); + } + + protected new void Start() + { + base.Start(); + getStateMachine(StateMachineType.Attack).setState(typeof(FieStateMachinePoniesAttackIdle), isForceSet: true); + getStateMachine().setState(typeof(FieStateMachineCommonIdle), isForceSet: false); + } + + public void CalcBatteCicleSkill() + { + if (_reducingShieldRateWithKick > 0f) + { + base.damageSystem.calcShieldDirect(healthStats.maxShield * (0f - _reducingShieldRateWithKick)); + base.damageSystem.setRegenerateDelay(healthStats.regenerateDelay * 0.25f, roundToBigger: true); + } + if (_reducingCooltimeWithKick > 0f) + { + base.abilitiesContainer.IncreaseOrReduceCooldownAll(0f - _reducingCooltimeWithKick); + } + } + + public void ApplyKickDamageMagni(ref FieDamage damageObject) + { + if (damageObject != null) + { + damageObject.damage *= kickDamageRatio; + damageObject.stagger *= kickDamageRatio; + } + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ELEMENT_NAME_HONESTY_SIMPLE); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.HONESTY; + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskApplejackIdle); + } + + public override KeyValuePair getAbilitiesIconInfo() + { + return new KeyValuePair(typeof(FieGameUIAbilitiesIconApplejack), "Prefabs/UI/AbilitiesIcons/ApplejackAbilityIcon"); + } + + public override GDEGameCharacterTypeData getCharacterTypeData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.GameCharacterType_HONESTY); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieApplejackAnimationContainer.cs b/src/Fie.Ponies.Applejack/FieApplejackAnimationContainer.cs new file mode 100644 index 0000000..22e20c8 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieApplejackAnimationContainer.cs @@ -0,0 +1,65 @@ +using Fie.Object; + +namespace Fie.Ponies.Applejack +{ + public class FieApplejackAnimationContainer : FiePoniesAnimationContainer + { + public enum ApplejackAnimationList + { + JUMP_TAKEOFF = 19, + JUMP, + STEP, + FIRE_PUNCH, + FIRE_KICK, + FIRE_KICK_HEAVY, + FIRE_KICK_RIFT, + FIRE_KICK_RIFT_HEAVY, + FIRE_AIR, + FIRE_AIR_HEAVY, + FIRE_AIR_DOUBLE, + FIRE_AIR_DOUBLE_HEAVY, + FIRE_ROPE, + FIRE_ROPE_AIR, + ROPE_ACTION_AIR_RAID, + ROPE_ACTION_AIR_RAID_END, + ROPE_ACTION_END, + BACK_STEP, + YEEHAW, + YEEHAW_MID_AIR, + STOMP, + CHARGE, + EMOTION_ROPE, + EMOTION_NIHIL, + EMOTION_YEEHAW, + MAX_APPLEJACK_ANIMATION + } + + public FieApplejackAnimationContainer() + { + addAnimationData(19, new FieSkeletonAnimationObject(0, "jump")); + addAnimationData(20, new FieSkeletonAnimationObject(0, "fall")); + addAnimationData(22, new FieSkeletonAnimationObject(0, "fire_melee_punch")); + addAnimationData(23, new FieSkeletonAnimationObject(0, "fire_melee_kick")); + addAnimationData(24, new FieSkeletonAnimationObject(0, "fire_melee_kick_slow_1")); + addAnimationData(25, new FieSkeletonAnimationObject(0, "fire_melee_kick_rift")); + addAnimationData(26, new FieSkeletonAnimationObject(0, "fire_melee_kick_rift_slow_1")); + addAnimationData(27, new FieSkeletonAnimationObject(0, "fire_melee_air")); + addAnimationData(28, new FieSkeletonAnimationObject(0, "fire_melee_air_slow_1")); + addAnimationData(29, new FieSkeletonAnimationObject(0, "fire_melee_air_double")); + addAnimationData(30, new FieSkeletonAnimationObject(0, "fire_melee_air_double_slow_1")); + addAnimationData(31, new FieSkeletonAnimationObject(0, "fire_rope")); + addAnimationData(32, new FieSkeletonAnimationObject(0, "fire_rope_air")); + addAnimationData(33, new FieSkeletonAnimationObject(0, "fire_rope_airraid")); + addAnimationData(34, new FieSkeletonAnimationObject(0, "fire_rope_airraid_end")); + addAnimationData(35, new FieSkeletonAnimationObject(0, "fire_rope_end")); + addAnimationData(36, new FieSkeletonAnimationObject(0, "backstep")); + addAnimationData(40, new FieSkeletonAnimationObject(0, "charge")); + addAnimationData(37, new FieSkeletonAnimationObject(0, "yeehaw")); + addAnimationData(38, new FieSkeletonAnimationObject(0, "yeehaw_mid_air")); + addAnimationData(39, new FieSkeletonAnimationObject(0, "stomp")); + addAnimationData(41, new FieSkeletonAnimationObject(1, "emotion_rope")); + addAnimationData(42, new FieSkeletonAnimationObject(1, "emotion_nihil")); + addAnimationData(43, new FieSkeletonAnimationObject(1, "emotion_yeehaw")); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackAirKick.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackAirKick.cs new file mode 100644 index 0000000..296563d --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackAirKick.cs @@ -0,0 +1,73 @@ +using Fie.Manager; +using Fie.Object; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackAirKick")] + public class FieEmitObjectApplejackAirKick : FieEmittableObjectBase + { + [SerializeField] + private float APPLEJACK_AIR_KICK_DURATION = 1.5f; + + [SerializeField] + private float APPLEJACK_AIR_KICK_TRAIL_DURATION = 0.4f; + + [SerializeField] + private float APPLEJACK_AIR_KICK_DAMAGE_DURATION = 0.5f; + + [SerializeField] + private SmoothTrail _airKickTrail; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + _airKickTrail.Emit = true; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= APPLEJACK_AIR_KICK_TRAIL_DURATION) + { + _airKickTrail.Emit = false; + } + if (_lifeTimeCount >= APPLEJACK_AIR_KICK_DURATION) + { + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + base.transform.rotation = initTransform.rotation; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > APPLEJACK_AIR_KICK_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieDamage damageObject = getDefaultDamageObject(); + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.ApplyKickDamageMagni(ref damageObject); + } + FieGameCharacter x = addDamageToCollisionCharacter(collider, damageObject); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackCharge.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackCharge.cs new file mode 100644 index 0000000..aebbf83 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackCharge.cs @@ -0,0 +1,52 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackCharge")] + public class FieEmitObjectApplejackCharge : FieEmittableObjectBase + { + [SerializeField] + private float APPLEJACK_CHARGE_DURATION = 0.3f; + + [SerializeField] + private float APPLEJACK_CHARGE_DAMAGE_DURATION = 0.2f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= APPLEJACK_CHARGE_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > APPLEJACK_CHARGE_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + destoryEmitObject(APPLEJACK_CHARGE_DURATION - _lifeTimeCount); + _isEndUpdate = true; + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackChargeEffect.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackChargeEffect.cs new file mode 100644 index 0000000..adcc9e4 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackChargeEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackChargeEffect")] + public class FieEmitObjectApplejackChargeEffect : FieEmittableObjectBase + { + private const float DURATION = 0.6f; + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(0.6f); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectMiddle.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectMiddle.cs new file mode 100644 index 0000000..b7cd125 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectMiddle.cs @@ -0,0 +1,16 @@ +using Fie.Object; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackHitEffectMiddle")] + public class FieEmitObjectApplejackHitEffectMiddle : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + base.transform.position = directionalVec; + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectSmall.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectSmall.cs new file mode 100644 index 0000000..ef11f3e --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackHitEffectSmall.cs @@ -0,0 +1,16 @@ +using Fie.Object; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackHitEffectSmall")] + public class FieEmitObjectApplejackHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + base.transform.position = directionalVec; + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKick.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKick.cs new file mode 100644 index 0000000..4609664 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKick.cs @@ -0,0 +1,64 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackKick")] + public class FieEmitObjectApplejackKick : FieEmittableObjectBase + { + [SerializeField] + private float APPLEJACK_KICK_DURATION = 0.4f; + + [SerializeField] + private float APPLEJACK_KICK_DAMAGE_DURATION = 0.3f; + + [SerializeField] + private float APPLEJACK_KICK_PUSH_FORCE = 7f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= APPLEJACK_KICK_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > APPLEJACK_KICK_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieDamage damageObject = getDefaultDamageObject(); + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.ApplyKickDamageMagni(ref damageObject); + } + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, damageObject); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(directionalVec * APPLEJACK_KICK_PUSH_FORCE, 0f, useRound: false); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect.cs new file mode 100644 index 0000000..9972dfc --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackKickEffect")] + public class FieEmitObjectApplejackKickEffect : FieEmittableObjectBase + { + private const float DURATION = 0.6f; + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(0.6f); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect2.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect2.cs new file mode 100644 index 0000000..cc9e5ac --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickEffect2.cs @@ -0,0 +1,23 @@ +using Fie.Object; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackKickEffect2")] + public class FieEmitObjectApplejackKickEffect2 : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + + private void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickRift.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickRift.cs new file mode 100644 index 0000000..f6955dc --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackKickRift.cs @@ -0,0 +1,63 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackKickRift")] + public class FieEmitObjectApplejackKickRift : FieEmittableObjectBase + { + [SerializeField] + private float APPLEJACK_KICK_DURATION = 0.4f; + + [SerializeField] + private float APPLEJACK_KICK_DAMAGE_DURATION = 0.3f; + + [SerializeField] + private float APPLEJACK_KICK_PUSH_FORCE = 60f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= APPLEJACK_KICK_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > APPLEJACK_KICK_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieDamage damageObject = getDefaultDamageObject(); + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.ApplyKickDamageMagni(ref damageObject); + } + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, damageObject); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + fieGameCharacter.resetMoveForce(); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackPunch.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackPunch.cs new file mode 100644 index 0000000..0440a32 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackPunch.cs @@ -0,0 +1,50 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackPunch")] + public class FieEmitObjectApplejackPunch : FieEmittableObjectBase + { + [SerializeField] + private float APPLEJACK_PUNCH_DURATION = 0.3f; + + [SerializeField] + private float APPLEJACK_PUNCH_DAMAGE_DURATION = 0.2f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= APPLEJACK_PUNCH_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > APPLEJACK_PUNCH_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackRope.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackRope.cs new file mode 100644 index 0000000..e3eb4c1 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackRope.cs @@ -0,0 +1,329 @@ +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackRope")] + public class FieEmitObjectApplejackRope : FieEmittableObjectBase + { + private enum RopeState + { + ROPE_READY, + ROPE_SHOOTING, + ROPE_HITTING, + ROPE_END + } + + public float pullDuration = 0.5f; + + private const float ROPE_CURVE_MINIMUM = 0.0001f; + + private const float ROPE_CURVE_INIT = 0.001f; + + private const float ROPE_SCALE = 0.025f; + + private const float ROPE_END_SCALE = 0f; + + private float ROPE_MAX_RANGE = 10f; + + private RopeState _ropeState; + + [SerializeField] + private float RopeShotTime = 0.2f; + + [SerializeField] + private float RopeDuration = 1f; + + [SerializeField] + private float RopeDestroyPastTime = 0.8f; + + [SerializeField] + private float RopeStabilityHeight = 4f; + + [SerializeField] + private PhysicMaterial _ropePhysicalMaterial; + + [SerializeField] + private GameObject _ropeOrigin; + + [SerializeField] + private GameObject _ropeTop; + + [SerializeField] + private GameObject _ropeBackOrigin; + + [SerializeField] + private GameObject _ropeBackTop; + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private Vector3 _startPosition = Vector3.zero; + + private Vector3 _targetPosition = Vector3.zero; + + private Tweener _ropeDistanceTweener = new Tweener(); + + private Tweener _ropeScaleTweener = new Tweener(); + + private Tweener _ropeShotStabirityTweener = new Tweener(); + + private QuickRope2 _ropeObject; + + private QuickRope2 _backRopeObject; + + private QuickRope2Mesh _ropeMesh; + + private QuickRope2Mesh _backRopeMesh; + + private float _currentRopeCurve = 0.001f; + + private float _lastRopeCurve; + + private float _lastLopeScale; + + private Vector3 _targetPositionScatter = Vector3.zero; + + private Vector3 _pullPosition = Vector3.zero; + + private FieGameCharacter _hitGameCharacter; + + private FieStatusEffectsTimeScaler _timeScalerStatusEffectEntity; + + public void setPullPosition(Vector3 pullPosition) + { + _pullPosition = pullPosition; + } + + private void Awake() + { + _ropeObject = QuickRope2.Create(_ropeOrigin, _ropeTop, BasicRopeTypes.Mesh); + _backRopeObject = QuickRope2.Create(_ropeBackOrigin, _ropeBackTop, BasicRopeTypes.Mesh); + _ropeObject.mass = 1f; + _ropeObject.angDrag = 1f; + _ropeObject.drag = 1f; + _backRopeObject.mass = 1f; + _backRopeObject.AngZLimit = (_ropeObject.AngZLimit = 45f); + _backRopeObject.LowAngXLimit = (_ropeObject.LowAngXLimit = 45f); + _backRopeObject.AngYLimit = (_ropeObject.AngYLimit = 45f); + _backRopeObject.LTLDamper = (_ropeObject.LTLDamper = 50f); + _backRopeObject.S1LDamper = (_ropeObject.S1LDamper = 50f); + _ropeObject.jointSpacing = 0.2f; + _ropeObject.enablePhysics = true; + _ropeObject.colliderRadius = 0.02f; + _ropeObject.solverOverride = 20; + _ropeObject.colliderType = RopeColliderType.Capsule; + _ropeObject.physicsMaterial = _ropePhysicalMaterial; + _ropeObject.ApplyRopeSettings(); + _backRopeObject.jointSpacing = 0.1f; + _backRopeObject.useGravity = true; + _backRopeObject.enablePhysics = true; + _backRopeObject.solverOverride = 20; + _backRopeObject.physicsMaterial = _ropePhysicalMaterial; + _backRopeObject.ApplyRopeSettings(); + _ropeMesh = _ropeObject.GetComponent(); + _backRopeMesh = _backRopeObject.GetComponent(); + } + + public override void awakeEmitObject() + { + Transform transform = base.transform; + Vector3 position = base.transform.position; + float x = position.x; + Vector3 position2 = base.transform.position; + float y = position2.y; + Vector3 position3 = base.transform.position; + transform.position = new Vector3(x, y, position3.z - 0.1f); + float ropeStabilityHeight = RopeStabilityHeight; + if (targetTransform != null) + { + _targetPosition = targetTransform.position; + FieGameCharacter component = targetTransform.GetComponent(); + if (component != null) + { + _targetPositionScatter = component.centerTransform.position - _targetPosition; + } + ropeStabilityHeight = RopeStabilityHeight * Vector3.Distance(targetTransform.position, initTransform.position) / ROPE_MAX_RANGE; + } + else + { + _targetPosition = initTransform.position + directionalVec.normalized * ROPE_MAX_RANGE; + ropeStabilityHeight = 0f; + } + _ropeShotStabirityTweener.InitTweener(RopeShotTime, ropeStabilityHeight, 0f); + _targetPosition.y += ropeStabilityHeight; + _ropeOrigin.transform.position = initTransform.position; + _ropeTop.transform.position = _targetPosition; + _ropeBackOrigin.transform.position = initTransform.position; + _ropeBackTop.transform.position = initTransform.position; + updateRopeRange(_ropeMesh, 0.001f); + updateRopeRange(_backRopeMesh, 1f); + _ropeObject.ApplyRopeSettings(); + _backRopeObject.ApplyRopeSettings(); + _ropeDistanceTweener.InitTweener(RopeShotTime, 0.001f, 1f); + _ropeScaleTweener.InitTweener(1f, 0.025f, 0.025f); + _ropeState = RopeState.ROPE_READY; + _hitGameCharacter = null; + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV1_2); + if (skill != null) + { + defaultDamage += skill.Value1; + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV2_2); + if (skill2 != null) + { + defaultDamage += skill2.Value1; + } + _timeScalerStatusEffectEntity = base.gameObject.GetComponent(); + if (_timeScalerStatusEffectEntity != null) + { + _timeScalerStatusEffectEntity.isActive = false; + } + if (_timeScalerStatusEffectEntity != null) + { + _timeScalerStatusEffectEntity.isActive = false; + } + GDESkillTreeData skill3 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV4_SLOW_DOWN); + if (skill3 != null) + { + if (_timeScalerStatusEffectEntity == null) + { + _timeScalerStatusEffectEntity = base.gameObject.AddComponent(); + } + _timeScalerStatusEffectEntity.isActive = true; + _timeScalerStatusEffectEntity.duration = skill3.Value1; + _timeScalerStatusEffectEntity.targetTimeScale = skill3.Value2; + } + } + } + + public void Update() + { + if (!_isEndUpdate) + { + _ropeBackOrigin.transform.position = initTransform.position; + } + else + { + _ropeBackOrigin.transform.position = _ropeOrigin.transform.position; + } + updateRopeRange(_ropeMesh, _ropeDistanceTweener.UpdateParameterFloat(Time.deltaTime), _ropeScaleTweener.UpdateParameterFloat(Time.deltaTime)); + updateRopeRange(_backRopeMesh, 1f, _ropeScaleTweener.UpdateParameterFloat(Time.deltaTime)); + if (!_isEndUpdate) + { + _ropeOrigin.transform.position = initTransform.position; + Vector3 position = Vector3.zero; + if (targetTransform != null) + { + position = targetTransform.position + _targetPositionScatter; + if (Vector3.Distance(targetTransform.position, initTransform.position) > ROPE_MAX_RANGE) + { + finishTransaction(); + } + } + else + { + position = _targetPosition; + } + position.y += _ropeShotStabirityTweener.UpdateParameterFloat(Time.deltaTime); + _ropeTop.transform.position = position; + switch (_ropeState) + { + case RopeState.ROPE_READY: + _ropeState = RopeState.ROPE_SHOOTING; + break; + case RopeState.ROPE_SHOOTING: + if (_lifeTimeCount >= RopeShotTime) + { + bool flag = false; + if (targetTransform != null) + { + FieGameCharacter component = targetTransform.GetComponent(); + if (component != null) + { + callHitEvent(component); + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV3_2); + if (skill != null) + { + component.damageSystem.AddDefenceMagni(1006, 0f - skill.Value2, skill.Value1); + } + } + addDamageToCharacter(component, getDefaultDamageObject()); + flag = true; + } + } + if (!flag) + { + finishTransaction(); + _ropeState = RopeState.ROPE_END; + } + else + { + _ropeState = RopeState.ROPE_HITTING; + } + } + break; + } + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= RopeDuration) + { + finishTransaction(); + } + } + } + + private void updateRopeRange(QuickRope2Mesh ropeMesh, float ropeCurveRange, float ropeScale = 0.025f) + { + float num = Mathf.Max(Mathf.Min(ropeCurveRange, 1f), 0.001f); + float num2 = Mathf.Max(Mathf.Min(ropeCurveRange + 0.0001f, 1f), 0.001f); + if (num != _lastRopeCurve || ropeScale != _lastLopeScale) + { + ropeMesh.curve = new AnimationCurve(); + ropeMesh.curve.AddKey(0f, ropeScale); + ropeMesh.curve.AddKey(num, ropeScale); + if (num2 != num) + { + ropeMesh.curve.AddKey(num2, 0f); + } + for (int i = 0; i < ropeMesh.curve.keys.Length; i++) + { + ropeMesh.curve.SmoothTangents(i, 1f); + } + _lastRopeCurve = num; + _lastLopeScale = ropeScale; + } + } + + private void finishTransaction() + { + Rigidbody component = _ropeBackOrigin.GetComponent(); + bool flag = true; + _ropeTop.GetComponent().useGravity = flag; + flag = flag; + _ropeOrigin.GetComponent().useGravity = flag; + component.useGravity = flag; + Rigidbody component2 = _ropeBackOrigin.GetComponent(); + flag = false; + _ropeTop.GetComponent().isKinematic = flag; + flag = flag; + _ropeOrigin.GetComponent().isKinematic = flag; + component2.isKinematic = flag; + destoryEmitObject(RopeDestroyPastTime); + _ropeScaleTweener.InitTweener(RopeDestroyPastTime, 0.025f, 0f); + _isEndUpdate = true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackStomp.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackStomp.cs new file mode 100644 index 0000000..0081741 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackStomp.cs @@ -0,0 +1,122 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackStomp")] + public class FieEmitObjectApplejackStomp : FieEmittableObjectBase + { + [SerializeField] + private AnimationCurve damageCurve; + + [SerializeField] + private AnimationCurve damageCurveForPowerHitter; + + [SerializeField] + private AnimationCurve damageCurveForAverageHitter; + + [SerializeField] + private BoxCollider StompCollider; + + [SerializeField] + private float stompDuration = 1f; + + [SerializeField] + private float StompEnableDuration = 0.5f; + + [SerializeField] + private float StompMaximumDamageRate = 1f; + + [SerializeField] + private float StompMinimumDamageRate = 0.2f; + + [SerializeField] + private Vector3 _defaultColliderSize = new Vector3(5f, 0.75f, 5f); + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + private AnimationCurve _currentDamageCurve; + + private BoxCollider _collider; + + public void Awake() + { + _collider = base.gameObject.GetComponent(); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= stompDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + public override void awakeEmitObject() + { + base.awakeEmitObject(); + _currentDamageCurve = damageCurve; + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_STOMP_LV4_POWER_HITTER); + if (skill != null) + { + _currentDamageCurve = damageCurveForPowerHitter; + } + else + { + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_STOMP_LV4_AVERAGE_HITTER); + if (skill2 != null) + { + _currentDamageCurve = damageCurveForAverageHitter; + } + } + Vector3 defaultColliderSize = _defaultColliderSize; + GDESkillTreeData skill3 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_STOMP_LV2_2); + if (skill3 != null) + { + defaultColliderSize.x += _defaultColliderSize.x * skill3.Value1; + defaultColliderSize.z += _defaultColliderSize.z * skill3.Value1; + } + if (_collider != null) + { + _collider.size = defaultColliderSize; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > StompEnableDuration) && collider.gameObject.tag == getHostileTagString()) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + Vector3 size = StompCollider.size; + float num = size.x * 0.5f; + float a = Vector3.Distance(collider.gameObject.transform.position, base.transform.position); + float num2 = _currentDamageCurve.Evaluate(Mathf.Clamp(num / Mathf.Max(a, 0.01f) / num, 0f, 1f)); + defaultDamageObject.damage *= num2; + defaultDamageObject.stagger *= num2; + FieGameCharacter x = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + if (base.ownerCharacter != null && base.ownerCharacter.friendshipStats != null) + { + base.ownerCharacter.friendshipStats.safeAddFriendship(base.gainedFriendshipPoint * num2); + } + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehaw.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehaw.cs new file mode 100644 index 0000000..4d3b890 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehaw.cs @@ -0,0 +1,88 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackYeehaw")] + public class FieEmitObjectApplejackYeehaw : FieEmittableObjectBase + { + [SerializeField] + private float yeehawDuration = 1.5f; + + [SerializeField] + private float yeehawEnableDuration = 0.8f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + private bool _isShoutOfCourage; + + public override void awakeEmitObject() + { + base.awakeEmitObject(); + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV4_SHOUT_OF_COURAGE); + if (skill != null) + { + _isShoutOfCourage = true; + } + } + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= yeehawDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > yeehawEnableDuration)) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieDamage damageObject = getDefaultDamageObject(); + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.ApplyShoutAdditionalDamage(ref damageObject); + } + addDamageToCollisionCharacter(collider, damageObject); + } + else if (base.ownerCharacter != null && _isShoutOfCourage && collider.gameObject.tag == getAllyTagString()) + { + FieCollider component = collider.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (!(parentGameCharacter == null)) + { + int instanceID = parentGameCharacter.gameObject.GetInstanceID(); + if (instanceID != base.ownerCharacter.GetInstanceID()) + { + FieManagerBehaviour.I.EmitObject(parentGameCharacter.centerTransform, Vector3.zero, null, parentGameCharacter); + } + } + } + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawFriendly.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawFriendly.cs new file mode 100644 index 0000000..b849220 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawFriendly.cs @@ -0,0 +1,46 @@ +using Fie.Object; +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackYeehawFriendly")] + public class FieEmitObjectApplejackYeehawFriendly : FieEmittableObjectBase + { + [SerializeField] + private float yeehawRegenDuration = 13f; + + [SerializeField] + private float yeehawRegenEnableDuration = 10f; + + [SerializeField] + private PlaygroundParticlesC particle; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + particle.emit = true; + base.ownerCharacter.damageSystem.AddDefenceMagni(-1, 0.25f, yeehawRegenEnableDuration); + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= yeehawRegenEnableDuration) + { + _isEndUpdate = true; + destoryEmitObject(yeehawRegenDuration - yeehawRegenEnableDuration); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawReflect.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawReflect.cs new file mode 100644 index 0000000..7cf14fd --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawReflect.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackYeehawReflect")] + public class FieEmitObjectApplejackYeehawReflect : FieEmittableObjectBase + { + [SerializeField] + private float yeehawEnableDuration = 0.3f; + + [SerializeField] + private float yeehawPysicalForce = 1.5f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= yeehawEnableDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + if (collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + Vector3 a = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector = a - base.transform.position; + vector = new Vector3(vector.x, 0f, vector.z).normalized; + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(vector * yeehawPysicalForce, 0f, useRound: false); + } + } + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null) + { + reflectEmitObject(component); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawRegen.cs b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawRegen.cs new file mode 100644 index 0000000..f5b798b --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieEmitObjectApplejackYeehawRegen.cs @@ -0,0 +1,96 @@ +using Fie.Object; +using GameDataEditor; +using ParticlePlayground; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + [FiePrefabInfo("Prefabs/Applejack/Power/ApplejackYeehawRegen")] + public class FieEmitObjectApplejackYeehawRegen : FieEmittableObjectBase + { + [SerializeField] + private float yeehawRegenDuration = 13f; + + [SerializeField] + private float yeehawRegenEnableDuration = 10f; + + [SerializeField] + private PlaygroundParticlesC particle; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + particle.emit = true; + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV4_SHOUT_OF_COURAGE); + if (skill != null) + { + base.ownerCharacter.damageSystem.AddDefenceMagni(-1, skill.Value1, yeehawRegenEnableDuration); + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV4_TAUNT); + if (skill2 != null) + { + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.isTauntMode = true; + } + } + } + } + + private void lifeSystem_damageEvent(FieGameCharacter attacker, FieDamage damage) + { + base.ownerCharacter.damageSystem.setRegenerateDelay(0f); + } + + public void onDisable() + { + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.isTauntMode = false; + } + } + + public void on() + { + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.isTauntMode = false; + } + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + base.ownerCharacter.damageSystem.setRegenerateDelay(0f); + if (_lifeTimeCount >= yeehawRegenEnableDuration) + { + if (particle != null) + { + particle.emit = false; + } + FieApplejack fieApplejack = base.ownerCharacter as FieApplejack; + if (fieApplejack != null) + { + fieApplejack.isTauntMode = false; + } + _isEndUpdate = true; + destoryEmitObject(yeehawRegenDuration - yeehawRegenEnableDuration); + } + } + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackBackstep.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackBackstep.cs new file mode 100644 index 0000000..ec4173d --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackBackstep.cs @@ -0,0 +1,106 @@ +using Fie.Object; +using Spine; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackBackstep : FieStateMachineGameCharacterBase + { + private enum StepState + { + STEP_START, + STEPPING + } + + private StepState _stepState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableCollider = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + FieApplejack applejack = gameCharacter as FieApplejack; + if (_stepState == StepState.STEP_START) + { + if (applejack.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = null; + trackEntry = applejack.animationManager.SetAnimation(36, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 vector = applejack.flipDirectionVector * e.Float; + if (applejack.externalInputVector != Vector3.zero) + { + vector = applejack.externalInputVector; + vector.z = vector.y; + vector.y = 0f; + vector.Normalize(); + vector *= 0f - e.Float; + vector.z *= 0.7f; + } + applejack.setFlipByVector(-vector); + applejack.resetMoveForce(); + applejack.setMoveForce(vector, 0f, useRound: false); + applejack.applySideEffectOfStep(); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + if (e.Data.Name == "immunity") + { + applejack.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + } + else + { + _isEnd = true; + } + _stepState = StepState.STEPPING; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackBaseAttack.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackBaseAttack.cs new file mode 100644 index 0000000..80f7a56 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackBaseAttack.cs @@ -0,0 +1,78 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackBaseAttack : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (true) + { + Vector3 vector = (fieApplejack.flipState != 0) ? Vector3.right : Vector3.left; + Type type = fieApplejack.getStateMachine().nowStateType(); + if (fieApplejack.groundState == FieObjectGroundState.Grounding) + { + if (type == typeof(FieStateMachineApplejackRopeAction)) + { + fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFireKickRift), isForceSet: false); + } + else if (type == typeof(FieStateMachineApplejackFirePunch)) + { + fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFireKick), isForceSet: false); + } + else + { + fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFirePunch), isForceSet: false); + } + _isEnd = true; + } + else if (fieApplejack.groundState == FieObjectGroundState.Flying) + { + if (type == typeof(FieStateMachineApplejackRopeActionAir)) + { + fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFireAirDouble), isForceSet: false); + } + else + { + fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFireAir), isForceSet: false); + } + _isEnd = true; + } + else + { + _isEnd = true; + } + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_BASE_ATTACK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_BASE_ATTACK)); + } + } + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackCharge.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackCharge.cs new file mode 100644 index 0000000..8d2484e --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackCharge.cs @@ -0,0 +1,113 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackCharge : FieStateMachineGameCharacterBase + { + private enum StepState + { + STEP_START, + STEPPING + } + + private StepState _stepState; + + private bool _isEnd; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableCollider = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + FieApplejack applejack = gameCharacter as FieApplejack; + if (_stepState == StepState.STEP_START) + { + if (applejack.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = null; + trackEntry = applejack.animationManager.SetAnimation(40, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 vector = applejack.flipDirectionVector * e.Float; + if (applejack.externalInputVector != Vector3.zero) + { + vector = applejack.externalInputVector; + vector.z = vector.y; + vector.y = 0f; + vector.Normalize(); + vector *= e.Float; + vector.z *= 0.7f; + } + applejack.setFlipByVector(vector); + applejack.resetMoveForce(); + applejack.setMoveForce(vector, 0f, useRound: false); + applejack.applySideEffectOfStep(); + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, applejack.flipDirectionVector, null, applejack); + FieManagerBehaviour.I.EmitObject(applejack.leftFrontHoofTransform, applejack.flipDirectionVector); + } + if (e.Data.Name == "finished") + { + _isEnd = true; + } + if (e.Data.Name == "immunity") + { + applejack.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + } + else + { + _isEnd = true; + } + _stepState = StepState.STEPPING; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackEvasion.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackEvasion.cs new file mode 100644 index 0000000..2a321e4 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackEvasion.cs @@ -0,0 +1,51 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackEvasion : FieStateMachineGameCharacterBase + { + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + float num = Vector3.Dot(fieApplejack.externalInputVector.normalized, fieApplejack.flipDirectionVector); + if (num > 0.75f) + { + _nextState = typeof(FieStateMachineApplejackCharge); + } + else + { + _nextState = typeof(FieStateMachineApplejackBackstep); + } + fieApplejack.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_EVADED), 25); + FieStateMachineInterface fieStateMachineInterface = fieApplejack.getStateMachine().setState(_nextState, isForceSet: false); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_EVADE), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_EVADE)); + _isEnd = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAir.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAir.cs new file mode 100644 index 0000000..78fcc01 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAir.cs @@ -0,0 +1,153 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFireAir : FieStateMachineGameCharacterBase + { + private enum FireState + { + AIR_KICK_START, + AIR_KICKING + } + + private const float KICK_DELAY = 0.75f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private const float AIR_ATTACK_PAST_TIME = 0.3f; + + private const float AIR_ATTACK_FLYING_FORCE = 8f; + + private const float AIR_ATTACK_HORMING_FORCE = 2f; + + private const float AIR_ATTACK_HORMING_DISTANCE = 15f; + + private Type _nextState = typeof(FieStateMachineApplejackFlying); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.AIR_KICK_START: + if (applejack.groundState == FieObjectGroundState.Flying) + { + applejack.isEnableGravity = false; + int animationId = 27; + if (applejack.isHeavyKickMode) + { + animationId = 28; + } + TrackEntry trackEntry = applejack.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + applejack.isEnableGravity = true; + Vector3 a = applejack.externalInputVector * 0.5f; + a += Vector3.up + applejack.flipDirectionVector * 0.1f; + a.Normalize(); + a *= 8f; + applejack.adjustMoveForce(0.5f); + applejack.setMoveForce(a, 0.3f); + FieManagerBehaviour.I.EmitObject(applejack.leftBackHoofTransform, Vector3.zero, null, applejack); + applejack.CalcBatteCicleSkill(); + applejack.isEnableCollider = false; + } + else if (e.Data.Name == "finished") + { + applejack.isEnableGravity = true; + applejack.isEnableCollider = true; + _isEnd = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.AIR_KICKING; + } + else + { + _isEnd = true; + } + break; + } + Vector3 externalInputVector = applejack.externalInputVector; + float externalInputForce = applejack.externalInputForce; + externalInputVector.y = (externalInputVector.z = 0f); + if (_timeCount > _endTime) + { + applejack.isEnableGravity = true; + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.setGravityRate(1f); + fieApplejack.isEnableGravity = true; + fieApplejack.isEnableHeadTracking = true; + fieApplejack.isEnableCollider = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override float getDelay() + { + return 0.75f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAirDouble.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAirDouble.cs new file mode 100644 index 0000000..dbf4445 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireAirDouble.cs @@ -0,0 +1,158 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFireAirDouble : FieStateMachineGameCharacterBase + { + private enum FireState + { + AIR_KICK_START, + AIR_KICKING + } + + private const float KICK_DELAY = 0.75f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private const float AIR_ATTACK_PAST_TIME = 0.3f; + + private const float AIR_ATTACK_FLYING_FORCE = 3f; + + private const float AIR_ATTACK_HORMING_DISTANCE = 15f; + + private Type _nextState = typeof(FieStateMachineApplejackFlying); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.AIR_KICK_START: + if (applejack.groundState == FieObjectGroundState.Flying) + { + applejack.isEnableGravity = false; + int animationId = 29; + if (applejack.isHeavyKickMode) + { + animationId = 30; + } + TrackEntry trackEntry = applejack.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (FieManagerBehaviour.I.gameCamera != null) + { + FieManagerBehaviour.I.gameCamera.setOffsetTransition(applejack, new FieCameraOffset(new FieCameraOffset.FieCameraOffsetParam(new Vector3(0f, 0f, 2f), new Vector3(0f, 0f, 0f), 10f), 0.5f, 0.5f, 1f)); + } + if (trackEntry != null) + { + applejack.CalcBatteCicleSkill(); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + applejack.isEnableGravity = true; + Vector3 externalInputVector2 = applejack.externalInputVector; + externalInputVector2 += Vector3.up + applejack.flipDirectionVector * 0.2f; + externalInputVector2.Normalize(); + externalInputVector2 *= 3f; + applejack.adjustMoveForce(0.2f); + applejack.setMoveForce(externalInputVector2, 0.3f); + FieManagerBehaviour.I.EmitObject(applejack.leftBackHoofTransform, Vector3.zero, null, applejack); + applejack.isEnableCollider = false; + } + else if (e.Data.Name == "finished") + { + applejack.isEnableGravity = true; + applejack.isEnableCollider = true; + _isEnd = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.AIR_KICKING; + } + else + { + _isEnd = true; + } + break; + } + Vector3 externalInputVector = applejack.externalInputVector; + float externalInputForce = applejack.externalInputForce; + externalInputVector.y = (externalInputVector.z = 0f); + if (_timeCount > _endTime) + { + applejack.isEnableGravity = true; + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.adjustMoveForce(0.5f); + fieApplejack.setGravityRate(0.5f); + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.setGravityRate(1f); + fieApplejack.isEnableGravity = true; + fieApplejack.isEnableHeadTracking = true; + fieApplejack.isEnableCollider = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override float getDelay() + { + return 0.75f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKick.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKick.cs new file mode 100644 index 0000000..a3927be --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKick.cs @@ -0,0 +1,175 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFireKick : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + autoFlipToEnemy(fieApplejack); + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.KICK_START: + if (applejack.groundState == FieObjectGroundState.Grounding) + { + applejack.switchFlip(); + int animationId = 23; + if (applejack.isHeavyKickMode) + { + animationId = 24; + } + TrackEntry trackEntry = applejack.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(applejack.leftBackHoofTransform, applejack.flipDirectionVector * -1f, null, applejack); + } + if (e.Data.Name == "move") + { + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, applejack.flipDirectionVector * -1f); + FieManagerBehaviour.I.EmitObject(applejack.leftFrontHoofTransform, applejack.flipDirectionVector); + Vector3 a = applejack.flipDirectionVector * -1f; + Transform lockonEnemyTransform = applejack.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - applejack.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + num *= 1f; + vector.Normalize(); + a = vector; + a.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + applejack.resetMoveForce(); + applejack.setMoveForce(vector2, 0f, useRound: false); + applejack.setFlipByVector(vector2 * -1f); + applejack.CalcBatteCicleSkill(); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = (e.Int >= 1); + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + } + else + { + _isEnd = true; + } + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isCancellable) + { + list.Add(typeof(FieStateMachineApplejackEvasion)); + list.Add(typeof(FieStateMachineApplejackFireRope)); + list.Add(typeof(FieStateMachineApplejackYeehaw)); + } + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFirePunch)); + } + return list; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKickRift.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKickRift.cs new file mode 100644 index 0000000..bdd26e5 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireKickRift.cs @@ -0,0 +1,181 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFireKickRift : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + autoFlipToEnemy(fieApplejack); + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.KICK_START: + if (applejack.groundState == FieObjectGroundState.Grounding) + { + applejack.switchFlip(); + int animationId = 25; + if (applejack.isHeavyKickMode) + { + animationId = 26; + } + TrackEntry trackEntry = applejack.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(applejack.leftBackHoofTransform, applejack.flipDirectionVector * -1f, null, applejack); + applejack.CalcBatteCicleSkill(); + if (FieManagerBehaviour.I.gameCamera != null) + { + FieManagerBehaviour.I.gameCamera.setOffsetTransition(applejack, new FieCameraOffset(new FieCameraOffset.FieCameraOffsetParam(new Vector3(0f, 0f, 1.5f), new Vector3(0f, 0f, 0f), 5f), 0.3f, 0.3f, 1.5f)); + } + } + if (e.Data.Name == "move") + { + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, applejack.flipDirectionVector * -1f); + FieManagerBehaviour.I.EmitObject(applejack.leftFrontHoofTransform, applejack.flipDirectionVector); + Vector3 a = applejack.flipDirectionVector * -1f; + Transform lockonEnemyTransform = applejack.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - applejack.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + num *= 1f; + vector.Normalize(); + a = vector; + a.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + applejack.resetMoveForce(); + applejack.setMoveForce(vector2, 0f, useRound: false); + applejack.setFlipByVector(vector2 * -1f); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = (e.Int >= 1); + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + } + else + { + _isEnd = true; + } + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isCancellable) + { + list.Add(typeof(FieStateMachineApplejackEvasion)); + list.Add(typeof(FieStateMachineApplejackFireRope)); + list.Add(typeof(FieStateMachineApplejackYeehaw)); + list.Add(typeof(FieStateMachineApplejackJump)); + } + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFirePunch)); + } + return list; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFirePunch.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFirePunch.cs new file mode 100644 index 0000000..4278a0b --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFirePunch.cs @@ -0,0 +1,167 @@ +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFirePunch : FieStateMachineGameCharacterBase + { + private enum FireState + { + PUNCH_START, + PUNCHING + } + + private const float PUNCH_DELAY = 0.5f; + + private const float PUNCH_HORMING_DISTANCE = 1f; + + private const float PUNCH_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + private int _punchCount; + + public override void initialize(FieGameCharacter gameCharacter) + { + autoFlipToEnemy(gameCharacter); + gameCharacter.isEnableAutoFlip = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableAutoFlip = true; + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.PUNCH_START: + if (applejack.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(22, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + switch (_punchCount) + { + case 0: + FieManagerBehaviour.I.EmitObject(applejack.rightFrontHoofTransform, applejack.flipDirectionVector, null, applejack); + break; + case 1: + FieManagerBehaviour.I.EmitObject(applejack.leftFrontHoofTransform, applejack.flipDirectionVector, null, applejack); + break; + } + _punchCount++; + } + if (e.Data.Name == "move") + { + Vector3 a = applejack.flipDirectionVector; + Transform lockonEnemyTransform = applejack.detector.getLockonEnemyTransform(); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - applejack.transform.position; + num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f); + vector.Normalize(); + a = vector; + a.y = 0f; + } + Vector3 vector2 = a * (e.Float * num); + applejack.resetMoveForce(); + applejack.setMoveForce(vector2, 0f); + applejack.setFlipByVector(vector2); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + } + else + { + _isEnd = true; + } + _fireState = FireState.PUNCHING; + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFireKick)); + } + if (_isCancellable) + { + list.Add(typeof(FieStateMachineApplejackEvasion)); + list.Add(typeof(FieStateMachineApplejackFireRope)); + list.Add(typeof(FieStateMachineApplejackYeehawAction)); + list.Add(typeof(FieStateMachineApplejackStompJump)); + } + return list; + } + + public override float getDelay() + { + return 0.5f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireRope.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireRope.cs new file mode 100644 index 0000000..b77e329 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFireRope.cs @@ -0,0 +1,207 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFireRope : FieStateMachineGameCharacterBase + { + private enum FireState + { + ROPE_READY, + ROPE_FIRE, + ROPE_WAITING, + ROPE_PULL, + ROPE_END + } + + public float pullDuration = 0.75f; + + private const float STAGGER = 100f; + + private const float HATE = 5f; + + private const float PUNCH_DELAY = 0.5f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private const float AIR_ROPE_FLYING_FORCE = 4f; + + private const float AIR_ROPE_PAST_TIME = 0.3f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + FireState fireState = _fireState; + switch (fireState) + { + case FireState.ROPE_READY: + { + bool isFlyingAction = false; + int animationId = (applejack.groundState != 0) ? 32 : 31; + if (applejack.groundState == FieObjectGroundState.Flying) + { + isFlyingAction = true; + } + applejack.resetMoveForce(); + applejack.setGravityRate(0.2f); + autoFlipToEnemy(applejack); + TrackEntry trackEntry = applejack.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + applejack.emotionController.SetEmoteAnimation(41, isForceSet: true); + applejack.SetDialog(30, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_HONESTY_ABILITY_ROPE_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_HONESTY_ABILITY_ROPE_2)); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + Vector3 directionalVec = (applejack.flipState != 0) ? Vector3.right : Vector3.left; + FieEmitObjectApplejackRope fieEmitObjectApplejackRope = FieManagerBehaviour.I.EmitObject(applejack.mouthTransform, directionalVec, applejack.detector.getLockonEnemyTransform(), applejack); + if (!(fieEmitObjectApplejackRope == null)) + { + GDESkillTreeData skill = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV3_1); + if (skill != null) + { + applejack.damageSystem.AddDefenceMagni(1005, 1f, skill.Value1); + } + GDESkillTreeData skill2 = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_ROPE_LV4_SYNERGY_ROPING); + if (skill2 != null) + { + applejack.abilitiesContainer.IncreaseOrReduceCooldownAll(0f - skill2.Value1); + } + fieEmitObjectApplejackRope.setPullPosition(applejack.transform.position); + fieEmitObjectApplejackRope.emitObjectHitEvent += delegate(FieEmittableObjectBase emitObject, FieGameCharacter hitCharacter) + { + if (isFlyingAction) + { + (applejack.getStateMachine().setState(typeof(FieStateMachineApplejackRopeActionAir), isForceSet: false) as FieStateMachineGameCharacterBase)?.addTargetGameCharacter(hitCharacter); + _isEnd = true; + } + else + { + FieStateMachineGameCharacterBase fieStateMachineGameCharacterBase = applejack.getStateMachine().setState(typeof(FieStateMachineApplejackRopeAction), isForceSet: false) as FieStateMachineGameCharacterBase; + if (fieStateMachineGameCharacterBase != null) + { + FieDamage fieDamage = new FieDamage(100f, 5f); + FieStatusEffectsPullEntity item = new FieStatusEffectsPullEntity + { + pullPosition = applejack.transform.position, + pullDuration = pullDuration + }; + fieDamage.statusEffects.Add(item); + hitCharacter.AddDamage(applejack, fieDamage); + fieStateMachineGameCharacterBase.addTargetGameCharacter(hitCharacter); + } + _isEnd = true; + } + }; + } + } + else if (e.Data.Name == "takeOff") + { + Vector3 up = Vector3.up; + up.Normalize(); + up *= 4f; + applejack.setMoveForce(up, 0.3f); + } + else if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineApplejackFlying); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + _endTime = trackEntry.endTime; + } + else + { + applejack.setGravityRate(1f); + applejack.isEnableGravity = true; + _endTime = 0f; + } + _fireState = FireState.ROPE_FIRE; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.setGravityRate(1f); + fieApplejack.isEnableGravity = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineApplejackRopeActionAir)); + list.Add(typeof(FieStateMachineApplejackRopeAction)); + return list; + } + + public override float getDelay() + { + return 0.5f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackFlying.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFlying.cs new file mode 100644 index 0000000..f4d3df7 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackFlying.cs @@ -0,0 +1,82 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackFlying : FieStateMachineGameCharacterBase + { + private const float FLYING_MOVE_FORCE_ROUND = 0.5f; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + Vector3 externalInputVector = fieApplejack.externalInputVector; + float externalInputForce = fieApplejack.externalInputForce; + externalInputVector.y = (externalInputVector.z = 0f); + if (fieApplejack.animationManager.IsEndAnimation(0)) + { + fieApplejack.animationManager.SetAnimation(20, isLoop: true); + } + if (fieApplejack.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachinePoniesLanding); + _isEnd = true; + } + else + { + gameCharacter.addMoveForce(externalInputVector * (fieApplejack.getDefaultMoveSpeed() * fieApplejack.externalInputForce) * 0.5f, 0.4f); + fieApplejack.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 1500f); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineApplejackFireAir)); + list.Add(typeof(FieStateMachineApplejackFireRope)); + list.Add(typeof(FieStateMachineApplejackRopeActionAir)); + list.Add(typeof(FieStateMachineApplejackYeehawActionMidAir)); + list.Add(typeof(FieStateMachineApplejackStompAction)); + return list; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackJump.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackJump.cs new file mode 100644 index 0000000..968f248 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackJump.cs @@ -0,0 +1,137 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackJump : FieStateMachineGameCharacterBase + { + private enum JumpState + { + JUMP_TAKEOFF_START, + JUMP_TAKEOFF_STANDBY, + JUMP_TAKEOFF_READY, + JUMP_TAKEOFF + } + + private const float TAKEOFF_FORCE = 8f; + + private const float TAKEOFF_PAST_TIME = 0.5f; + + private const float FLYING_MOVE_FORCE_ROUND = 0.5f; + + private const float MAX_FLYING_SPEED = 1f; + + private const float FLYING_UPPER_FORCE_DURATION = 3f; + + private const float LANDING_DELAY = 0.05f; + + private const float JUMP_DELAY = 0.1f; + + private JumpState _jumpState; + + private float _takeoffTime; + + private float _flyingTime; + + private float _landingCount; + + private bool _isSetLandingAnimation; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + FieApplejack applejack = gameCharacter as FieApplejack; + Vector3 a = applejack.externalInputVector; + float externalInputForce = applejack.externalInputForce; + a.y = (a.z = 0f); + if (_jumpState == JumpState.JUMP_TAKEOFF_START) + { + if (applejack.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineApplejackFlying); + _isEnd = true; + } + else + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(19); + _jumpState = JumpState.JUMP_TAKEOFF_STANDBY; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.name == "takeOff") + { + Vector3 vector = applejack.externalInputVector; + vector += Vector3.up; + vector.x *= 0.1f; + vector.Normalize(); + vector *= 8f; + applejack.setMoveForce(vector, 0.5f); + _jumpState = JumpState.JUMP_TAKEOFF; + } + else if (e.Data.name == "finished") + { + _nextState = typeof(FieStateMachineApplejackFlying); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineApplejackFlying); + _isEnd = true; + }; + } + a *= 0.5f; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override float getDelay() + { + return 0.1f; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackRope.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRope.cs new file mode 100644 index 0000000..3b0acee --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRope.cs @@ -0,0 +1,69 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Applejack +{ + [FieAbilityID(FieConstValues.FieAbility.ROPE)] + public class FieStateMachineApplejackRope : FieStateMachineAbilityBase + { + private const string ROPE_ABILITY_SIGNATURE = "rope"; + + public const float ROPE_DEFAULT_COOLDOWN = 3f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + FieStateMachineInterface fieStateMachineInterface = fieApplejack.getStateMachine().setState(typeof(FieStateMachineApplejackFireRope), isForceSet: false); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_ABILITY_1)); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 3f; + } + + public override string getSignature() + { + return "rope"; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineApplejackRopeActionAir)); + list.Add(typeof(FieStateMachineApplejackRopeAction)); + return list; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeAction.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeAction.cs new file mode 100644 index 0000000..5d0c77c --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeAction.cs @@ -0,0 +1,126 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackRopeAction : FieStateMachineGameCharacterBase + { + private enum FireState + { + ROPE_ACTION_START, + ROPE_ACTION_PULL, + ROPE_ACTION_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.ROPE_ACTION_START: + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(35, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 flipDirectionVector = applejack.flipDirectionVector; + Vector3 moveForce = flipDirectionVector * e.Float; + applejack.setMoveForce(moveForce, 0f); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry.Complete += delegate + { + applejack.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _fireState = FireState.ROPE_ACTION_PULL; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + autoFlipToEnemy(fieApplejack); + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.emotionController.RestoreEmotionFromDefaultData(); + fieApplejack.abilitiesContainer.SetCooldown(3f); + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFireKickRift)); + } + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeActionAir.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeActionAir.cs new file mode 100644 index 0000000..c7c9180 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackRopeActionAir.cs @@ -0,0 +1,166 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackRopeActionAir : FieStateMachineGameCharacterBase + { + private enum FireState + { + ROPE_ACTION_START, + ROPE_ACTION_FLYING, + ROPE_ACTION_END + } + + private const float ROPE_ACTION_FLYING_VELOCITY = 40f; + + private const float ROPE_ACTION_END_DISTANCE = 1f; + + private const float ROPE_ACTION_FINISH_FLYING_FORCE = 5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack fieApplejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.ROPE_ACTION_START: + fieApplejack.isEnableGravity = false; + fieApplejack.animationManager.SetAnimation(33, isLoop: false, isForceSet: true); + gameCharacter.isEnableAutoFlip = false; + fieApplejack.isEnableCollider = false; + _fireState = FireState.ROPE_ACTION_FLYING; + break; + case FireState.ROPE_ACTION_FLYING: + if (targetGameCharacterList.Count > 0) + { + if (targetGameCharacterList[0] == null) + { + _isEnd = true; + } + else + { + Transform transform = targetGameCharacterList[0].transform; + if (transform != null) + { + Vector3 a = transform.position - fieApplejack.transform.position; + float num = Vector3.Distance(transform.position, fieApplejack.transform.position); + a.Normalize(); + fieApplejack.setFlipByVector(transform.position - fieApplejack.transform.position); + fieApplejack.addMoveForce(a * 40f, 0f, useRound: false); + fieApplejack.currentMovingVec += a * 40f; + if (num < 1f) + { + TrackEntry trackEntry = fieApplejack.animationManager.SetAnimation(34, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachinePoniesJump); + _isEnd = true; + }; + } + fieApplejack.isEnableGravity = true; + Vector3 up = Vector3.up; + up += fieApplejack.flipDirectionVector * -0.1f; + up.Normalize(); + up *= 5f; + fieApplejack.setGravityRate(1f); + fieApplejack.resetMoveForce(); + fieApplejack.setMoveForce(up, 0f); + fieApplejack.currentMovingVec += up * 40f; + fieApplejack.isEnableCollider = true; + _isFinished = true; + _fireState = FireState.ROPE_ACTION_END; + } + } + else + { + _isEnd = true; + _fireState = FireState.ROPE_ACTION_END; + } + } + } + else + { + _isEnd = true; + _fireState = FireState.ROPE_ACTION_END; + } + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.abilitiesContainer.SetCooldown(3f); + fieApplejack.isEnableAutoFlip = true; + fieApplejack.emotionController.RestoreEmotionFromDefaultData(); + fieApplejack.isEnableCollider = true; + fieApplejack.setGravityRate(1f); + fieApplejack.isEnableGravity = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineApplejackFlying)); + list.Add(typeof(FieStateMachineApplejackFireAir)); + list.Add(typeof(FieStateMachineApplejackFireAirDouble)); + list.Add(typeof(FieStateMachineApplejackYeehawActionMidAir)); + list.Add(typeof(FieStateMachineApplejackStompAction)); + return list; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackStomp.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStomp.cs new file mode 100644 index 0000000..e2b96dc --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStomp.cs @@ -0,0 +1,71 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Applejack +{ + [FieAbilityID(FieConstValues.FieAbility.STOMP)] + public class FieStateMachineApplejackStomp : FieStateMachineAbilityBase + { + public const string STOMP_SIGNATURE = "stomp"; + + public const float STOMP_DEFAULT_COOLDOWN = 7f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + Type typeFromHandle = typeof(FieStateMachineApplejackStompAction); + if (fieApplejack.groundState == FieObjectGroundState.Grounding) + { + typeFromHandle = typeof(FieStateMachineApplejackStompJump); + } + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_ABILITY_3), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_ABILITY_3)); + FieStateMachineInterface fieStateMachineInterface = fieApplejack.getStateMachine().setState(typeFromHandle, isForceSet: false); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 7f; + } + + public override string getSignature() + { + return "stomp"; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompAction.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompAction.cs new file mode 100644 index 0000000..0540294 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompAction.cs @@ -0,0 +1,137 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackStompAction : FieStateMachineGameCharacterBase + { + private enum FireState + { + STOMP_ACTION_START, + STOMP_ACTION_STOMPED, + STOMP_ACTION_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.STOMP_ACTION_START: + { + TrackEntry trackEntry2 = applejack.animationManager.SetAnimation(39, isLoop: false, isForceSet: true); + applejack.setMoveForce(Vector3.up * 2f, 1f, useRound: false); + if (trackEntry2 != null) + { + trackEntry2.Complete += delegate + { + applejack.isEnableGravity = true; + applejack.setGravityRate(3f); + }; + } + else + { + _isEnd = true; + } + GDESkillTreeData skill = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_STOMP_LV3_2); + if (skill != null) + { + applejack.isEnableCollider = false; + } + applejack.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + _fireState = FireState.STOMP_ACTION_STOMPED; + break; + } + case FireState.STOMP_ACTION_STOMPED: + if (applejack.groundState == FieObjectGroundState.Grounding) + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(4, isLoop: false, isForceSet: true); + FieManagerBehaviour.I.EmitObject(applejack.transform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.gameCamera.setWiggler(0.4f, 10, new Vector3(0.05f, 0.3f)); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + } + applejack.isEnableCollider = true; + applejack.abilitiesContainer.SetCooldown(7f); + _fireState = FireState.STOMP_ACTION_END; + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableGravity = false; + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableCollider = true; + fieApplejack.isEnableGravity = true; + fieApplejack.setGravityRate(1f); + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFirePunch)); + list.Add(typeof(FieStateMachineApplejackEvasion)); + } + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompJump.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompJump.cs new file mode 100644 index 0000000..b440b9d --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackStompJump.cs @@ -0,0 +1,145 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackStompJump : FieStateMachineGameCharacterBase + { + private enum JumpState + { + JUMP_TAKEOFF_START, + JUMP_TAKEOFF_STANDBY, + JUMP_TAKEOFF_READY, + JUMP_TAKEOFF, + JUMP_FLYING, + JUMP_LANDING + } + + private const float TAKEOFF_FORCE = 6f; + + private const float TAKEOFF_PAST_TIME = 0.5f; + + private const float FLYING_MOVE_FORCE_ROUND = 0.5f; + + private const float MAX_FLYING_SPEED = 1f; + + private const float FLYING_UPPER_FORCE_DURATION = 3f; + + private const float LANDING_DELAY = 0.05f; + + private const float JUMP_DELAY = 0.1f; + + private JumpState _jumpState; + + private float _takeoffTime; + + private float _flyingTime; + + private float _landingCount; + + private bool _isSetLandingAnimation; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + Vector3 a = fieApplejack.externalInputVector; + float externalInputForce = fieApplejack.externalInputForce; + a.y = (a.z = 0f); + switch (_jumpState) + { + case JumpState.JUMP_TAKEOFF_START: + { + if (fieApplejack.groundState == FieObjectGroundState.Flying) + { + _isEnd = true; + return; + } + TrackEntry trackEntry = fieApplejack.animationManager.SetAnimation(19, isLoop: false, isForceSet: true); + _jumpState = JumpState.JUMP_TAKEOFF_STANDBY; + if (trackEntry == null) + { + _isEnd = true; + return; + } + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.name == "takeOff") + { + _jumpState = JumpState.JUMP_TAKEOFF_READY; + } + if (e.Data.name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + a *= 0.5f; + break; + } + case JumpState.JUMP_TAKEOFF_READY: + { + Vector3 vector = fieApplejack.externalInputVector; + vector += Vector3.up; + vector.x *= 0.1f; + vector.Normalize(); + vector *= 6f; + fieApplejack.setMoveForce(vector, 0.5f); + _jumpState = JumpState.JUMP_TAKEOFF; + a *= 0.5f; + break; + } + } + gameCharacter.addMoveForce(a * (fieApplejack.getDefaultMoveSpeed() * fieApplejack.externalInputForce) * 0.5f, 0.4f); + fieApplejack.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 500f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineApplejackStompAction); + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override float getDelay() + { + return 0.1f; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehaw.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehaw.cs new file mode 100644 index 0000000..106db1c --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehaw.cs @@ -0,0 +1,74 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Applejack +{ + [FieAbilityID(FieConstValues.FieAbility.YEEHAW)] + public class FieStateMachineApplejackYeehaw : FieStateMachineAbilityBase + { + private const string YEEHAW_SIGNATRUE = "yeehaw"; + + private const float YEEHAW_DEFAULT_COOLDOWN = 16f; + + public const float YEEHAW_REGEN_RATE = 0.2f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieApplejack) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + Type type = null; + type = ((fieApplejack.groundState != 0) ? typeof(FieStateMachineApplejackYeehawActionMidAir) : typeof(FieStateMachineApplejackYeehawAction)); + FieStateMachineInterface fieStateMachineInterface = fieApplejack.getStateMachine().setState(type, isForceSet: false); + if (fieStateMachineInterface != null) + { + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_ABILITY_2), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_ABILITY_2)); + fieApplejack.abilitiesContainer.SetCooldown(16f); + } + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 16f; + } + + public override string getSignature() + { + return "yeehaw"; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawAction.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawAction.cs new file mode 100644 index 0000000..cb28180 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawAction.cs @@ -0,0 +1,140 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackYeehawAction : FieStateMachineGameCharacterBase + { + private enum FireState + { + YEEHAW_ACTION_START, + YEEHAW_ACTION_END + } + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.YEEHAW_ACTION_START: + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(37, isLoop: false, isForceSet: true); + applejack.emotionController.SetEmoteAnimation(43, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isFinished = true; + applejack.emotionController.RestoreEmotionFromDefaultData(); + } + }; + trackEntry.Complete += delegate + { + applejack.animationManager.SetAnimation(0, isLoop: true); + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + GDESkillTreeData skill = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV3_2); + if (skill != null) + { + applejack.isEnableCollider = false; + } + FieManagerBehaviour.I.EmitObject(applejack.mouthTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.setWiggler(1f, 10, Vector3.one * 0.2f); + } + else + { + _isEnd = true; + } + float num = 0.2f; + GDESkillTreeData skill2 = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV2_2); + if (skill2 != null) + { + num += skill2.Value1; + } + applejack.damageSystem.Regen((applejack.healthStats.maxHitPoint + applejack.healthStats.maxShield) * num); + _fireState = FireState.YEEHAW_ACTION_END; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + autoFlipToEnemy(fieApplejack); + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.emotionController.RestoreEmotionFromDefaultData(); + fieApplejack.isEnableCollider = true; + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + } + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFirePunch)); + list.Add(typeof(FieStateMachineApplejackEvasion)); + } + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawActionMidAir.cs b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawActionMidAir.cs new file mode 100644 index 0000000..ae11b31 --- /dev/null +++ b/src/Fie.Ponies.Applejack/FieStateMachineApplejackYeehawActionMidAir.cs @@ -0,0 +1,155 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Applejack +{ + public class FieStateMachineApplejackYeehawActionMidAir : FieStateMachineGameCharacterBase + { + private enum FireState + { + YEEHAW_ACTION_START, + YEEHAW_ACTION_END + } + + private const float YEEHAW_MID_AIR_TAKEOFF_PAST_TIME = 0.3f; + + private const float YEEHAW_MID_AIR_TAKEOFF_FORCE = 1f; + + private Type _nextState = typeof(FieStateMachineApplejackFlying); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isFinished; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieApplejack) + { + _timeCount += Time.deltaTime; + FieApplejack applejack = gameCharacter as FieApplejack; + switch (_fireState) + { + case FireState.YEEHAW_ACTION_START: + { + TrackEntry trackEntry = applejack.animationManager.SetAnimation(38, isLoop: false, isForceSet: true); + applejack.emotionController.SetEmoteAnimation(43, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "takeOff") + { + Vector3 externalInputVector = applejack.externalInputVector; + externalInputVector += Vector3.up + applejack.flipDirectionVector * 0.05f; + externalInputVector.Normalize(); + externalInputVector *= 1f; + applejack.resetMoveForce(); + applejack.setMoveForce(externalInputVector, 0.3f); + } + if (e.Data.Name == "finished") + { + applejack.isEnableGravity = true; + _isFinished = true; + applejack.emotionController.RestoreEmotionFromDefaultData(); + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + GDESkillTreeData skill = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV3_2); + if (skill != null) + { + applejack.isEnableCollider = false; + } + FieManagerBehaviour.I.EmitObject(applejack.mouthTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.EmitObject(applejack.centerTransform, Vector3.zero, null, applejack); + FieManagerBehaviour.I.setWiggler(1f, 10, Vector3.one * 0.2f); + } + else + { + _isEnd = true; + } + float num = 0.2f; + GDESkillTreeData skill2 = applejack.GetSkill(FieConstValues.FieSkill.HONESTY_YEEHAW_LV2_2); + if (skill2 != null) + { + num += skill2.Value1; + } + applejack.damageSystem.Regen((applejack.healthStats.maxHitPoint + applejack.healthStats.maxShield) * num); + _fireState = FireState.YEEHAW_ACTION_END; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.isEnableGravity = false; + autoFlipToEnemy(fieApplejack); + fieApplejack.isEnableAutoFlip = false; + fieApplejack.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieApplejack fieApplejack = gameCharacter as FieApplejack; + if (!(fieApplejack == null)) + { + fieApplejack.emotionController.RestoreEmotionFromDefaultData(); + fieApplejack.isEnableGravity = true; + fieApplejack.isEnableAutoFlip = true; + fieApplejack.isEnableHeadTracking = true; + fieApplejack.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineApplejackFireAir)); + list.Add(typeof(FieStateMachineApplejackFireRope)); + list.Add(typeof(FieStateMachineApplejackStompAction)); + } + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashAwesomeEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashAwesomeEffect.cs new file mode 100644 index 0000000..f9d4ea4 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashAwesomeEffect.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashAwesomeEffect")] + public class FieEmitObjectRainbowDashAwesomeEffect : FieEmittableObjectBase + { + [SerializeField] + private SmoothTrail awesomeTrail; + + [SerializeField] + private GameObject lightObject; + + private bool isEndUpdate; + + public override void awakeEmitObject() + { + if (awesomeTrail != null) + { + awesomeTrail.ClearSystem(emitState: true); + } + if (lightObject != null) + { + lightObject.SetActive(value: true); + } + isEndUpdate = false; + } + + public void Update() + { + if (!isEndUpdate) + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (awesomeTrail != null) + { + awesomeTrail.Emit = true; + } + } + } + + public void stopEffect(float destoryDuration) + { + if (awesomeTrail != null) + { + awesomeTrail.Emit = false; + } + if (lightObject != null) + { + lightObject.SetActive(value: false); + } + destoryEmitObject(destoryDuration); + isEndUpdate = true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack1.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack1.cs new file mode 100644 index 0000000..f7a17f3 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack1.cs @@ -0,0 +1,67 @@ +using Fie.Manager; +using Fie.Object; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashBaseAttack1")] + public class FieEmitObjectRainbowDashBaseAttack1 : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 1.5f; + + [SerializeField] + private float TRAIL_DURATION = 0.4f; + + [SerializeField] + private float DAMAGE_DURATION = 0.5f; + + [SerializeField] + private SmoothTrail _airKickTrail; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + _airKickTrail.Emit = true; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= TRAIL_DURATION) + { + _airKickTrail.Emit = false; + } + if (_lifeTimeCount >= DURATION) + { + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + base.transform.rotation = initTransform.rotation; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack2.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack2.cs new file mode 100644 index 0000000..aaf6db5 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack2.cs @@ -0,0 +1,50 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashBaseAttack2")] + public class FieEmitObjectRainbowDashBaseAttack2 : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 0.3f; + + [SerializeField] + private float DAMAGE_DURATION = 0.2f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack3.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack3.cs new file mode 100644 index 0000000..c0d733e --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashBaseAttack3.cs @@ -0,0 +1,85 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashBaseAttack3")] + public class FieEmitObjectRainbowDashBaseAttack3 : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 0.3f; + + [SerializeField] + private float TRAIL_DURATION = 0.4f; + + [SerializeField] + private float DAMAGE_DURATION = 0.2f; + + [Range(0f, 4f)] + [SerializeField] + private int GAIND_AWESOME_COUNT = 1; + + [SerializeField] + private float RAINBOW_DASH_BASE_ATTACK_PUSH_FORCE = 4f; + + [SerializeField] + private SmoothTrail _airKickTrail; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + _airKickTrail.Emit = true; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (_lifeTimeCount >= TRAIL_DURATION) + { + _airKickTrail.Emit = false; + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + if (base.ownerCharacter != null) + { + FieRainbowDash fieRainbowDash = base.ownerCharacter as FieRainbowDash; + if (fieRainbowDash != null) + { + fieRainbowDash.requestSetAwesomeEffect(GAIND_AWESOME_COUNT); + } + } + fieGameCharacter.setMoveForce(directionalVec * RAINBOW_DASH_BASE_ATTACK_PUSH_FORCE, 0f, useRound: false); + destoryEmitObject(DURATION - _lifeTimeCount); + _isEndUpdate = true; + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashCloaking.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashCloaking.cs new file mode 100644 index 0000000..0e5efc7 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashCloaking.cs @@ -0,0 +1,64 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashCloakEffect")] + public class FieEmitObjectRainbowDashCloaking : FieEmittableObjectBase + { + private float cloakDuration = 3f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private FieRainbowDash ownerRainbowDash; + + private bool HealthSystem_damageCheckEvent(FieGameCharacter attacker, FieDamage damage) + { + return false; + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= cloakDuration) + { + Disable(); + } + } + } + + public void Enable() + { + ownerRainbowDash = (base.ownerCharacter as FieRainbowDash); + if (!(ownerRainbowDash == null) && base.ownerCharacter != null) + { + ownerRainbowDash.damageSystem.damageCheckEvent += HealthSystem_damageCheckEvent; + } + } + + public void Disable() + { + if (!_isEndUpdate) + { + if (base.ownerCharacter != null) + { + base.ownerCharacter.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + } + if (ownerRainbowDash != null) + { + ownerRainbowDash.Decloack(); + } + destoryEmitObject(); + _isEndUpdate = true; + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackActivationEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackActivationEffect.cs new file mode 100644 index 0000000..e4e9286 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackActivationEffect.cs @@ -0,0 +1,19 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashDoublePaybackActivationEffect")] + public class FieEmitObjectRainbowDashDoublePaybackActivationEffect : FieEmittableObjectBase + { + private const float duration = 4f; + + public override void awakeEmitObject() + { + destoryEmitObject(4f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackAttackingEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackAttackingEffect.cs new file mode 100644 index 0000000..28af0b5 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackAttackingEffect.cs @@ -0,0 +1,61 @@ +using Fie.Object; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashDoublePaybackAttackingEffect")] + public class FieEmitObjectRainbowDashDoublePaybackAttackingEffect : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX lightningEffect; + + [SerializeField] + private SmoothTrail attackingTrail; + + private bool isEndUpdate; + + public override void awakeEmitObject() + { + if (lightningEffect != null) + { + lightningEffect.StopEffect(); + lightningEffect.StartEffect(); + } + if (attackingTrail != null) + { + attackingTrail.ClearSystem(emitState: true); + } + isEndUpdate = false; + } + + public void Update() + { + if (!isEndUpdate) + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (attackingTrail != null) + { + attackingTrail.Emit = true; + } + } + } + + public void stopEffect(float destoryDuration) + { + if (lightningEffect != null) + { + lightningEffect.StopEffect(); + } + if (attackingTrail != null) + { + attackingTrail.Emit = false; + } + destoryEmitObject(destoryDuration); + isEndUpdate = true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackCollision.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackCollision.cs new file mode 100644 index 0000000..371559d --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackCollision.cs @@ -0,0 +1,59 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashDoublePaybackCollision")] + public class FieEmitObjectRainbowDashDoublePaybackCollision : FieEmittableObjectBase + { + [SerializeField] + private float RAINBOW_DASH_DOUBLE_PAYBACK_DURATION = 0.6f; + + [SerializeField] + private float RAINBOW_DASH_DOUBLE_PAYBACK_DAMAGE_DURATION = 0.5f; + + [SerializeField] + private float RAINBOW_DASH_DOUBLE_PAYBACK_PUSH_FORCE = 7f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.localRotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= RAINBOW_DASH_DOUBLE_PAYBACK_DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > RAINBOW_DASH_DOUBLE_PAYBACK_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, directionalVec); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(directionalVec * RAINBOW_DASH_DOUBLE_PAYBACK_PUSH_FORCE, 0f, useRound: false); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackHitEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackHitEffect.cs new file mode 100644 index 0000000..fba04a1 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashDoublePaybackHitEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashDoublePaybackHitEffect")] + public class FieEmitObjectRainbowDashDoublePaybackHitEffect : FieEmittableObjectBase + { + private const float duration = 3f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(3f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashEvasionEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashEvasionEffect.cs new file mode 100644 index 0000000..741c805 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashEvasionEffect.cs @@ -0,0 +1,70 @@ +using Fie.Manager; +using Fie.Object; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashEvasionEffect")] + public class FieEmitObjectRainbowDashEvasionEffect : FieEmittableObjectBase + { + [SerializeField] + private SmoothTrail evasionTrail; + + [SerializeField] + private float DAMAGE_DURATION = 0.3f; + + private const float TRAIL_EMIT_DURATION = 0.15f; + + private const float DURATION = 0.6f; + + private float _lifeCount; + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (evasionTrail != null) + { + evasionTrail.ClearSystem(emitState: true); + evasionTrail.Emit = true; + } + if (directionalVec != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + destoryEmitObject(0.6f); + } + + private void Update() + { + _lifeCount += Time.deltaTime; + if (_lifeCount > 0.15f) + { + evasionTrail.Emit = false; + } + } + + private void LateUpdate() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!(_lifeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectMiddle.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectMiddle.cs new file mode 100644 index 0000000..df1ba35 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectMiddle.cs @@ -0,0 +1,16 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashHitEffectMiddle")] + public class FieEmitObjectRainbowDashHitEffectMiddle : FieEmittableObjectBase + { + private const float DURATION = 1.5f; + + public override void awakeEmitObject() + { + base.transform.position = directionalVec; + destoryEmitObject(1.5f); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectSmall.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectSmall.cs new file mode 100644 index 0000000..3a484ea --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectSmall.cs @@ -0,0 +1,16 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashHitEffectSmall")] + public class FieEmitObjectRainbowDashHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + base.transform.position = directionalVec; + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectStab.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectStab.cs new file mode 100644 index 0000000..7d55279 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashHitEffectStab.cs @@ -0,0 +1,16 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashHitEffectStab")] + public class FieEmitObjectRainbowDashHitEffectStab : FieEmittableObjectBase + { + private const float DURATION = 1.5f; + + public override void awakeEmitObject() + { + base.transform.position = directionalVec; + destoryEmitObject(1.5f); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashLoosingAwesomeEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashLoosingAwesomeEffect.cs new file mode 100644 index 0000000..21df474 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashLoosingAwesomeEffect.cs @@ -0,0 +1,19 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashLoosingAwesomeEffect")] + public class FieEmitObjectRainbowDashLoosingAwesomeEffect : FieEmittableObjectBase + { + private const float duration = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashActivationEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashActivationEffect.cs new file mode 100644 index 0000000..ca2243f --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashActivationEffect.cs @@ -0,0 +1,19 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashActivationEffect")] + public class FieEmitObjectRainbowDashOmniSmashActivationEffect : FieEmittableObjectBase + { + private const float duration = 4f; + + public override void awakeEmitObject() + { + destoryEmitObject(4f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosion.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosion.cs new file mode 100644 index 0000000..dd230ca --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosion.cs @@ -0,0 +1,96 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashExplosion")] + public class FieEmitObjectRainbowDashOmniSmashExplosion : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 1.5f; + + [SerializeField] + private float DAMAGE_DELAY = 0.5f; + + [SerializeField] + private float DAMAGE_DURATION = 1.2f; + + [SerializeField] + private SphereCollider hitCollider; + + public float scale = 1f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + private float _scaleMagni = 1f; + + public override void awakeEmitObject() + { + base.awakeEmitObject(); + scale = 1f; + hitCollider.enabled = false; + _scaleMagni = 1f; + FieRainbowDash fieRainbowDash = base.ownerCharacter as FieRainbowDash; + if (fieRainbowDash != null) + { + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_OMNISMASH_LV3_2); + if (skill != null) + { + _scaleMagni += skill.Value1; + } + } + } + + public void SetScale(float newScale) + { + scale = newScale * _scaleMagni; + hitCollider.gameObject.transform.localScale = Vector3.one * scale; + } + + public void Update() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (_lifeTimeCount >= DAMAGE_DELAY) + { + hitCollider.enabled = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString() && !(base.ownerCharacter == null)) + { + FieRainbowDash fieRainbowDash = base.ownerCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + defaultDamageObject.damage *= (float)fieRainbowDash.omniSmashAttackingCount; + FieGameCharacter x = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (x != null) + { + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosionEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosionEffect.cs new file mode 100644 index 0000000..26683fc --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashExplosionEffect.cs @@ -0,0 +1,38 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashExplosionEffect")] + public class FieEmitObjectRainbowDashOmniSmashExplosionEffect : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX effectFx; + + public float scale = 1f; + + private const float duration = 2.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(2.5f); + scale = 1f; + if (effectFx != null) + { + effectFx.StopEffect(); + effectFx.StartEffect(); + } + } + + public void SetScale(float newScale) + { + scale = newScale; + effectFx.SetAttribute(new PKFxManager.Attribute("Scale", scale)); + } + + private void Update() + { + base.transform.rotation = Quaternion.identity; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFinishHit.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFinishHit.cs new file mode 100644 index 0000000..a8ce5d8 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFinishHit.cs @@ -0,0 +1,65 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashFinishHit")] + public class FieEmitObjectRainbowDashOmniSmashFinishHit : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 0.4f; + + [SerializeField] + private float DAMAGE_DURATION = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } + + protected void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString() && !(base.ownerCharacter == null)) + { + FieRainbowDash fieRainbowDash = base.ownerCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + defaultDamageObject.damage *= (float)fieRainbowDash.omniSmashAttackingCount * 2f; + defaultDamageObject.stagger *= 1f + (float)fieRainbowDash.omniSmashAttackingCount * 0.5f; + FieGameCharacter x = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + if (base.ownerCharacter != null && base.ownerCharacter.friendshipStats != null) + { + base.ownerCharacter.friendshipStats.safeAddFriendship(base.gainedFriendshipPoint * ((float)fieRainbowDash.omniSmashAttackingCount * 0.5f)); + } + } + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFirstHit.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFirstHit.cs new file mode 100644 index 0000000..68ea1dc --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashFirstHit.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashFirstHit")] + public class FieEmitObjectRainbowDashOmniSmashFirstHit : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 0.4f; + + [SerializeField] + private float DAMAGE_DURATION = 0.3f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } + + protected void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashHitEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashHitEffect.cs new file mode 100644 index 0000000..8aeca90 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashHitEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashHitEffect")] + public class FieEmitObjectRainbowDashOmniSmashHitEffect : FieEmittableObjectBase + { + private const float duration = 1.5f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(1.5f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashImpactEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashImpactEffect.cs new file mode 100644 index 0000000..58e9bde --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashImpactEffect.cs @@ -0,0 +1,31 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashImpactEffect")] + public class FieEmitObjectRainbowDashOmniSmashImpactEffect : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX effectFx; + + private const float duration = 1.5f; + + public override void awakeEmitObject() + { + destoryEmitObject(1.5f); + if (effectFx != null) + { + effectFx.StopEffect(); + effectFx.StartEffect(); + } + FieManagerBehaviour.I.gameCamera.setWiggler(0.5f, 6, new Vector3(0.5f, 0.5f, 0.5f)); + } + + private void Update() + { + base.transform.rotation = Quaternion.identity; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashRainboomEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashRainboomEffect.cs new file mode 100644 index 0000000..5677782 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashRainboomEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashRainboomEffect")] + public class FieEmitObjectRainbowDashOmniSmashRainboomEffect : FieEmittableObjectBase + { + private const float duration = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + + private void Update() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashSecondHit.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashSecondHit.cs new file mode 100644 index 0000000..83cf6e7 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashSecondHit.cs @@ -0,0 +1,99 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using System.Collections; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashSecondHit")] + public class FieEmitObjectRainbowDashOmniSmashSecondHit : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX trailFx; + + [SerializeField] + private float DURATION = 1.5f; + + [SerializeField] + private float DISTANCE = 2f; + + [SerializeField] + private float TRAIL_EMIT_DURATION = 0.28f; + + [SerializeField] + private float DAMAGE_DURATION = 0.2f; + + private float _lifeTimeCount; + + private bool _isEndTrail; + + private bool _isEndUpdate; + + private Vector3 _targetPosition = Vector3.zero; + + private Vector3 _hormingDirectionalVec = Vector3.zero; + + private Tweener _positionTweener = new Tweener(); + + private IEnumerator StopEffectCoroutine() + { + yield return (object)new WaitForSeconds(TRAIL_EMIT_DURATION); + /*Error: Unable to find new state assignment for yield return*/; + } + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (trailFx != null) + { + trailFx.StopEffect(); + trailFx.StartEffect(); + } + destoryEmitObject(DURATION); + StartCoroutine(StopEffectCoroutine()); + } + + public void SetInitializePosition(Vector3 worldPosition) + { + base.transform.position = worldPosition; + _hormingDirectionalVec = initTransform.position - base.transform.position; + _targetPosition = initTransform.position + _hormingDirectionalVec.normalized * DISTANCE; + _positionTweener.InitTweener(DAMAGE_DURATION, base.transform.position, _targetPosition); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + UpdateTransform(); + } + } + + private void UpdateTransform() + { + if (!_positionTweener.IsEnd()) + { + base.transform.position = _positionTweener.UpdateParameterVec3(Time.deltaTime); + base.transform.rotation = Quaternion.LookRotation(_hormingDirectionalVec); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashTrailEffect.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashTrailEffect.cs new file mode 100644 index 0000000..32eefde --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashOmniSmashTrailEffect.cs @@ -0,0 +1,57 @@ +using Fie.Object; +using System.Collections; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashOmniSmashTrailEffect")] + public class FieEmitObjectRainbowDashOmniSmashTrailEffect : FieEmittableObjectBase + { + [SerializeField] + private PKFxFX trailFx; + + private const float TRAIL_EMIT_DURATION = 0.3f; + + private const float DURATION = 1f; + + private float _lifeCount; + + private IEnumerator StopEffectCoroutine() + { + yield return (object)new WaitForSeconds(0.3f); + /*Error: Unable to find new state assignment for yield return*/; + } + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (trailFx != null) + { + trailFx.StopEffect(); + trailFx.StartEffect(); + } + if (directionalVec != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + } + destoryEmitObject(1f); + StartCoroutine(StopEffectCoroutine()); + } + + private void Update() + { + _lifeCount += Time.deltaTime; + } + + private void LateUpdate() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntity.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntity.cs new file mode 100644 index 0000000..3c3a000 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntity.cs @@ -0,0 +1,139 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System.Collections; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashRainblowEntity")] + public class FieEmitObjectRainbowDashRainblowEntity : FieEmittableObjectBase + { + [SerializeField] + private float rainblowDuration = 7f; + + [SerializeField] + private float rainblowDestroyDuration = 2f; + + [SerializeField] + private PKFxFX _rainblowFx; + + [SerializeField] + private AudioSource _vortexSound; + + [SerializeField] + private AnimationCurve _damageRatePerLifeRatio; + + [SerializeField] + private AnimationCurve _StaggerDamageRatePerLifeRatio; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private Tweener _speedDamperTweener = new Tweener(); + + private float _healingDelay; + + private float _healingRate; + + private float _healingRemSec; + + private FieStatusEffectsTimeScaler _timeScalerStatusEffectEntity; + + private IEnumerator stopAudio() + { + if (_vortexSound.volume > 0f) + { + yield return (object)new WaitForSeconds(0.05f); + /*Error: Unable to find new state assignment for yield return*/; + } + } + + public override void awakeEmitObject() + { + if (!(_rainblowFx == null) && !(_vortexSound == null)) + { + _rainblowFx.StopEffect(); + _rainblowFx.SetAttribute(new PKFxManager.Attribute("TornadeLife", rainblowDuration - rainblowDestroyDuration)); + _rainblowFx.StartEffect(); + _vortexSound.volume = 0.5f; + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV4_WINGPOWER_EMITTER); + if (skill != null) + { + _healingDelay = skill.Value1; + _healingRate = skill.Value2; + } + } + if (_timeScalerStatusEffectEntity != null) + { + _timeScalerStatusEffectEntity.isActive = false; + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV4_STICKY_TORNADO); + if (skill2 != null) + { + if (_timeScalerStatusEffectEntity == null) + { + _timeScalerStatusEffectEntity = base.gameObject.AddComponent(); + } + _timeScalerStatusEffectEntity.isActive = true; + _timeScalerStatusEffectEntity.duration = skill2.Value1; + _timeScalerStatusEffectEntity.targetTimeScale = skill2.Value2; + } + } + } + + public void Update() + { + base.transform.rotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= rainblowDuration - rainblowDestroyDuration) + { + stopParticleEmitting(); + destoryEmitObject(rainblowDestroyDuration); + _isEndUpdate = true; + } + if (_healingRemSec <= 0f) + { + if (base.ownerCharacter != null && _healingRate > 0f) + { + base.ownerCharacter.damageSystem.Regen((base.ownerCharacter.healthStats.maxHitPoint + base.ownerCharacter.healthStats.maxShield) * _healingRate); + } + _healingRemSec = _healingDelay; + } + else + { + _healingRemSec -= Time.deltaTime; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + float num = _damageRatePerLifeRatio.Evaluate(Mathf.Clamp(_lifeTimeCount / (rainblowDuration - rainblowDestroyDuration), 0f, 1f)); + float num2 = _StaggerDamageRatePerLifeRatio.Evaluate(Mathf.Clamp(_lifeTimeCount / (rainblowDuration - rainblowDestroyDuration), 0f, 1f)); + defaultDamageObject.damage *= num; + defaultDamageObject.stagger *= num2; + FieGameCharacter x = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (x != null) + { + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + } + } + + private void stopParticleEmitting() + { + _rainblowFx.StopEffect(); + StartCoroutine(stopAudio()); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntityMidAir.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntityMidAir.cs new file mode 100644 index 0000000..d21815a --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowEntityMidAir.cs @@ -0,0 +1,139 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System.Collections; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashRainblowEntityMidAir")] + public class FieEmitObjectRainbowDashRainblowEntityMidAir : FieEmittableObjectBase + { + [SerializeField] + private float rainblowDuration = 7f; + + [SerializeField] + private float rainblowDestroyDuration = 2f; + + [SerializeField] + private PKFxFX _rainblowFx; + + [SerializeField] + private AudioSource _vortexSound; + + [SerializeField] + private AnimationCurve _damageRatePerLifeRatio; + + [SerializeField] + private AnimationCurve _StaggerDamageRatePerLifeRatio; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private Tweener _speedDamperTweener = new Tweener(); + + private float _healingDelay; + + private float _healingRate; + + private float _healingRemSec; + + private FieStatusEffectsTimeScaler _timeScalerStatusEffectEntity; + + private IEnumerator stopAudio() + { + if (_vortexSound.volume > 0f) + { + yield return (object)new WaitForSeconds(0.05f); + /*Error: Unable to find new state assignment for yield return*/; + } + } + + public override void awakeEmitObject() + { + if (!(_rainblowFx == null) && !(_vortexSound == null)) + { + _rainblowFx.StopEffect(); + _rainblowFx.SetAttribute(new PKFxManager.Attribute("TornadeLife", rainblowDuration - rainblowDestroyDuration)); + _rainblowFx.StartEffect(); + _vortexSound.volume = 0.5f; + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV4_WINGPOWER_EMITTER); + if (skill != null) + { + _healingDelay = skill.Value1; + _healingRate = skill.Value2; + } + } + if (_timeScalerStatusEffectEntity != null) + { + _timeScalerStatusEffectEntity.isActive = false; + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV4_STICKY_TORNADO); + if (skill2 != null) + { + if (_timeScalerStatusEffectEntity == null) + { + _timeScalerStatusEffectEntity = base.gameObject.AddComponent(); + } + _timeScalerStatusEffectEntity.isActive = true; + _timeScalerStatusEffectEntity.duration = skill2.Value1; + _timeScalerStatusEffectEntity.targetTimeScale = skill2.Value2; + } + } + } + + public void Update() + { + base.transform.rotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= rainblowDuration - rainblowDestroyDuration) + { + stopParticleEmitting(); + destoryEmitObject(rainblowDestroyDuration); + _isEndUpdate = true; + } + if (_healingRemSec <= 0f) + { + if (base.ownerCharacter != null && _healingRate > 0f) + { + base.ownerCharacter.damageSystem.Regen((base.ownerCharacter.healthStats.maxHitPoint + base.ownerCharacter.healthStats.maxShield) * _healingRate); + } + _healingRemSec = _healingDelay; + } + else + { + _healingRemSec -= Time.deltaTime; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + float num = _damageRatePerLifeRatio.Evaluate(Mathf.Clamp(_lifeTimeCount / (rainblowDuration - rainblowDestroyDuration), 0f, 1f)); + float num2 = _StaggerDamageRatePerLifeRatio.Evaluate(Mathf.Clamp(_lifeTimeCount / (rainblowDuration - rainblowDestroyDuration), 0f, 1f)); + defaultDamageObject.damage *= num; + defaultDamageObject.stagger *= num2; + FieGameCharacter x = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (x != null) + { + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + } + } + + private void stopParticleEmitting() + { + _rainblowFx.StopEffect(); + StartCoroutine(stopAudio()); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowSeed.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowSeed.cs new file mode 100644 index 0000000..5b65518 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashRainblowSeed.cs @@ -0,0 +1,95 @@ +using Fie.Object; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashRainblowEmitEffect")] + public class FieEmitObjectRainbowDashRainblowSeed : FieEmittableObjectBase + { + [SerializeField] + private float seedDuration = 4f; + + [SerializeField] + private float seedDestroyDuration = 0.5f; + + [SerializeField] + private float entytyInstantiateDelay; + + [SerializeField] + private float seedVelocity = 3f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private IEnumerator EmitRainblowCoroutine() + { + yield return (object)new WaitForSeconds(entytyInstantiateDelay); + /*Error: Unable to find new state assignment for yield return*/; + } + + private IEnumerator StopEffectCoroutine() + { + _childParticles.ForEach(delegate(PKFxFX particle) + { + particle.SetAttribute(new PKFxManager.Attribute("PositionMagni", 5f)); + }); + yield return (object)new WaitForSeconds(0.1f); + /*Error: Unable to find new state assignment for yield return*/; + } + + public override void awakeEmitObject() + { + base.transform.position = initTransform.position; + _childParticles.ForEach(delegate(PKFxFX particle) + { + particle.StopEffect(); + particle.SetAttribute(new PKFxManager.Attribute("PositionMagni", 0.5f)); + particle.StartEffect(); + }); + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + Vector3 vector = directionalVec * seedVelocity * Time.deltaTime; + base.transform.position += vector; + base.transform.rotation.SetLookRotation(vector); + if (_lifeTimeCount >= seedDuration - seedDestroyDuration) + { + stopParticleEmitting(); + destoryEmitObject(seedDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider other) + { + if (!_isEndUpdate && !(_lifeTimeCount > seedDuration - seedDestroyDuration) && other.gameObject.tag == "Floor") + { + emitRainBlowEntity(); + stopParticleEmitting(); + destoryEmitObject(seedDestroyDuration); + _isEndUpdate = true; + } + } + + private void stopParticleEmitting() + { + StartCoroutine(StopEffectCoroutine()); + } + + private void emitRainBlowEntity() + { + StartCoroutine(EmitRainblowCoroutine()); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashStabAttack.cs b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashStabAttack.cs new file mode 100644 index 0000000..d55d281 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieEmitObjectRainbowDashStabAttack.cs @@ -0,0 +1,111 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/Power/RainbowDashStabAttack")] + public class FieEmitObjectRainbowDashStabAttack : FieEmittableObjectBase + { + [SerializeField] + private float DURATION = 0.3f; + + [SerializeField] + private float TRAIL_DURATION = 0.4f; + + [SerializeField] + private float DAMAGE_DURATION = 0.2f; + + [Range(0f, 4f)] + [SerializeField] + private int GAIND_AWESOME_COUNT = 1; + + [SerializeField] + private float RAINBOW_DASH_STAB_ATTACK_PULL_FORCE = 8f; + + [SerializeField] + private SmoothTrail _airKickTrail; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + _airKickTrail.Emit = true; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= DURATION) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (_lifeTimeCount >= TRAIL_DURATION) + { + _airKickTrail.Emit = false; + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString()) + { + FieRainbowDash fieRainbowDash = base.ownerCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + float damage = defaultDamageObject.damage; + float num = defaultDamageObject.damage; + bool flag = false; + FieCollider component = collider.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (parentGameCharacter != null && Vector3.Dot(fieRainbowDash.flipDirectionVector, parentGameCharacter.flipDirectionVector) > 0f) + { + flag = true; + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV1_1); + if (skill != null) + { + num += damage * skill.Value1; + } + GDESkillTreeData skill2 = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_RAINBLOW_LV3_1); + if (skill2 != null) + { + num += damage * skill2.Value1; + } + if (flag) + { + defaultDamageObject.damage = num * 3f; + } + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, defaultDamageObject); + if (fieGameCharacter != null) + { + FieManagerBehaviour.I.EmitObject(base.transform, collider.ClosestPointOnBounds(base.transform.position)); + FieManagerBehaviour.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + if (base.ownerCharacter != null && fieRainbowDash != null) + { + fieRainbowDash.requestSetAwesomeEffect(GAIND_AWESOME_COUNT); + } + fieGameCharacter.setMoveForce(directionalVec * (RAINBOW_DASH_STAB_ATTACK_PULL_FORCE * -1f), 0f, useRound: false); + } + } + } + } + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieRainbowDash.cs b/src/Fie.Ponies.RainbowDash/FieRainbowDash.cs new file mode 100644 index 0000000..3a89615 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieRainbowDash.cs @@ -0,0 +1,361 @@ +using Fie.AI; +using Fie.Manager; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.UI; +using GameDataEditor; +using Spine.Unity.Modules; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + [FiePrefabInfo("Prefabs/RainbowDash/RainbowDash")] + public class FieRainbowDash : FiePonies, FiePlayableGameCharacterInterface + { + public const int MAXIMUM_AWESOME_EFFECT_COUNT = 4; + + public const float AWESOME_DAMAGE_CUTOFF_RATE = 0.2f; + + public const float AWESOME_STAGGER_CUTOFF_RATE = 0.2f; + + private int _maximumAwesomeCount = 4; + + private bool _isCloackMode; + + private bool _reserveColliderState; + + private int _omniSmashAttackingCount; + + private Dictionary _awesomeEffectList = new Dictionary(); + + private SkeletonRendererCustomMaterials _customSpineMaterialComponent; + + private FieEmitObjectRainbowDashCloaking _cloackObject; + + public int maximumAwesomeCount => _maximumAwesomeCount; + + public override bool isEnableCollider + { + get + { + return _isEnableCollider; + } + set + { + if (!_isCloackMode) + { + if (_colliderList.Count > 0) + { + foreach (FieCollider collider in _colliderList) + { + collider.isEnable = value; + } + } + } + else + { + _reserveColliderState = value; + } + _isEnableCollider = value; + } + } + + public bool isCloackMode => _isCloackMode; + + public int omniSmashAttackingCount => _omniSmashAttackingCount; + + public int awesomeCount + { + get + { + CleanUpAwesomeCount(); + if (_awesomeEffectList == null) + { + return 0; + } + return _awesomeEffectList.Count; + } + } + + public void Cloack() + { + if (_cloackObject != null && _cloackObject.enabled) + { + _cloackObject.Disable(); + _cloackObject = null; + } + FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.up); + _cloackObject = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, null, this); + if (!(_cloackObject == null)) + { + _cloackObject.Enable(); + if (_colliderList.Count > 0) + { + foreach (FieCollider collider in _colliderList) + { + collider.isEnable = false; + } + } + _customSpineMaterialComponent.SetCustomMaterialOverrides(forceEnable: true); + isEnableCollider = false; + _isCloackMode = true; + UnbindFromDetecter(); + } + } + + public void Decloack() + { + if (_isCloackMode) + { + if (_colliderList.Count > 0) + { + foreach (FieCollider collider in _colliderList) + { + collider.isEnable = _reserveColliderState; + } + } + FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.up); + _customSpineMaterialComponent.RemoveCustomMaterialOverrides(); + _isCloackMode = false; + _cloackObject = null; + } + } + + private void CleanUpAwesomeCount() + { + List list = new List(); + for (int i = 1; i <= maximumAwesomeCount; i++) + { + if (_awesomeEffectList.ContainsKey(i) && (_awesomeEffectList[i] == null || _awesomeEffectList[i].gameObject == null)) + { + list.Add(i); + } + } + if (list.Count > 0) + { + foreach (int item in list) + { + _awesomeEffectList.Remove(item); + } + } + } + + public override Type getDefaultAttackState() + { + return null; + } + + public override Type getStormState() + { + return null; + } + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieRainbowDashAnimationContainer()); + _customSpineMaterialComponent = base.gameObject.GetComponent(); + _staggerCancelableStateList.Add(typeof(FieStateMachineRainbowDashEvasion)); + _staggerCancelableStateList.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + _staggerCancelableStateList.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + abstractStateList.Add(typeof(FieStateMachinePoniesJump), typeof(FieStateMachineRainbowDashJump)); + abstractStateList.Add(typeof(FieStateMachinePoniesEvasion), typeof(FieStateMachineRainbowDashEvasion)); + abstractStateList.Add(typeof(FieStateMachinePoniesBaseAttack), typeof(FieStateMachineRainbowDashBaseAttack)); + SetStateActivateCheckCallback(EvasionActivateCheck); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_1, new FieStateMachineRainbowDashDoublePayback()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_2, new FieStateMachineRainbowDashRainblow()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_3, new FieStateMachineRainbowDashOmniSmash()); + syncBindedAbilities(); + base.abilitiesContainer.setActivationCallback(typeof(FieStateMachineRainbowDashOmniSmash), OmniSmashActivationCallback); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + base.emotionController.SetDefaultEmoteAnimationID(15); + base.emotionController.RestoreEmotionFromDefaultData(); + base.detector.intoTheBattleEvent += Detector_intoTheBattleEvent; + base.damageSystem.beforeDamageEvent += this.HealthSystem_beforeDamageEvent; + ReCalcSkillData(); + } + + protected override void ReCalcSkillData() + { + _maximumAwesomeCount = 4; + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.LOYALTY_ATTACK_PASSIVE_LV4_HELLO_CAPTAIN_AWESOME); + if (skill != null) + { + _maximumAwesomeCount += (int)skill.Value1; + } + } + + private bool OmniSmashActivationCallback(FieGameCharacter gameCharacter) + { + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_ABILITY_3), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_ABILITY_3)); + if (base.detector.lockonTargetObject == null || awesomeCount <= 0) + { + return false; + } + return true; + } + + public void CalcOmniSmashAttackCount() + { + _omniSmashAttackingCount = 2 * Mathf.Max(0, awesomeCount); + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.LOYALTY_OMNISMASH_LV4_LET_ME_SHOW_YOU_MY_TRUE_POWER); + if (skill != null) + { + _omniSmashAttackingCount *= (int)skill.Value1; + } + requestSetAwesomeEffect(-maximumAwesomeCount); + } + + private void HealthSystem_beforeDamageEvent(FieGameCharacter attacker, ref FieDamage damage) + { + if (damage != null && !(damage.damage <= 0f)) + { + int num = requestSetAwesomeEffect(-1); + if (num < 0) + { + damage.damage *= 0.2f; + damage.stagger *= 0.2f; + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.LOYALTY_DIFFENCE_PASSIVE_LV4_DEAL_WITH_IT); + if (skill != null) + { + base.damageSystem.AddDefenceMagni(skill.ID, 100f, skill.Value1); + } + GDESkillTreeData skill2 = GetSkill(FieConstValues.FieSkill.LOYALTY_DIFFENCE_PASSIVE_LV4_IT_IS_MY_TURN); + if (skill2 != null) + { + base.abilitiesContainer.IncreaseOrReduceCooldownAll(0f - skill.Value1); + } + } + } + } + + private void Detector_intoTheBattleEvent(FieGameCharacter targetCharacter) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ENEMY_DETECTED)); + } + + private bool EvasionActivateCheck() + { + if (healthStats.shield <= 0f) + { + return false; + } + return true; + } + + protected new void Start() + { + base.Start(); + getStateMachine(StateMachineType.Attack).setState(typeof(FieStateMachinePoniesAttackIdle), isForceSet: true); + getStateMachine().setState(typeof(FieStateMachineCommonIdle), isForceSet: false); + } + + public int requestSetAwesomeEffect(int calcCount) + { + if (base.photonView == null || base.photonView.isMine) + { + int num = Mathf.Clamp(_awesomeEffectList.Count + calcCount, 0, maximumAwesomeCount); + if (base.photonView != null) + { + object[] parameters = new object[1] + { + num + }; + base.photonView.RPC("SetAwesomeEffectRPC", PhotonTargets.Others, parameters); + } + return RebuildAwesomeStats(num); + } + return 0; + } + + private int RebuildAwesomeStats(int settleCount) + { + int count = _awesomeEffectList.Count; + List list = new List(); + for (int i = 1; i <= maximumAwesomeCount; i++) + { + if (_awesomeEffectList.ContainsKey(i)) + { + if (i > settleCount) + { + list.Add(i); + } + } + else if (i <= settleCount) + { + _awesomeEffectList[i] = FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.up); + } + } + if (list.Count > 0) + { + foreach (int item in list) + { + FieManagerBehaviour.I.EmitObject(_awesomeEffectList[item].transform, Vector3.up); + _awesomeEffectList[item].stopEffect(1f); + _awesomeEffectList.Remove(item); + } + } + return settleCount - count; + } + + [PunRPC] + public void SetAwesomeEffectRPC(int settleCount) + { + RebuildAwesomeStats(settleCount); + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetWordScriptText(GDEItemKeys.ConstantTextList_ELEMENT_NAME_LOYALTY_SIMPLE); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.LOYALTY; + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskRainbowDashIdle); + } + + public override KeyValuePair getAbilitiesIconInfo() + { + return new KeyValuePair(typeof(FieGameUIAbilitiesIconRainbowDash), "Prefabs/UI/AbilitiesIcons/RainbowDashAbilityIcon"); + } + + public override GDEGameCharacterTypeData getCharacterTypeData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.GameCharacterType_LOYALTY); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieRainbowDashAnimationContainer.cs b/src/Fie.Ponies.RainbowDash/FieRainbowDashAnimationContainer.cs new file mode 100644 index 0000000..e87319b --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieRainbowDashAnimationContainer.cs @@ -0,0 +1,69 @@ +using Fie.Object; + +namespace Fie.Ponies.RainbowDash +{ + public class FieRainbowDashAnimationContainer : FiePoniesAnimationContainer + { + public enum RainbowDashAnimationList + { + JUMP_TAKEOFF = 19, + JUMP, + JUMP_LANDING, + EVASION_FRONT, + EVASION_BACK, + EVASION_UP, + EVASION_DOWN, + BASE_ATTACK_1, + BASE_ATTACK_2, + BASE_ATTACK_3, + DOUBLE_PAYBACK_PREPARE_ON_GROUND, + DOUBLE_PAYBACK_PREPARE_ON_GROUND_SHORT_1, + DOUBLE_PAYBACK_PREPARE_ON_GROUND_SHORT_2, + DOUBLE_PAYBACK_PREPARE_ON_GROUND_END, + DOUBLE_PAYBACK_PREPARE_MID_AIR, + DOUBLE_PAYBACK_PREPARE_MID_AIR_SHORT_1, + DOUBLE_PAYBACK_PREPARE_MID_AIR_SHORT_2, + DOUBLE_PAYBACK_PREPARE_MID_AIR_END, + DOUBLE_PAYBACK_LOOP, + DOUBLE_PAYBACK_END, + OMNI_SMASH_START, + OMNI_SMASH_FINISHING_START, + OMNI_SMASH_FINISHING_END, + OMNI_SMASH_FINISHING_TO_IDLE, + OMNI_SMASH_FINISHING_TO_IDLE_SHORT_1, + OMNI_SMASH_WAITING, + CLOAK, + MAX_APPLEJACK_ANIMATION + } + + public FieRainbowDashAnimationContainer() + { + addAnimationData(19, new FieSkeletonAnimationObject(0, "jump")); + addAnimationData(20, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(22, new FieSkeletonAnimationObject(0, "evasion_front")); + addAnimationData(23, new FieSkeletonAnimationObject(0, "evasion_back")); + addAnimationData(24, new FieSkeletonAnimationObject(0, "evasion_up")); + addAnimationData(25, new FieSkeletonAnimationObject(0, "evasion_down")); + addAnimationData(26, new FieSkeletonAnimationObject(0, "base_attack_1")); + addAnimationData(27, new FieSkeletonAnimationObject(0, "base_attack_2")); + addAnimationData(28, new FieSkeletonAnimationObject(0, "base_attack_3")); + addAnimationData(29, new FieSkeletonAnimationObject(0, "counter_strike_prepare_on_ground")); + addAnimationData(30, new FieSkeletonAnimationObject(0, "counter_strike_prepare_on_ground_short_1")); + addAnimationData(31, new FieSkeletonAnimationObject(0, "counter_strike_prepare_on_ground_short_2")); + addAnimationData(32, new FieSkeletonAnimationObject(0, "counter_strike_prepare_on_ground_end")); + addAnimationData(33, new FieSkeletonAnimationObject(0, "counter_strike_prepare_mid_air")); + addAnimationData(34, new FieSkeletonAnimationObject(0, "counter_strike_prepare_mid_short_1")); + addAnimationData(35, new FieSkeletonAnimationObject(0, "counter_strike_prepare_mid_short_2")); + addAnimationData(36, new FieSkeletonAnimationObject(0, "counter_strike_prepare_mid_air_end")); + addAnimationData(37, new FieSkeletonAnimationObject(0, "counter_strike_loop")); + addAnimationData(38, new FieSkeletonAnimationObject(0, "counter_strike_end")); + addAnimationData(39, new FieSkeletonAnimationObject(0, "omnismash_start")); + addAnimationData(40, new FieSkeletonAnimationObject(0, "omnismash_finishing_start")); + addAnimationData(41, new FieSkeletonAnimationObject(0, "omnismash_finishing_end")); + addAnimationData(42, new FieSkeletonAnimationObject(0, "omnismash_finishing_to_idle")); + addAnimationData(43, new FieSkeletonAnimationObject(0, "omnismash_finishing_to_idle_short_1")); + addAnimationData(44, new FieSkeletonAnimationObject(0, "omnismash_finishing_waiting")); + addAnimationData(45, new FieSkeletonAnimationObject(0, "cloak")); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieRainbowDashTrailRotator.cs b/src/Fie.Ponies.RainbowDash/FieRainbowDashTrailRotator.cs new file mode 100644 index 0000000..d65d38a --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieRainbowDashTrailRotator.cs @@ -0,0 +1,35 @@ +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieRainbowDashTrailRotator : MonoBehaviour + { + [SerializeField] + private float axisZWiggleWidth = 25f; + + [SerializeField] + private float axisZSinSpeedPerSec = 30f; + + [SerializeField] + private float axisYRotateSpeedPerSec = 120f; + + private Vector3 trailVecotrNormal = new Vector3(0f, 1f, 0f); + + private float axisZRotater; + + private float axisYRotater; + + private void OnEnable() + { + axisZRotater = Random.Range(0f, 180f); + axisYRotater = Random.Range(0f, 360f); + } + + private void Update() + { + axisZRotater = Mathf.Repeat(axisZRotater + axisZSinSpeedPerSec * Time.deltaTime, 180f); + axisYRotater = Mathf.Repeat(axisYRotater + axisYRotateSpeedPerSec * Time.deltaTime, 360f); + base.transform.rotation = Quaternion.AngleAxis(axisYRotater, Quaternion.AngleAxis(Mathf.Sin(axisZRotater) * axisZWiggleWidth, Vector3.forward) * trailVecotrNormal); + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack.cs new file mode 100644 index 0000000..3d4b936 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack.cs @@ -0,0 +1,63 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashBaseAttack : FieStateMachineGameCharacterBase + { + public const float BASE_ATTACK_REGENERATION_DELAY = 1.5f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (true) + { + Type type = fieRainbowDash.getStateMachine().nowStateType(); + if (fieRainbowDash.isCloackMode) + { + fieRainbowDash.getStateMachine().setState(typeof(FieStateMachineRainbowDashStabAttack), isForceSet: false); + } + else if (type == typeof(FieStateMachineRainbowDashBaseAttack2)) + { + fieRainbowDash.getStateMachine().setState(typeof(FieStateMachineRainbowDashBaseAttack3), isForceSet: false); + } + else if (type == typeof(FieStateMachineRainbowDashBaseAttack1)) + { + fieRainbowDash.getStateMachine().setState(typeof(FieStateMachineRainbowDashBaseAttack2), isForceSet: false); + } + else + { + fieRainbowDash.getStateMachine().setState(typeof(FieStateMachineRainbowDashBaseAttack1), isForceSet: false); + } + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_BASE_ATTACK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_BASE_ATTACK)); + _isEnd = true; + } + } + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack1.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack1.cs new file mode 100644 index 0000000..538a364 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack1.cs @@ -0,0 +1,197 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashBaseAttack1 : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + private float _initializedDrag; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + autoFlipToEnemy(fieRainbowDash); + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_ATTACK_PASSIVE_LV4_SO_FAST_SO_COOL); + if (skill != null) + { + fieRainbowDash.baseTimeScale = skill.Value1; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.baseTimeScale = 1f; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + _timeCount += Time.deltaTime; + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + rainbowDash.damageSystem.setRegenerateDelay(Mathf.Max(1.5f, rainbowDash.healthStats.regenerateDelay)); + _nextState = ((rainbowDash.groundState != 0) ? typeof(FieStateMachineRainbowDashFlying) : typeof(FieStateMachineCommonIdle)); + switch (_fireState) + { + case FireState.KICK_START: + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(26, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(rainbowDash.leftBackHoofTransform, Vector3.zero, null, rainbowDash); + } + if (e.Data.Name == "move") + { + Vector3 a = rainbowDash.flipDirectionVector; + Transform lockonEnemyTransform = rainbowDash.detector.getLockonEnemyTransform(isCenter: true); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - rainbowDash.transform.position; + num = Mathf.Min(Vector3.Distance(lockonEnemyTransform.position, rainbowDash.transform.position) / 1f, 1f); + vector.Normalize(); + a = vector; + } + Vector3 vector2 = a * (e.Float * num); + rainbowDash.resetMoveForce(); + rainbowDash.setMoveForce(vector2, 0f, useRound: false); + if (rainbowDash.groundState == FieObjectGroundState.Grounding) + { + rainbowDash.setMoveForce(Vector3.up * e.Float * 0.2f, 0f, useRound: false); + } + rainbowDash.setFlipByVector(vector2); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRainbowDashBaseAttack2)); + } + if (_isCancellable) + { + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareOnGround)); + list.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + } + return list; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack2.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack2.cs new file mode 100644 index 0000000..83aad21 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack2.cs @@ -0,0 +1,204 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashBaseAttack2 : FieStateMachineGameCharacterBase + { + private enum FireState + { + PUNCH_START, + PUNCHING + } + + private const float PUNCH_DELAY = 0.5f; + + private const float PUNCH_HORMING_DISTANCE = 1f; + + private const float PUNCH_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + private int _punchCount; + + private float _initializedDrag; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + autoFlipToEnemy(fieRainbowDash); + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_ATTACK_PASSIVE_LV4_SO_FAST_SO_COOL); + if (skill != null) + { + fieRainbowDash.baseTimeScale = skill.Value1; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.baseTimeScale = 1f; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + _timeCount += Time.deltaTime; + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + rainbowDash.damageSystem.setRegenerateDelay(Mathf.Max(1.5f, rainbowDash.healthStats.regenerateDelay)); + _nextState = ((rainbowDash.groundState != 0) ? typeof(FieStateMachineRainbowDashFlying) : typeof(FieStateMachineCommonIdle)); + switch (_fireState) + { + case FireState.PUNCH_START: + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(27, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + switch (_punchCount) + { + case 0: + FieManagerBehaviour.I.EmitObject(rainbowDash.leftFrontHoofTransform, rainbowDash.flipDirectionVector, null, rainbowDash); + break; + case 1: + FieManagerBehaviour.I.EmitObject(rainbowDash.rightFrontHoofTransform, rainbowDash.flipDirectionVector, null, rainbowDash); + break; + } + _punchCount++; + } + if (e.Data.Name == "move") + { + Vector3 a = rainbowDash.flipDirectionVector; + Transform lockonEnemyTransform = rainbowDash.detector.getLockonEnemyTransform(isCenter: true); + float num = 0.5f; + if (lockonEnemyTransform != null) + { + Vector3 vector = lockonEnemyTransform.position - rainbowDash.transform.position; + num = Mathf.Min(Vector3.Distance(lockonEnemyTransform.position, rainbowDash.transform.position) / 1f, 1f); + vector.Normalize(); + a = vector; + } + Vector3 vector2 = a * (e.Float * num); + rainbowDash.resetMoveForce(); + rainbowDash.setMoveForce(vector2, 0f, useRound: false); + rainbowDash.setFlipByVector(vector2); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.PUNCHING; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + } + if (_isCancellable) + { + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareOnGround)); + list.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + } + return list; + } + + public override float getDelay() + { + return 0.5f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack3.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack3.cs new file mode 100644 index 0000000..66c4eaa --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashBaseAttack3.cs @@ -0,0 +1,183 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashBaseAttack3 : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 0.5f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + private float _initializedDrag; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + autoFlipToEnemy(fieRainbowDash); + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_ATTACK_PASSIVE_LV4_SO_FAST_SO_COOL); + if (skill != null) + { + fieRainbowDash.baseTimeScale = skill.Value1; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.baseTimeScale = 1f; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + _timeCount += Time.deltaTime; + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + rainbowDash.damageSystem.setRegenerateDelay(Mathf.Max(1.5f, rainbowDash.healthStats.regenerateDelay)); + _nextState = ((rainbowDash.groundState != 0) ? typeof(FieStateMachineRainbowDashFlying) : typeof(FieStateMachineCommonIdle)); + switch (_fireState) + { + case FireState.KICK_START: + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(28, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(rainbowDash.leftBackHoofTransform, Vector3.zero, null, rainbowDash); + } + if (e.Data.Name == "move") + { + Vector3 vector = rainbowDash.flipDirectionVector * -1f * e.Float; + rainbowDash.resetMoveForce(); + rainbowDash.setMoveForce(vector, 0f, useRound: false); + rainbowDash.setFlipByVector(vector * -1f); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + } + if (_isCancellable) + { + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareOnGround)); + list.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + } + return list; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePayback.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePayback.cs new file mode 100644 index 0000000..e67603c --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePayback.cs @@ -0,0 +1,64 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; + +namespace Fie.Ponies.RainbowDash +{ + [FieAbilityID(FieConstValues.FieAbility.DOUBLE_PAYBACK)] + public class FieStateMachineRainbowDashDoublePayback : FieStateMachineAbilityBase + { + private const string DOUBLE_PAYBACK_ABILITY_SIGNATURE = "double_payback"; + + public const float DOUBLE_PAYBACK_DEFAULT_COOLDOWN = 12f; + + public const int DOUBLE_PAYBACK_GETTING_AWESOME_COUNT = 1; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + Type type = null; + type = ((fieRainbowDash.groundState != 0) ? typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir) : typeof(FieStateMachineRainbowDashDoublePaybackPrepareOnGround)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_ABILITY_1)); + fieRainbowDash.getStateMachine().setState(type, isForceSet: false); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 12f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override string getSignature() + { + return "double_payback"; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackAttacking.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackAttacking.cs new file mode 100644 index 0000000..6627841 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackAttacking.cs @@ -0,0 +1,286 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashDoublePaybackAttacking : FieStateMachineGameCharacterBase + { + private enum AttackState + { + DISAPPEAR, + PREPARE_FOR_APPEAR, + ATTACKING, + APPEAR, + ATTACK_FINISHED + } + + private const float ATTACKING_DURATION = 0.1f; + + private const float DOUBLE_PAYBACK_APPEAR_DELAY = 0.2f; + + private const float DOUBLE_PAYBACK_ATTACK_DELAY = 0.5f; + + private const float DOUBLE_PAYBACK_MOVING_DISTANCE = 2.5f; + + private const float DOUBLE_PAYBACK_EFFECT_DESTROY_DELAY = 1f; + + private Type _nextState = typeof(FieStateMachineRainbowDashFlying); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private float _appearCounter; + + private float _attackDealyCounter; + + private float _initializedDrag; + + private AttackState _prepareState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _movintTargetPos = Vector3.zero; + + private Vector3 _attackingTargetPos = Vector3.zero; + + private Vector3 _reverseDirection = Vector3.zero; + + private Tweener _movingTweener = new Tweener(); + + private Tweener _attackingTweener = new Tweener(); + + private FieEmitObjectRainbowDashDoublePaybackAttackingEffect _attackingEffect; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + switch (_prepareState) + { + case AttackState.DISAPPEAR: + if (fieRainbowDash.detector.lockonTargetObject == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + _attackingEffect = FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + fieRainbowDash.animationManager.SetAnimation(37, isLoop: true, isForceSet: true); + Vector3 a = -fieRainbowDash.detector.lockonTargetObject.flipDirectionVector + Vector3.up; + a.Normalize(); + UpdateRotation(fieRainbowDash); + _movintTargetPos = fieRainbowDash.detector.lockonTargetObject.transform.position + a * 2.5f; + _movingTweener.InitTweener(0.2f, fieRainbowDash.transform.position, _movintTargetPos); + fieRainbowDash.requestSetAwesomeEffect(1); + fieRainbowDash.submeshObject.enabled = false; + _prepareState = AttackState.PREPARE_FOR_APPEAR; + } + break; + case AttackState.PREPARE_FOR_APPEAR: + if (!_movingTweener.IsEnd()) + { + fieRainbowDash.position = _movingTweener.UpdateParameterVec3(Time.deltaTime); + } + else + { + fieRainbowDash.submeshObject.enabled = true; + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + fieRainbowDash.isEnableHeadTracking = false; + _prepareState = AttackState.APPEAR; + } + break; + case AttackState.APPEAR: + if (fieRainbowDash.detector.lockonTargetObject == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + _attackDealyCounter += Time.deltaTime; + _attackingTargetPos = fieRainbowDash.detector.lockonTargetObject.centerTransform.position; + UpdateRotation(fieRainbowDash); + if (_attackDealyCounter > 0.5f) + { + FieManagerBehaviour.I.EmitObject(fieRainbowDash.rootBone.transform, _attackingTargetPos - fieRainbowDash.transform.position, null, fieRainbowDash); + _attackingTweener.InitTweener(0.1f, fieRainbowDash.transform.position, _attackingTargetPos); + _reverseDirection = _attackingTargetPos - fieRainbowDash.transform.position; + _reverseDirection = _reverseDirection.normalized * -1f; + fieRainbowDash.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + _prepareState = AttackState.ATTACKING; + } + } + break; + case AttackState.ATTACKING: + UpdateRotation(fieRainbowDash); + if (!_attackingTweener.IsEnd()) + { + fieRainbowDash.transform.position = _attackingTweener.UpdateParameterVec3(Time.deltaTime); + } + else + { + TrackEntry trackEntry = fieRainbowDash.animationManager.SetAnimation(38, isLoop: false, isForceSet: true); + _prepareState = AttackState.ATTACK_FINISHED; + fieRainbowDash.rootBone.transform.localRotation = Quaternion.identity; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + _nextState = typeof(FieStateMachineRainbowDashFlying); + if (_attackingEffect != null) + { + _attackingEffect.stopEffect(1f); + } + }; + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV3_1); + if (skill != null) + { + fieRainbowDash.damageSystem.AddDefenceMagni(skill.ID, 1f, skill.Value1); + } + GDESkillTreeData skill2 = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV3_2); + if (skill2 != null) + { + fieRainbowDash.damageSystem.AddAttackMagni(skill2.ID, skill2.Value2, skill2.Value1); + } + GDESkillTreeData skill3 = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_MAXIMUM_AWESOMENESS); + if (skill3 != null) + { + fieRainbowDash.requestSetAwesomeEffect(fieRainbowDash.maximumAwesomeCount); + } + GDESkillTreeData skill4 = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_AWESOME_COMBO); + if (skill4 != null) + { + fieRainbowDash.abilitiesContainer.IncreaseOrReduceCooldownAll(-999f); + } + fieRainbowDash.setMoveForce(_reverseDirection * 15f, 0.5f, useRound: false); + } + break; + } + } + } + + private void UpdateRotation(FieRainbowDash rainbowDash) + { + if (!(rainbowDash.rootBone == null)) + { + rainbowDash.setFlipByVector(_attackingTargetPos - rainbowDash.transform.position); + Vector3 vector = rainbowDash.transform.position - _attackingTargetPos; + vector.z = 0f; + vector.Normalize(); + if (vector != Vector3.zero) + { + rainbowDash.rootBone.transform.localRotation = Quaternion.LookRotation(vector) * Quaternion.AngleAxis((rainbowDash.flipState != 0) ? 270f : (-90f), Vector3.up); + } + } + } + + private void setCounterEvent(FieRainbowDash rainbowDash) + { + rainbowDash.damageSystem.damageCheckEvent += HealthSystem_damageCheckEvent; + rainbowDash.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_2)); + } + + private bool HealthSystem_damageCheckEvent(FieGameCharacter attacker, FieDamage damage) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + return false; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableCollider = false; + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.resetMoveForce(); + fieRainbowDash.submeshObject.enabled = true; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + if (_attackingEffect != null && !_attackingEffect.isDestroyed) + { + _attackingEffect.stopEffect(1f); + } + } + } + + public override List getAllowedStateList() + { + if (_isFinished) + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + return list; + } + if (_isEnd) + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashFlying)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + return list; + } + return new List(); + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareMidAir.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareMidAir.cs new file mode 100644 index 0000000..5b45502 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareMidAir.cs @@ -0,0 +1,180 @@ +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashDoublePaybackPrepareMidAir : FieStateMachineGameCharacterBase + { + private enum PrepareState + { + AWAKE, + PREPARE + } + + private const float EVASION_DURATION = 0.2f; + + private Type _nextState = typeof(FieStateMachineRainbowDashFlying); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private PrepareState _prepareState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private float _cooldown = 4f; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_prepareState) + { + case PrepareState.AWAKE: + if (rainbowDash.groundState != FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + int animationId = 33; + GDESkillTreeData skill = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_MAXIMUM_AWESOMENESS); + if (skill != null) + { + animationId = 35; + } + GDESkillTreeData skill2 = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_AWESOME_COMBO); + if (skill2 != null) + { + animationId = 34; + } + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "immunity") + { + setCounterEvent(rainbowDash); + } + }; + trackEntry.Complete += delegate + { + rainbowDash.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + TrackEntry trackEntry2 = rainbowDash.animationManager.SetAnimation(36, isLoop: false, isForceSet: true); + trackEntry2.Event += delegate(Spine.AnimationState endAnimationState, int endAnimationTrackIndex, Spine.Event endEvent) + { + if (endEvent.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry2.Complete += delegate + { + _isEnd = true; + }; + }; + } + else + { + _isEnd = true; + } + _prepareState = PrepareState.PREPARE; + } + break; + } + } + } + + private void setCounterEvent(FieRainbowDash rainbowDash) + { + rainbowDash.damageSystem.damageCheckEvent += HealthSystem_damageCheckEvent; + rainbowDash.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_2)); + } + + private bool HealthSystem_damageCheckEvent(FieGameCharacter attacker, FieDamage damage) + { + _nextState = typeof(FieStateMachineRainbowDashDoublePaybackAttacking); + _cooldown = 12f; + _isEnd = true; + return false; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + if (fieRainbowDash.detector.lockonTargetObject != null) + { + fieRainbowDash.setFlipByVector(fieRainbowDash.detector.lockonTargetObject.transform.position - fieRainbowDash.transform.position); + } + GDESkillTreeData skill = fieRainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV2_2); + if (skill != null) + { + _cooldown *= 1f + skill.Value1; + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.abilitiesContainer.SetCooldown(_cooldown); + fieRainbowDash.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list; + if (!_isEnd) + { + list = new List(); + list.Add(typeof(FieStateMachineRainbowDashFlying)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + return list; + } + list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareOnGround.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareOnGround.cs new file mode 100644 index 0000000..b806862 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashDoublePaybackPrepareOnGround.cs @@ -0,0 +1,175 @@ +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashDoublePaybackPrepareOnGround : FieStateMachineGameCharacterBase + { + private enum PrepareState + { + AWAKE, + PREPARE + } + + private const float EVASION_DURATION = 0.2f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private PrepareState _prepareState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private float _cooldown = 4f; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_prepareState) + { + case PrepareState.AWAKE: + if (rainbowDash.groundState != 0) + { + _isEnd = true; + } + else + { + int animationId = 29; + GDESkillTreeData skill = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_MAXIMUM_AWESOMENESS); + if (skill != null) + { + animationId = 31; + } + GDESkillTreeData skill2 = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_DOUBLE_PAYBACK_LV4_AWESOME_COMBO); + if (skill2 != null) + { + animationId = 30; + } + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "immunity") + { + setCounterEvent(rainbowDash); + } + }; + trackEntry.Complete += delegate + { + rainbowDash.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + TrackEntry trackEntry2 = rainbowDash.animationManager.SetAnimation(32, isLoop: false, isForceSet: true); + trackEntry2.Event += delegate(Spine.AnimationState endAnimationState, int endAnimationTrackIndex, Spine.Event endEvent) + { + if (endEvent.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry2.Complete += delegate + { + _isEnd = true; + }; + }; + } + else + { + _isEnd = true; + } + _prepareState = PrepareState.PREPARE; + } + break; + } + } + } + + private void setCounterEvent(FieRainbowDash rainbowDash) + { + rainbowDash.damageSystem.damageCheckEvent += HealthSystem_damageCheckEvent; + rainbowDash.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_LOYALTY_ABILITY_DOUBLE_PAYBACK_2)); + } + + private bool HealthSystem_damageCheckEvent(FieGameCharacter attacker, FieDamage damage) + { + _nextState = typeof(FieStateMachineRainbowDashDoublePaybackAttacking); + _cooldown = 12f; + _isEnd = true; + return false; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.resetMoveForce(); + if (fieRainbowDash.detector.lockonTargetObject != null) + { + fieRainbowDash.setFlipByVector(fieRainbowDash.detector.lockonTargetObject.transform.position - fieRainbowDash.transform.position); + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.abilitiesContainer.SetCooldown(_cooldown); + fieRainbowDash.damageSystem.damageCheckEvent -= HealthSystem_damageCheckEvent; + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list; + if (!_isEnd) + { + list = new List(); + list.Add(typeof(FieStateMachinePoniesMove)); + list.Add(typeof(FieStateMachinePoniesGallop)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + return list; + } + list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasion.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasion.cs new file mode 100644 index 0000000..9dd37fe --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasion.cs @@ -0,0 +1,68 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashEvasion : FieStateMachineGameCharacterBase + { + private const float EVASION_SHIELD_REGEN_DELAY = 1.5f; + + private const float EVASION_DEFAULT_SHILED_COST = 0.03f; + + private Type _nextState; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + float num = Vector3.Dot(fieRainbowDash.externalInputVector.normalized, Vector3.up); + float num2 = Vector3.Dot(fieRainbowDash.externalInputVector.normalized, fieRainbowDash.flipDirectionVector); + if (fieRainbowDash.externalInputForce > 0.25f) + { + if (num > 0.7f) + { + _nextState = typeof(FieStateMachineRainbowDashEvasionUp); + } + else if (num <= -0.7f && fieRainbowDash.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashEvasionDown); + } + else if (num2 > 0.7f) + { + _nextState = typeof(FieStateMachineRainbowDashEvasionFront); + } + } + if (_nextState == null) + { + _nextState = typeof(FieStateMachineRainbowDashEvasionBack); + } + fieRainbowDash.damageSystem.calcShieldDirect((0f - fieRainbowDash.healthStats.maxShield) * 0.03f); + fieRainbowDash.damageSystem.setRegenerateDelay(Mathf.Max(1.5f, fieRainbowDash.healthStats.regenerateDelay)); + fieRainbowDash.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_EVADED), 25); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_EVADE), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_EVADE)); + _isEnd = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionBack.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionBack.cs new file mode 100644 index 0000000..a774870 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionBack.cs @@ -0,0 +1,189 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashEvasionBack : FieStateMachineGameCharacterBase + { + private enum EvasionState + { + PREPARE, + EVASION + } + + private const float EVASION_DURATION = 0.2f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private EvasionState _evasionState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private Tweener _evasionTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_evasionState) + { + case EvasionState.PREPARE: + { + _initInputVec = rainbowDash.externalInputVector; + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(23, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + setEvasion(rainbowDash, e); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.Name == "takeOff") + { + _isTakeOff = true; + } + if (e.Data.Name == "immunity") + { + rainbowDash.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + setEnd(rainbowDash as T); + }; + } + else + { + setEnd(rainbowDash as T); + } + _evasionState = EvasionState.EVASION; + break; + } + case EvasionState.EVASION: + if (!_evasionTweener.IsEnd()) + { + rainbowDash.position = _evasionTweener.UpdateParameterVec3(Time.deltaTime); + if (rainbowDash.groundState == FieObjectGroundState.Grounding && _isTakeOff) + { + setEnd(rainbowDash as T); + } + } + break; + } + } + } + + private void setEvasion(FieRainbowDash rainbowDash, Spine.Event e) + { + Vector3 vector = _initInputVec; + if (rainbowDash.externalInputForce <= 0.25f || vector == Vector3.zero) + { + vector = -rainbowDash.flipDirectionVector; + } + if (rainbowDash.groundState == FieObjectGroundState.Grounding) + { + if (Mathf.Abs(vector.x) < 0.5f) + { + Vector3 flipDirectionVector = rainbowDash.flipDirectionVector; + vector.x = 0f - flipDirectionVector.x; + } + vector.y = Mathf.Clamp(vector.y, 0.25f, 0.5f); + } + vector.Normalize(); + _evasionTargetPos = rainbowDash.position + vector * e.Float; + int layerMask = 262656; + if (Physics.Raycast(rainbowDash.position, vector, out RaycastHit hitInfo, e.Float, layerMask)) + { + _evasionTargetPos = hitInfo.point; + } + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, _evasionTargetPos - rainbowDash.position, null, rainbowDash); + _evasionTweener.InitTweener(0.2f, rainbowDash.position, _evasionTargetPos); + rainbowDash.resetMoveForce(); + } + + private void setEnd(T gameCharacter) where T : FieGameCharacter + { + if ((UnityEngine.Object)gameCharacter != (UnityEngine.Object)null) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + } + else + { + _nextState = typeof(FieStateMachinePoniesLanding); + } + } + _isEnd = true; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionDown.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionDown.cs new file mode 100644 index 0000000..2cbb22c --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionDown.cs @@ -0,0 +1,174 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashEvasionDown : FieStateMachineGameCharacterBase + { + private enum EvasionState + { + PREPARE, + EVASION + } + + private const float EVASION_DURATION = 0.15f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isEnd; + + private bool _isFinished; + + private EvasionState _evasionState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private Tweener _evasionTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_evasionState) + { + case EvasionState.PREPARE: + { + _initInputVec = rainbowDash.externalInputVector; + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(25, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + setEvasion(rainbowDash, e); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.Name == "immunity") + { + rainbowDash.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + setEnd(rainbowDash as T); + }; + } + else + { + setEnd(rainbowDash as T); + } + _evasionState = EvasionState.EVASION; + break; + } + case EvasionState.EVASION: + if (rainbowDash.groundState == FieObjectGroundState.Grounding) + { + setEnd(rainbowDash as T); + } + else if (!_evasionTweener.IsEnd()) + { + rainbowDash.position = _evasionTweener.UpdateParameterVec3(Time.deltaTime); + } + break; + } + } + } + + private void setEvasion(FieRainbowDash rainbowDash, Spine.Event e) + { + Vector3 vector = _initInputVec; + if (rainbowDash.externalInputForce <= 0.25f) + { + vector = Vector3.down; + } + vector.Normalize(); + _evasionTargetPos = rainbowDash.position + vector * e.Float; + int layerMask = 262656; + if (Physics.Raycast(rainbowDash.position, vector, out RaycastHit hitInfo, e.Float, layerMask)) + { + _evasionTargetPos = hitInfo.point; + } + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, _evasionTargetPos - rainbowDash.position, null, rainbowDash); + _evasionTweener.InitTweener(0.15f, rainbowDash.position, _evasionTargetPos); + rainbowDash.resetMoveForce(); + } + + private void setEnd(T gameCharacter) where T : FieGameCharacter + { + if ((UnityEngine.Object)gameCharacter != (UnityEngine.Object)null) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + } + else + { + _nextState = typeof(FieStateMachinePoniesLanding); + } + } + _isEnd = true; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionFront.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionFront.cs new file mode 100644 index 0000000..c0c5f58 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionFront.cs @@ -0,0 +1,189 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashEvasionFront : FieStateMachineGameCharacterBase + { + private enum EvasionState + { + PREPARE, + EVASION + } + + private const float EVASION_DURATION = 0.2f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private EvasionState _evasionState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private Tweener _evasionTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_evasionState) + { + case EvasionState.PREPARE: + { + _initInputVec = rainbowDash.externalInputVector; + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(22, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + setEvasion(rainbowDash, e); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.Name == "takeOff") + { + _isTakeOff = true; + } + if (e.Data.Name == "immunity") + { + rainbowDash.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + setEnd(rainbowDash as T); + }; + } + else + { + setEnd(rainbowDash as T); + } + _evasionState = EvasionState.EVASION; + break; + } + case EvasionState.EVASION: + if (!_evasionTweener.IsEnd()) + { + rainbowDash.position = _evasionTweener.UpdateParameterVec3(Time.deltaTime); + if (rainbowDash.groundState == FieObjectGroundState.Grounding && _isTakeOff) + { + setEnd(rainbowDash as T); + } + } + break; + } + } + } + + private void setEvasion(FieRainbowDash rainbowDash, Spine.Event e) + { + Vector3 vector = _initInputVec; + if (rainbowDash.externalInputForce <= 0.25f) + { + vector = rainbowDash.flipDirectionVector; + } + if (rainbowDash.groundState == FieObjectGroundState.Grounding) + { + if (Mathf.Abs(vector.x) < 0.5f) + { + Vector3 flipDirectionVector = rainbowDash.flipDirectionVector; + vector.x = flipDirectionVector.x; + } + vector.y = Mathf.Clamp(vector.y, 0.25f, 0.5f); + } + vector.Normalize(); + _evasionTargetPos = rainbowDash.position + vector * e.Float; + int layerMask = 262656; + if (Physics.Raycast(rainbowDash.position, vector, out RaycastHit hitInfo, e.Float, layerMask)) + { + _evasionTargetPos = hitInfo.point; + } + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, _evasionTargetPos - rainbowDash.position, null, rainbowDash); + _evasionTweener.InitTweener(0.2f, rainbowDash.position, _evasionTargetPos); + rainbowDash.resetMoveForce(); + } + + private void setEnd(T gameCharacter) where T : FieGameCharacter + { + if ((UnityEngine.Object)gameCharacter != (UnityEngine.Object)null) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + } + else + { + _nextState = typeof(FieStateMachinePoniesLanding); + } + } + _isEnd = true; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionUp.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionUp.cs new file mode 100644 index 0000000..03f7712 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashEvasionUp.cs @@ -0,0 +1,170 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashEvasionUp : FieStateMachineGameCharacterBase + { + private enum EvasionState + { + PREPARE, + EVASION + } + + private const float EVASION_DURATION = 0.15f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isEnd; + + private bool _isFinished; + + private EvasionState _evasionState; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private Tweener _evasionTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_evasionState) + { + case EvasionState.PREPARE: + { + _initInputVec = rainbowDash.externalInputVector; + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(24, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + setEvasion(rainbowDash, e); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.Name == "immunity") + { + rainbowDash.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + setEnd(rainbowDash as T); + }; + } + else + { + setEnd(rainbowDash as T); + } + _evasionState = EvasionState.EVASION; + break; + } + case EvasionState.EVASION: + if (!_evasionTweener.IsEnd()) + { + rainbowDash.position = _evasionTweener.UpdateParameterVec3(Time.deltaTime); + } + break; + } + } + } + + private void setEvasion(FieRainbowDash rainbowDash, Spine.Event e) + { + Vector3 vector = _initInputVec; + if (rainbowDash.externalInputForce <= 0.25f) + { + vector = Vector3.up; + } + vector.Normalize(); + _evasionTargetPos = rainbowDash.position + vector * e.Float; + int layerMask = 262656; + if (Physics.Raycast(rainbowDash.position, vector, out RaycastHit hitInfo, e.Float, layerMask)) + { + _evasionTargetPos = hitInfo.point; + } + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, _evasionTargetPos - rainbowDash.position, null, rainbowDash); + _evasionTweener.InitTweener(0.15f, rainbowDash.position, _evasionTargetPos); + rainbowDash.resetMoveForce(); + } + + private void setEnd(T gameCharacter) where T : FieGameCharacter + { + if ((UnityEngine.Object)gameCharacter != (UnityEngine.Object)null) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + } + else + { + _nextState = typeof(FieStateMachinePoniesLanding); + } + } + _isEnd = true; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashFlying.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashFlying.cs new file mode 100644 index 0000000..d71a038 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashFlying.cs @@ -0,0 +1,136 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashFlying : FieStateMachineGameCharacterBase + { + public const float FLYING_DRAG = 5f; + + private const float FLYING_INPUT_THLESHOLD = 0.3f; + + private const float FLYING_VELOCITY_PER_SEC = 25f; + + private const float FLYING_SHIELD_COST_PER_SEC = 0.02f; + + private const float FLYING_SHIELD_REGEN_DELAY = 1.5f; + + private float _speedAngle; + + private float _initializedDrag; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + Vector3 externalInputVector = fieRainbowDash.externalInputVector; + float externalInputForce = fieRainbowDash.externalInputForce; + externalInputVector.z = 0f; + if (fieRainbowDash.animationManager.IsEndAnimation(0)) + { + fieRainbowDash.animationManager.SetAnimation(20, isLoop: true); + } + if (fieRainbowDash.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachinePoniesLanding); + _isEnd = true; + } + else + { + if (fieRainbowDash.healthStats.shield <= 0f) + { + externalInputVector.y = 0f; + fieRainbowDash.isEnableGravity = true; + } + else + { + fieRainbowDash.damageSystem.setRegenerateDelay(Mathf.Max(1.5f, fieRainbowDash.healthStats.regenerateDelay)); + fieRainbowDash.isEnableGravity = false; + } + if (externalInputForce > 0.3f) + { + Vector3 moveForce = externalInputVector * 25f * externalInputForce; + fieRainbowDash.addMoveForce(moveForce, 1f); + fieRainbowDash.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 2500f); + } + if (externalInputForce > 0.5f && Mathf.Abs(externalInputVector.y) < 0.5f) + { + _speedAngle += 90f * Time.deltaTime * externalInputForce; + } + else + { + _speedAngle -= 90f * Time.deltaTime; + } + _speedAngle = Mathf.Clamp(_speedAngle, 0f, 20f); + fieRainbowDash.rootBone.transform.localRotation = Quaternion.AngleAxis(_speedAngle, Vector3.forward); + fieRainbowDash.damageSystem.calcShieldDirect((0f - fieRainbowDash.healthStats.maxShield) * 0.02f * Time.deltaTime); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableAutoFlip = true; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + fieRainbowDash.rootBone.transform.localRotation = Quaternion.AngleAxis(0f, Vector3.forward); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashJump.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashJump.cs new file mode 100644 index 0000000..8b1e48e --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashJump.cs @@ -0,0 +1,136 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashJump : FieStateMachineGameCharacterBase + { + private enum JumpState + { + JUMP_TAKEOFF_START, + JUMP_TAKEOFF_STANDBY, + JUMP_TAKEOFF_READY, + JUMP_TAKEOFF + } + + private const float TAKEOFF_FORCE = 9f; + + private const float TAKEOFF_PAST_TIME = 0.1f; + + private const float FLYING_MOVE_FORCE_ROUND = 0.5f; + + private const float MAX_FLYING_SPEED = 1f; + + private const float FLYING_UPPER_FORCE_DURATION = 3f; + + private const float LANDING_DELAY = 0.05f; + + private const float JUMP_DELAY = 0.1f; + + private JumpState _jumpState; + + private float _takeoffTime; + + private float _flyingTime; + + private float _landingCount; + + private bool _isSetLandingAnimation; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + Vector3 a = rainbowDash.externalInputVector; + a.y = (a.z = 0f); + if (_jumpState == JumpState.JUMP_TAKEOFF_START) + { + if (rainbowDash.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + _isEnd = true; + } + else + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(19); + _jumpState = JumpState.JUMP_TAKEOFF_STANDBY; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.name == "takeOff") + { + Vector3 vector = rainbowDash.externalInputVector; + vector += Vector3.up; + vector.x *= 0.1f; + vector.Normalize(); + vector *= 9f; + rainbowDash.setMoveForce(vector, 0.1f); + _jumpState = JumpState.JUMP_TAKEOFF; + } + else if (e.Data.name == "finished") + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + _isEnd = true; + }; + } + a *= 0.5f; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + return list; + } + + public override float getDelay() + { + return 0.1f; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmash.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmash.cs new file mode 100644 index 0000000..d95cc39 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmash.cs @@ -0,0 +1,57 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies.RainbowDash +{ + [FieAbilityID(FieConstValues.FieAbility.OMNISMASH)] + public class FieStateMachineRainbowDashOmniSmash : FieStateMachineAbilityBase + { + private const string OMNI_SMASH_ABILITY_SIGNATURE = "omnismash"; + + public const float OMNI_SMASH_DEFAULT_COOLDOWN = 0f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + fieRainbowDash.getStateMachine().setState(typeof(FieStateMachineRainbowDashOmniSmashStart), isForceSet: false); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 0f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override string getSignature() + { + return "omnismash"; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.SPECEFIC_METHOD; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashFinish.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashFinish.cs new file mode 100644 index 0000000..632eb6e --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashFinish.cs @@ -0,0 +1,254 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashOmniSmashFinish : FieStateMachineGameCharacterBase + { + private enum AttackState + { + ACTIVATE, + PREPARE, + ATTACKING, + COOLDOWN, + FINISHED + } + + private const float PREPARE_DURATION = 0.3f; + + private const float PREPARE_FLYING_DISTANCE = 1.5f; + + private const float ATTAKING_DRATION = 0.2f; + + private const float MAXIMUM_DROP_DISTANCE = 20f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isEnd; + + private bool _isFinished; + + private AttackState _attackState; + + private float _attackDealyCounter; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _movintTargetPos = Vector3.zero; + + private Tweener _movingTweener = new Tweener(); + + private Tweener _finishingTweener = new Tweener(); + + private FieEmitObjectRainbowDashDoublePaybackAttackingEffect _attackingEffect; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_attackState) + { + case AttackState.ACTIVATE: + { + rainbowDash.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_FRIENDSHIP_ABILITY)); + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, Vector3.up); + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(40, isLoop: false, isForceSet: true); + if (trackEntry == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + SetAttackState(rainbowDash); + _attackState = AttackState.ATTACKING; + } + }; + if (FieManagerBehaviour.I.gameCamera != null) + { + FieManagerBehaviour.I.gameCamera.setOffsetTransition(rainbowDash, new FieCameraOffset(new FieCameraOffset.FieCameraOffsetParam(new Vector3(0f, 0f, 3f), new Vector3(0f, 0f, 0f), 40f), 1f, 0.5f, 1f)); + } + GDESkillTreeData skill = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_OMNISMASH_LV4_LET_ME_SHOW_YOU_MY_TRUE_POWER); + if (skill != null) + { + rainbowDash.damageSystem.calcShieldDirect(0f - rainbowDash.healthStats.maxShield); + rainbowDash.damageSystem.calcHitPoitDirect((0f - rainbowDash.healthStats.maxHitPoint) * 0.99f); + rainbowDash.damageSystem.setRegenerateDelay(rainbowDash.healthStats.regenerateDelay * (float)rainbowDash.omniSmashAttackingCount); + rainbowDash.abilitiesContainer.IncreaseOrReduceCooldownAll(skill.Value2 * (float)rainbowDash.omniSmashAttackingCount); + } + rainbowDash.submeshObject.enabled = true; + _movingTweener.InitTweener(0.3f, rainbowDash.transform.position, rainbowDash.transform.position + Vector3.up * 1.5f); + _attackState = AttackState.PREPARE; + } + break; + } + case AttackState.PREPARE: + if (!_movingTweener.IsEnd()) + { + rainbowDash.position = _movingTweener.UpdateParameterVec3(Time.deltaTime); + } + break; + case AttackState.ATTACKING: + if (!_finishingTweener.IsEnd()) + { + rainbowDash.position = _finishingTweener.UpdateParameterVec3(Time.deltaTime); + } + break; + } + } + } + + private void SetAttackState(FieRainbowDash rainbowDash) + { + if (!(rainbowDash == null)) + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(41, isLoop: false, isForceSet: true); + if (trackEntry == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + FieManagerBehaviour.I.EmitObject(rainbowDash.transform, Vector3.forward); + } + if (e.Data.Name == "finished") + { + if (rainbowDash.omniSmashAttackingCount > 2) + { + float scale = (float)rainbowDash.omniSmashAttackingCount * 0.15f; + FieEmitObjectRainbowDashOmniSmashExplosion fieEmitObjectRainbowDashOmniSmashExplosion = FieManagerBehaviour.I.EmitObject(rainbowDash.transform, Vector3.forward, null, rainbowDash); + if (fieEmitObjectRainbowDashOmniSmashExplosion != null) + { + fieEmitObjectRainbowDashOmniSmashExplosion.SetScale(scale); + } + FieEmitObjectRainbowDashOmniSmashExplosionEffect fieEmitObjectRainbowDashOmniSmashExplosionEffect = FieManagerBehaviour.I.EmitObject(rainbowDash.transform, Vector3.forward, null, rainbowDash); + if (fieEmitObjectRainbowDashOmniSmashExplosionEffect != null) + { + fieEmitObjectRainbowDashOmniSmashExplosionEffect.SetScale(scale); + } + } + GDESkillTreeData skill2 = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_OMNISMASH_LV4_NOT_A_BIG_DEAL); + if (skill2 != null) + { + _isFinished = true; + } + rainbowDash.isEnableGravity = true; + } + }; + trackEntry.Complete += delegate + { + rainbowDash.isEnableCollider = true; + TrackEntry trackEntry2 = rainbowDash.animationManager.SetAnimation(42, isLoop: false, isForceSet: true); + GDESkillTreeData skill = rainbowDash.GetSkill(FieConstValues.FieSkill.LOYALTY_OMNISMASH_LV3_1); + if (skill != null) + { + rainbowDash.damageSystem.AddAttackMagni(skill.ID, skill.Value2, skill.Value1); + } + trackEntry2.Complete += delegate + { + _isEnd = true; + }; + }; + Vector3 position = rainbowDash.transform.position; + Vector3 down = Vector3.down; + if (rainbowDash.externalInputForce > 0.2f) + { + Vector3 externalInputVector = rainbowDash.externalInputVector; + down.x = externalInputVector.x * 0.5f; + } + down.Normalize(); + position = rainbowDash.centerTransform.position - down * 20f; + int layerMask = 512; + if (Physics.Raycast(rainbowDash.centerTransform.position, down, out RaycastHit hitInfo, 20f, layerMask) && hitInfo.collider.tag == "Floor") + { + position = hitInfo.point; + } + if (down != Vector3.down) + { + rainbowDash.setFlipByVector(new Vector3(down.x, 0f, 0f).normalized); + } + _finishingTweener.InitTweener(0.2f, rainbowDash.transform.position, position); + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, down); + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, down); + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, down, null, rainbowDash); + rainbowDash.emotionController.RestartAutoAnimation(); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.emotionController.StopAutoAnimation(); + fieRainbowDash.isEnableCollider = false; + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.rootBone.transform.localRotation = Quaternion.identity; + fieRainbowDash.resetMoveForce(); + fieRainbowDash.submeshObject.enabled = true; + } + } + + public override List getAllowedStateList() + { + List list; + if (!_isFinished) + { + list = new List(); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashLoop)); + return list; + } + list = new List(); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + list.Add(typeof(FieStateMachineRainbowDashBaseAttack3)); + list.Add(typeof(FieStateMachineRainbowDashStabAttack)); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashRainblow)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashLoop.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashLoop.cs new file mode 100644 index 0000000..2503b73 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashLoop.cs @@ -0,0 +1,152 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashOmniSmashLoop : FieStateMachineGameCharacterBase + { + private enum AttackState + { + ACTIVATE, + ATTACKING, + DISAPPEAR + } + + private const float ATTACKING_DURATION = 0.25f; + + private const float OMNI_SMASH_MOVING_DISTANCE = 1f; + + private const float OMNI_SMASH_NEXT_STATE_DELAY = 0.3f; + + private const float OMNI_SMASH_ENTITY_RANGE = 3f; + + private Type _nextState = typeof(FieStateMachineRainbowDashFlying); + + private int _attackCount; + + private bool _isEnd; + + private bool _isFinished; + + private AttackState _prepareState; + + private float _attackDealyCounter; + + private float _attackInterval; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _movintTargetPos = Vector3.zero; + + private Vector3 _attackingTargetPos = Vector3.zero; + + private Vector3 _reverseDirection = Vector3.zero; + + private Tweener _movingTweener = new Tweener(); + + private FieEmitObjectRainbowDashDoublePaybackAttackingEffect _attackingEffect; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + switch (_prepareState) + { + case AttackState.ACTIVATE: + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + fieRainbowDash.animationManager.SetAnimation(44, isLoop: true, isForceSet: true); + _attackCount = Mathf.Max(0, fieRainbowDash.omniSmashAttackingCount - 2); + fieRainbowDash.submeshObject.enabled = false; + _prepareState = AttackState.ATTACKING; + break; + case AttackState.ATTACKING: + if (fieRainbowDash.detector.lockonTargetObject != null) + { + fieRainbowDash.position = fieRainbowDash.detector.lockonTargetObject.centerTransform.position; + } + _attackInterval -= Time.deltaTime; + if (_attackInterval <= 0f) + { + if (_attackCount <= 0) + { + _nextState = typeof(FieStateMachineRainbowDashOmniSmashFinish); + fieRainbowDash.submeshObject.enabled = true; + _isEnd = true; + } + else + { + EmitOmniSmashAttackEntity(fieRainbowDash); + _attackCount--; + _attackInterval = 0.25f; + } + } + break; + } + } + } + + private void EmitOmniSmashAttackEntity(FieRainbowDash rainbowDash) + { + Vector3 vector = new Vector3((float)FieRandom.Range(-100, 100), (float)UnityEngine.Random.Range(-30, 30), (float)UnityEngine.Random.Range(-100, 100)).normalized; + if (vector == Vector3.zero) + { + vector = Vector3.back; + } + Vector3 vector2 = rainbowDash.centerTransform.position + vector * 3f; + Vector3 normalized = (rainbowDash.centerTransform.position - vector2).normalized; + FieEmitObjectRainbowDashOmniSmashSecondHit fieEmitObjectRainbowDashOmniSmashSecondHit = FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, normalized, null, rainbowDash); + if (fieEmitObjectRainbowDashOmniSmashSecondHit != null) + { + fieEmitObjectRainbowDashOmniSmashSecondHit.SetInitializePosition(vector2); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableCollider = false; + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.resetMoveForce(); + } + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashFinish)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashStart.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashStart.cs new file mode 100644 index 0000000..45f99a0 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashOmniSmashStart.cs @@ -0,0 +1,175 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using Spine.Unity; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashOmniSmashStart : FieStateMachineGameCharacterBase + { + private enum AttackState + { + ACTIVATE, + ATTACKING, + DISAPPEAR + } + + private const float ATTACKING_DURATION = 0.3f; + + private const float OMNI_SMASH_MOVING_DISTANCE = 3f; + + private const float OMNI_SMASH_NEXT_STATE_DELAY = 0.3f; + + private Type _nextState = typeof(FieStateMachineRainbowDashFlying); + + private bool _isEnd; + + private bool _isFinished; + + private AttackState _prepareState; + + private float _attackDealyCounter; + + private Vector3 _initInputVec = Vector3.zero; + + private Vector3 _movintTargetPos = Vector3.zero; + + private Vector3 _attackingTargetPos = Vector3.zero; + + private Vector3 _reverseDirection = Vector3.zero; + + private Tweener _movingTweener = new Tweener(); + + private FieEmitObjectRainbowDashDoublePaybackAttackingEffect _attackingEffect; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + switch (_prepareState) + { + case AttackState.ACTIVATE: + if (fieRainbowDash.detector.lockonTargetObject == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + else + { + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, Vector3.up); + FieManagerBehaviour.I.EmitObject(fieRainbowDash.centerTransform, fieRainbowDash.flipDirectionVector, null, fieRainbowDash); + fieRainbowDash.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + fieRainbowDash.animationManager.SetAnimation(39, isLoop: true, isForceSet: true); + Vector3 vector = fieRainbowDash.detector.lockonTargetObject.centerTransform.position - fieRainbowDash.centerTransform.position; + _movintTargetPos = fieRainbowDash.detector.lockonTargetObject.centerTransform.position + vector.normalized * 3f; + float maxDistance = Vector3.Distance(fieRainbowDash.centerTransform.position, _movintTargetPos); + int layerMask = 512; + if (Physics.Raycast(fieRainbowDash.centerTransform.position, vector.normalized, out RaycastHit hitInfo, maxDistance, layerMask) && hitInfo.collider.tag == "Floor") + { + _movintTargetPos = hitInfo.point + Vector3.up * 0.5f; + } + _attackingTargetPos = _movintTargetPos; + UpdateRotation(fieRainbowDash); + _movingTweener.InitTweener(0.3f, fieRainbowDash.transform.position, _movintTargetPos); + fieRainbowDash.CalcOmniSmashAttackCount(); + _prepareState = AttackState.ATTACKING; + } + break; + case AttackState.ATTACKING: + if (!_movingTweener.IsEnd()) + { + fieRainbowDash.position = _movingTweener.UpdateParameterVec3(Time.deltaTime); + } + else + { + fieRainbowDash.animationManager.SetAnimation(24, isLoop: false, isForceSet: true); + _prepareState = AttackState.DISAPPEAR; + } + break; + case AttackState.DISAPPEAR: + if (fieRainbowDash.detector.lockonTargetObject == null) + { + fieRainbowDash.position = _attackingTargetPos; + _nextState = typeof(FieStateMachineRainbowDashOmniSmashFinish); + _isEnd = true; + } + _attackDealyCounter += Time.deltaTime; + if (_attackDealyCounter > 0.3f) + { + _nextState = typeof(FieStateMachineRainbowDashOmniSmashLoop); + _isEnd = true; + } + break; + } + } + } + + private void UpdateRotation(FieRainbowDash rainbowDash) + { + if (!(rainbowDash.rootBone == null)) + { + rainbowDash.setFlipByVector(_attackingTargetPos - rainbowDash.transform.position); + Vector3 vector = rainbowDash.transform.position - _attackingTargetPos; + vector.z = 0f; + vector.Normalize(); + rainbowDash.rootBone.mode = SkeletonUtilityBone.Mode.Override; + rainbowDash.rootBone.overrideAlpha = 1f; + if (vector != Vector3.zero) + { + rainbowDash.rootBone.transform.localRotation = Quaternion.LookRotation(vector) * Quaternion.AngleAxis((rainbowDash.flipState != 0) ? 270f : (-90f), Vector3.up); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableCollider = false; + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.rootBone.transform.localRotation = Quaternion.identity; + fieRainbowDash.resetMoveForce(); + } + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashLoop)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblow.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblow.cs new file mode 100644 index 0000000..e829c95 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblow.cs @@ -0,0 +1,61 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; + +namespace Fie.Ponies.RainbowDash +{ + [FieAbilityID(FieConstValues.FieAbility.RAINBLOW)] + public class FieStateMachineRainbowDashRainblow : FieStateMachineAbilityBase + { + private const string RAINBLOW_ABILITY_SIGNATURE = "rainblow"; + + public const float RAINBLOW_COOLDOWN = 9f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRainbowDash) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + Type typeFromHandle = typeof(FieStateMachineRainbowDashRainblowCloack); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_ABILITY_2), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_ABILITY_2)); + fieRainbowDash.getStateMachine().setState(typeFromHandle, isForceSet: false); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 9f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override string getSignature() + { + return "rainblow"; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblowCloack.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblowCloack.cs new file mode 100644 index 0000000..2156474 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashRainblowCloack.cs @@ -0,0 +1,162 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashRainblowCloack : FieStateMachineGameCharacterBase + { + private enum EvasionState + { + PREPARE, + EVASION + } + + private const float EVASION_DURATION = 0.2f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isTakeOff; + + private bool _isEnd; + + private bool _isFinished; + + private EvasionState _evasionState; + + private Vector3 _evasionTargetPos = Vector3.zero; + + private Tweener _evasionTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + switch (_evasionState) + { + case EvasionState.PREPARE: + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(45, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "fire") + { + rainbowDash.Cloack(); + } + if (e.Data.Name == "finished") + { + _isFinished = true; + } + if (e.Data.Name == "takeOff") + { + _isTakeOff = true; + } + if (e.Data.Name == "immunity") + { + rainbowDash.isEnableCollider = (e.Int < 1); + } + }; + trackEntry.Complete += delegate + { + setEnd(rainbowDash as T); + }; + } + else + { + setEnd(rainbowDash as T); + } + if (rainbowDash.groundState == FieObjectGroundState.Grounding) + { + FieManagerBehaviour.I.EmitObject(rainbowDash.transform, rainbowDash.flipDirectionVector, null, rainbowDash); + } + else + { + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, rainbowDash.flipDirectionVector, null, rainbowDash); + } + rainbowDash.abilitiesContainer.SetCooldown(9f); + _evasionState = EvasionState.EVASION; + break; + } + case EvasionState.EVASION: + if (!_evasionTweener.IsEnd()) + { + rainbowDash.position = _evasionTweener.UpdateParameterVec3(Time.deltaTime); + if (rainbowDash.groundState == FieObjectGroundState.Grounding && _isTakeOff) + { + setEnd(rainbowDash as T); + } + } + break; + } + } + } + + private void setEnd(T gameCharacter) where T : FieGameCharacter + { + if ((UnityEngine.Object)gameCharacter != (UnityEngine.Object)null) + { + if (gameCharacter.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRainbowDashFlying); + } + else + { + _nextState = typeof(FieStateMachinePoniesLanding); + } + } + _isEnd = true; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.setGravityRate(1f); + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + } + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + return list; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashStabAttack.cs b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashStabAttack.cs new file mode 100644 index 0000000..db9ef23 --- /dev/null +++ b/src/Fie.Ponies.RainbowDash/FieStateMachineRainbowDashStabAttack.cs @@ -0,0 +1,194 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RainbowDash +{ + public class FieStateMachineRainbowDashStabAttack : FieStateMachineGameCharacterBase + { + private enum FireState + { + KICK_START, + KICKING + } + + private const float KICK_DELAY = 0.2f; + + private const float KICK_HORMING_DISTANCE = 1f; + + private const float KICK_HORMING_DEFAULT_RATE = 0.5f; + + private const float ATTACKING_EFFECT_DESTROY_DELAY = 1f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private bool _isFinished; + + private bool _isCancellable; + + private float _initializedDrag; + + private FieEmitObjectRainbowDashDoublePaybackAttackingEffect _attackingEffect; + + public override void initialize(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + autoFlipToEnemy(fieRainbowDash); + fieRainbowDash.Decloack(); + fieRainbowDash.isEnableHeadTracking = false; + fieRainbowDash.isEnableAutoFlip = false; + fieRainbowDash.isEnableGravity = false; + fieRainbowDash.resetMoveForce(); + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + _initializedDrag = component.drag; + if (fieRainbowDash.healthStats.shield >= 0f) + { + component.drag = 5f; + } + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieRainbowDash fieRainbowDash = gameCharacter as FieRainbowDash; + if (!(fieRainbowDash == null)) + { + fieRainbowDash.isEnableHeadTracking = true; + fieRainbowDash.isEnableGravity = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableCollider = true; + fieRainbowDash.isEnableAutoFlip = true; + fieRainbowDash.isEnableHeadTracking = true; + Rigidbody component = fieRainbowDash.GetComponent(); + if (component != null) + { + component.drag = _initializedDrag; + } + if (_attackingEffect != null && !_attackingEffect.isDestroyed) + { + _attackingEffect.stopEffect(1f); + } + } + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRainbowDash) + { + _timeCount += Time.deltaTime; + FieRainbowDash rainbowDash = gameCharacter as FieRainbowDash; + _nextState = ((rainbowDash.groundState != 0) ? typeof(FieStateMachineRainbowDashFlying) : typeof(FieStateMachineCommonIdle)); + switch (_fireState) + { + case FireState.KICK_START: + { + TrackEntry trackEntry = rainbowDash.animationManager.SetAnimation(28, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "move") + { + Vector3 vector = rainbowDash.flipDirectionVector; + if (rainbowDash.detector.lockonTargetObject != null) + { + vector = (rainbowDash.detector.lockonTargetObject.centerTransform.position - rainbowDash.centerTransform.position).normalized; + } + rainbowDash.resetMoveForce(); + rainbowDash.setMoveForce(vector * e.Float * 3f, 0f, useRound: false); + rainbowDash.setFlipByVector(vector); + FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, vector, null, rainbowDash); + _attackingEffect = FieManagerBehaviour.I.EmitObject(rainbowDash.centerTransform, Vector3.up); + if (FieManagerBehaviour.I.gameCamera != null) + { + FieManagerBehaviour.I.gameCamera.setOffsetTransition(rainbowDash, new FieCameraOffset(new FieCameraOffset.FieCameraOffsetParam(new Vector3(0f, 0f, 1.5f), new Vector3(0f, 0f, 0f), 10f), 0.1f, 0.3f, 1.5f)); + } + } + if (e.Data.Name == "finished") + { + if (_attackingEffect != null) + { + _attackingEffect.stopEffect(1f); + } + _isFinished = true; + } + if (e.Data.name == "cancellable") + { + _isCancellable = true; + } + }; + _endTime = trackEntry.endTime; + } + else + { + _endTime = 0f; + } + _fireState = FireState.KICKING; + break; + } + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRainbowDashBaseAttack1)); + } + if (_isCancellable) + { + list.Add(typeof(FieStateMachineRainbowDashEvasion)); + list.Add(typeof(FieStateMachineRainbowDashOmniSmashStart)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareMidAir)); + list.Add(typeof(FieStateMachineRainbowDashDoublePaybackPrepareOnGround)); + list.Add(typeof(FieStateMachineRainbowDashRainblowCloack)); + } + return list; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isFinished() + { + return _isFinished; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunBaseShot.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunBaseShot.cs new file mode 100644 index 0000000..5e91533 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunBaseShot.cs @@ -0,0 +1,150 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunBaseShot")] + public class FieEmitObjectRisingSunBaseShot : FieEmittableObjectBase + { + [SerializeField] + private float BaseShotDuration = 1.5f; + + [SerializeField] + private float BaseShotVelocityMax = 2.5f; + + [SerializeField] + private float BaseShotVelocityAccelTime = 0.1f; + + [SerializeField] + private float BaseShotDestroyDuration = 0.7f; + + [SerializeField] + private Light light; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private SmoothTrail trail; + + private const float HORMING_DISTANCE_MAX = 1f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _additionalVelocity = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _defualtLightIntensity; + + private bool _isEndUpdate; + + private bool _isInitializedHormingVector; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + effectModel.transform.localScale = _initEffectModelScale; + if (light != null) + { + _defualtLightIntensity = light.intensity; + } + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(BaseShotVelocityAccelTime, 0f, BaseShotVelocityMax); + _scaleTweener.InitTweener(BaseShotVelocityAccelTime, Vector3.zero, Vector3.one); + trail.ClearSystem(emitState: true); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized + directionalVec * 4f; + _initDirectionalVec.Normalize(); + } + if (light != null) + { + light.intensity = _defualtLightIntensity; + } + if (effectModel != null) + { + effectModel.transform.localScale = _initEffectModelScale; + } + } + + public void setAdditionalVelocity(Vector3 additionalVelocity) + { + _additionalVelocity = additionalVelocity; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 directionalVec = base.directionalVec; + if (targetTransform != null) + { + float num = Vector3.Distance(targetTransform.position, base.transform.position); + float num2 = num / 1f; + Vector3 vector = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + float num3 = Mathf.Max(Vector3.Dot(directionalVec, vector), 0f); + num2 *= num3 * 0.4f; + vector.z *= 1.25f; + directionalVec += vector * num2; + directionalVec.Normalize(); + if (!_isInitializedHormingVector) + { + base.directionalVec = directionalVec; + _isInitializedHormingVector = true; + } + } + Vector3 vector2 = base.directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector2 * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= BaseShotDuration) + { + destoryEmitObject(BaseShotDestroyDuration); + trail.Emit = false; + trail.ClearSystem(emitState: false); + } + base.transform.rotation = Quaternion.LookRotation(vector2); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + destoryEmitObject(BaseShotDestroyDuration); + light.intensity = 0f; + trail.Emit = false; + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.ClearSystem(emitState: false); + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunEmission.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunEmission.cs new file mode 100644 index 0000000..e7d3770 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunEmission.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunEmission")] + public class FieEmitObjectRisingSunEmission : FieEmittableObjectBase + { + [SerializeField] + private float EmissionDuration = 1f; + + [SerializeField] + private float EmissionDamageDuration = 0.75f; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= EmissionDuration) + { + _isEndUpdate = true; + destoryEmitObject(); + } + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > EmissionDamageDuration) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (x != null) + { + Vector3 position = collider.ClosestPointOnBounds(base.transform.position); + FieEmitObjectRisingSunHitEffectSmall fieEmitObjectRisingSunHitEffectSmall = FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (fieEmitObjectRisingSunHitEffectSmall != null) + { + fieEmitObjectRisingSunHitEffectSmall.transform.position = position; + } + } + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceField.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceField.cs new file mode 100644 index 0000000..c2bedcc --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceField.cs @@ -0,0 +1,84 @@ +using Fie.Manager; +using Fie.Object; +using ParticlePlayground; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunForceField")] + public class FieEmitObjectRisingSunForceField : FieEmittableObjectBase + { + [SerializeField] + private float ForceFieldSeedDuration = 4f; + + [SerializeField] + private float ForceFieldSeedDestroyDuration = 1f; + + [SerializeField] + private float entytyInstantiateDelay = 0.3f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private IEnumerator EmitSphereCoroutine() + { + yield return (object)new WaitForSeconds(entytyInstantiateDelay); + /*Error: Unable to find new state assignment for yield return*/; + } + + public override void awakeEmitObject() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: true); + }); + } + + public void Update() + { + base.transform.localRotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) + { + stopParticleEmitting(); + destoryEmitObject(ForceFieldSeedDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnCollisionEnter(Collision collision) + { + if (!_isEndUpdate && !(_lifeTimeCount > ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) && collision.gameObject.tag == "Floor") + { + emitForceFieldEntity(); + stopParticleEmitting(); + destoryEmitObject(ForceFieldSeedDestroyDuration); + _isEndUpdate = true; + } + } + + private void stopParticleEmitting() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + } + + private void emitForceFieldEntity() + { + Transform targetTransform = null; + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, targetTransform, base.ownerCharacter); + StartCoroutine(EmitSphereCoroutine()); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEmitEffect.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEmitEffect.cs new file mode 100644 index 0000000..b187f4d --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEmitEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunForceFieldEmitEffects")] + public class FieEmitObjectRisingSunForceFieldEmitEffect : FieEmittableObjectBase + { + [SerializeField] + private float duration = 3f; + + public override void awakeEmitObject() + { + destoryEmitObject(duration); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEntity.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEntity.cs new file mode 100644 index 0000000..ab3e9d9 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldEntity.cs @@ -0,0 +1,114 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunForceFieldEntity")] + public class FieEmitObjectRisingSunForceFieldEntity : FieEmittableObjectBase + { + [SerializeField] + private Transform _forceFieldCenterTransform; + + [SerializeField] + private float ForceFieldDuration = 12f; + + [SerializeField] + private float ForceFieldDestroyDuration = 0.5f; + + [SerializeField] + private float ForceFieldScaleAnimationDuration = 0.5f; + + [SerializeField] + private GameObject _sphereObject; + + [SerializeField] + private GameObject _normalSphereObject; + + [SerializeField] + private AnimationCurve damageCurvePerLifeRatio; + + [SerializeField] + private float reflectScceedFriendshipGaindMagnify = 10f; + + private Tweener _sphereScaleTweener = new Tweener(); + + private Tweener _sphereDeathTweener = new Tweener(); + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private float _angle; + + private Vector3 _initScale = Vector3.one; + + public void Awake() + { + _initScale = base.transform.localScale; + } + + public override void awakeEmitObject() + { + base.transform.localScale = _initScale; + _sphereObject.GetComponent().material.SetFloat("_Brightness", 1f); + _sphereScaleTweener.InitTweener(ForceFieldScaleAnimationDuration, _initScale, Vector3.one); + } + + public void Update() + { + if (_isEndUpdate) + { + float num = _sphereDeathTweener.UpdateParameterFloat(Time.deltaTime); + _sphereObject.GetComponent().material.SetFloat("_Brightness", num); + _normalSphereObject.GetComponent().material.SetColor(0, new Color(num, num, num, num)); + } + else + { + base.transform.localScale = _sphereScaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ForceFieldDuration - ForceFieldDestroyDuration) + { + destoryEmitObject(ForceFieldDestroyDuration); + _sphereDeathTweener.InitTweener(ForceFieldDestroyDuration, 1f, 0f); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - _forceFieldCenterTransform.position; + FieEmitObjectRisingSunForceFieldReflectEffect fieEmitObjectRisingSunForceFieldReflectEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectRisingSunForceFieldReflectEffect != null) + { + fieEmitObjectRisingSunForceFieldReflectEffect.transform.position = vector; + } + if (base.gainedFriendshipPoint > 0f && base.ownerCharacter != null) + { + base.ownerCharacter.friendshipStats.safeAddFriendship(base.gainedFriendshipPoint * reflectScceedFriendshipGaindMagnify); + } + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + float num = damageCurvePerLifeRatio.Evaluate(_lifeTimeCount / (ForceFieldDuration - ForceFieldDestroyDuration)); + defaultDamageObject.damage *= num; + defaultDamageObject.stagger *= num; + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, defaultDamageObject); + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldReflectEffect.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldReflectEffect.cs new file mode 100644 index 0000000..a94774b --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunForceFieldReflectEffect.cs @@ -0,0 +1,18 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunForceFieldReflectEffect")] + public class FieEmitObjectRisingSunForceFieldReflectEffect : FieEmittableObjectBase + { + [SerializeField] + private float reflectEffectDuration = 0.6f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(reflectEffectDuration); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectMiddle.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectMiddle.cs new file mode 100644 index 0000000..95c10c2 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectMiddle.cs @@ -0,0 +1,40 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunHitEffectMiddle")] + public class FieEmitObjectRisingSunHitEffectMiddle : FieEmittableObjectBase + { + [SerializeField] + private float RisingSunBurstDuration = 0.7f; + + [SerializeField] + private float RisingSunBurstDestroyDuration = 0.5f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > RisingSunBurstDuration) + { + destoryEmitObject(RisingSunBurstDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectSmall.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectSmall.cs new file mode 100644 index 0000000..6e3d5ea --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunHitEffectSmall.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunHitEffectSmall")] + public class FieEmitObjectRisingSunHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaser.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaser.cs new file mode 100644 index 0000000..c1ceba0 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaser.cs @@ -0,0 +1,77 @@ +using Fie.Manager; +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunLaser")] + public class FieEmitObjectRisingSunLaser : FieEmittableObjectBase + { + [SerializeField] + private float LaserDuration = 4f; + + [SerializeField] + private float LaserEmitDuration = 2f; + + [SerializeField] + private int LaserEmitNum = 17; + + [SerializeField] + private float LaserEmitInterval = 0.1f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private float _emitTimeCount; + + private int _emitCount; + + private bool _isEndUpdate; + + private bool _isEndEmit; + + public void Awake() + { + _emitTimeCount = LaserEmitInterval; + } + + public void Update() + { + base.transform.position = initTransform.position; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + _emitTimeCount += Time.deltaTime; + if (_emitTimeCount >= LaserEmitInterval && _emitCount < LaserEmitNum) + { + emitChild(); + _emitTimeCount = 0f; + } + if (_lifeTimeCount > LaserEmitDuration && !_isEndEmit) + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + _isEndEmit = true; + } + if (_lifeTimeCount >= LaserDuration) + { + destoryEmitObject(); + } + } + } + + private void emitChild() + { + Transform targetTransform = base.targetTransform; + Vector3 directionalVec = base.directionalVec; + FieManagerBehaviour.I.EmitObject(initTransform, directionalVec, targetTransform, base.ownerCharacter); + _emitCount++; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserChild.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserChild.cs new file mode 100644 index 0000000..d6ec044 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserChild.cs @@ -0,0 +1,52 @@ +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunLaserChild")] + public class FieEmitObjectRisingSunLaserChild : FieEmittableObjectBase + { + [SerializeField] + private float LaserChildDuration = 0.3f; + + [SerializeField] + private float LaserChildMaxScale = 1.2f; + + private Tweener _startScaleTweener = new Tweener(); + + private Tweener _endScaleTweener = new Tweener(); + + private float _lifeTimeCount; + + public void Awake() + { + _startScaleTweener.InitTweener(LaserChildDuration * 0.5f, 0f, LaserChildMaxScale); + _endScaleTweener.InitTweener(LaserChildDuration * 0.5f, LaserChildMaxScale, 0f); + } + + public void Update() + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount > LaserChildDuration) + { + destoryEmitObject(); + } + Vector3 a = base.transform.position + directionalVec; + Vector3 zero = Vector3.zero; + zero = ((!(targetTransform != null)) ? (Quaternion.LookRotation(a - base.transform.position) * Vector3.forward) : (Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward)); + base.transform.rotation = Quaternion.LookRotation(zero); + float num = 0f; + num = (_startScaleTweener.IsEnd() ? _endScaleTweener.UpdateParameterFloat(Time.deltaTime) : _startScaleTweener.UpdateParameterFloat(Time.deltaTime)); + base.transform.localScale = new Vector3(num, num, 1f); + } + + private void OnTriggerEnter(Collider collider) + { + if (collider.gameObject.tag == getHostileTagString()) + { + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserDust.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserDust.cs new file mode 100644 index 0000000..173e894 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunLaserDust.cs @@ -0,0 +1,42 @@ +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunLaserDust")] + public class FieEmitObjectRisingSunLaserDust : FieEmittableObjectBase + { + [SerializeField] + private float DustDuration = 3f; + + [SerializeField] + private float DustEmitDuration = 1.8f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTime; + + private bool _isEndUpdate; + + private void Update() + { + if (!_isEndUpdate) + { + base.transform.position = initTransform.position; + _lifeTime += Time.deltaTime; + if (_lifeTime > DustEmitDuration) + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + _isEndUpdate = true; + destoryEmitObject(DustDuration - _lifeTime); + } + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunShinyArrow.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunShinyArrow.cs new file mode 100644 index 0000000..06af034 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunShinyArrow.cs @@ -0,0 +1,166 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunShinyArrow")] + public class FieEmitObjectRisingSunShinyArrow : FieEmittableObjectBase + { + [SerializeField] + private float shinyArrowDuration = 1f; + + [SerializeField] + private float ShinyArrowVelocityMax = 4f; + + [SerializeField] + private float ShinyArrowAccelTime = 0.1f; + + [SerializeField] + private float ShinyArrowPysicalForce = 5f; + + [SerializeField] + private float ShinyArrowDestroyDuration = 0.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private FieOnetimeLight shotLight; + + [SerializeField] + private List trailList = new List(); + + private const float HORMING_DISTANCE_MAX = 5f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isInitializedHormingVector; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(ShinyArrowAccelTime, 0f, ShinyArrowVelocityMax); + _scaleTweener.InitTweener(ShinyArrowAccelTime, Vector3.zero, Vector3.one); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized + directionalVec * 4f; + _initDirectionalVec.Normalize(); + } + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.ClearSystem(emitState: true); + } + } + effectModel.transform.localScale = _initEffectModelScale; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 initDirectionalVec = _initDirectionalVec; + if (targetTransform != null) + { + float num = Vector3.Distance(targetTransform.position, base.transform.position); + float d = Mathf.Min(num / 5f, 1f); + Vector3 vector = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + float num2 = Vector3.Dot(initDirectionalVec, vector); + if (num2 < 0.7f) + { + d = 0f; + } + initDirectionalVec *= 0.25f; + initDirectionalVec += vector * d; + initDirectionalVec.Normalize(); + if (!_isInitializedHormingVector) + { + directionalVec = initDirectionalVec; + _isInitializedHormingVector = true; + } + } + Vector3 vector2 = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector2 * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shinyArrowDuration) + { + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.Emit = false; + trail.ClearSystem(emitState: false); + } + } + destoryEmitObject(ShinyArrowDestroyDuration); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector2); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, null, base.ownerCharacter); + if (collider.gameObject.tag == getHostileTagString()) + { + FieManagerBehaviour.I.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + } + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.Emit = false; + } + } + shotLight.Kill(); + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(shinyArrowDuration - _lifeTimeCount); + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trailList.Count > 0) + { + foreach (SmokeTrail trail in trailList) + { + trail.ClearSystem(emitState: false); + } + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSpellEffect.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSpellEffect.cs new file mode 100644 index 0000000..d319810 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSpellEffect.cs @@ -0,0 +1,19 @@ +using Fie.Object; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunSpellEffect")] + public class FieEmitObjectRisingSunSpellEffect : FieEmittableObjectBase + { + private const float duration = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrow.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrow.cs new file mode 100644 index 0000000..6667260 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrow.cs @@ -0,0 +1,100 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunSummonArrow")] + public class FieEmitObjectRisingSunSummonArrow : FieEmittableObjectBase + { + [SerializeField] + private float SummonArrowDuration = 1.5f; + + [SerializeField] + private float SummonArrowEmitDuration = 1f; + + [SerializeField] + private int SummonArrowEmitNum = 10; + + [SerializeField] + private float SummonArrowEmitInterval = 0.1f; + + [SerializeField] + private FieDetector _emitPointDetector; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private float _emitTimeCount; + + private float _emitInterval; + + private int _emitCount; + + private bool _isEndUpdate; + + private bool _isEndEmit; + + public override void awakeEmitObject() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: true); + }); + _emitPointDetector.Initialize(); + _emitTimeCount = SummonArrowEmitInterval; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + _emitTimeCount += Time.deltaTime; + if (_emitTimeCount >= SummonArrowEmitInterval && _emitCount < SummonArrowEmitNum) + { + FieManagerBehaviour.I.RequestLobbyOnlyActivity(base.ownerCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SUN_ABILITY_2), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_ABILITY_2)); + emitChild(); + _emitTimeCount = 0f; + } + if (_lifeTimeCount > SummonArrowEmitDuration && !_isEndEmit) + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + _isEndEmit = true; + } + if (_lifeTimeCount >= SummonArrowDuration) + { + destoryEmitObject(); + } + } + } + + private void emitChild() + { + Transform transform = null; + Vector3 directionalVec = base.directionalVec; + if (_emitPointDetector != null) + { + transform = _emitPointDetector.getRandomEnemyTransform(isCenter: true); + if (transform != null) + { + directionalVec = Quaternion.LookRotation(transform.position - base.transform.position) * Vector3.forward; + } + } + FieEmitObjectRisingSunSummonArrowChild fieEmitObjectRisingSunSummonArrowChild = FieManagerBehaviour.I.EmitObject(base.transform, directionalVec, transform, base.ownerCharacter); + if (fieEmitObjectRisingSunSummonArrowChild != null) + { + fieEmitObjectRisingSunSummonArrowChild.childId = _emitCount; + } + _emitCount++; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrowChild.cs b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrowChild.cs new file mode 100644 index 0000000..e174fbe --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieEmitObjectRisingSunSummonArrowChild.cs @@ -0,0 +1,160 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using PigeonCoopToolkit.Effects.Trails; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunSummonArrowChild")] + public class FieEmitObjectRisingSunSummonArrowChild : FieEmittableObjectBase + { + [SerializeField] + private float SummonArrowChildDuration = 1.5f; + + [SerializeField] + private float SummonArrowVelocityMax = 2f; + + [SerializeField] + private float SummonArrowVelocityAccelTime = 0.3f; + + [SerializeField] + private float SummonArrowDestroyDuration = 0.7f; + + [SerializeField] + private float SummonArrowTiltDuration = 0.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private SmoothTrail trail; + + private const float RANDOM_TILT_DISTANCE = 2f; + + private const float HORMING_DISTANCE_MAX = 10f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _randomTiltVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private bool _isInitRandomTilt; + + private float _totalMoveDistance; + + private float _initEnemyDistance = -3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isEndHorming; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public int childId; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + } + + public override void awakeEmitObject() + { + trail.ClearSystem(emitState: true); + _velocityTweener.InitTweener(SummonArrowVelocityAccelTime, 0f, SummonArrowVelocityMax); + _tiltForceTweener.InitTweener(SummonArrowTiltDuration, 1f, 0f); + effectModel.transform.localScale = _initEffectModelScale; + } + + public void Update() + { + if (!_isEndUpdate) + { + if (!_isInitRandomTilt) + { + initRandomTilt(); + } + float num = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + Vector3 a = directionalVec * (1f - num); + Vector3 b = _randomTiltVec * num; + a += b; + a.Normalize(); + if (targetTransform != null) + { + if (_initEnemyDistance <= 0f) + { + _initEnemyDistance = Vector3.Distance(base.transform.position, targetTransform.position); + } + if (_totalMoveDistance > _initEnemyDistance * 1.25f) + { + _isEndHorming = true; + directionalVec = _lastDirectionalVec; + } + if (!_isEndHorming) + { + Vector3 a2 = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + a *= num; + a += a2 * (1f - num); + a.Normalize(); + _lastDirectionalVec = a; + } + } + Vector3 vector = a * _velocityTweener.UpdateParameterFloat(Time.deltaTime) * Time.deltaTime; + _totalMoveDistance += Vector3.Distance(base.transform.position, base.transform.position + vector); + base.transform.position += vector; + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= SummonArrowChildDuration) + { + destoryEmitObject(SummonArrowDestroyDuration); + trail.Emit = false; + trail.ClearSystem(emitState: false); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + if (vector != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + } + + private void initRandomTilt() + { + Vector3 a = base.transform.position + directionalVec * 2f; + Vector3 a2 = Quaternion.AngleAxis((float)childId * 30f, directionalVec) * Vector3.up; + a2 *= 2f; + a += a2 * 2f; + _randomTiltVec = Quaternion.LookRotation(a - base.transform.position) * Vector3.forward; + _randomTiltVec.Normalize(); + _isInitRandomTilt = true; + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + trail.Emit = false; + destoryEmitObject(SummonArrowDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.ClearSystem(emitState: false); + } + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieRisingSun.cs b/src/Fie.Ponies.RisingSun/FieRisingSun.cs new file mode 100644 index 0000000..89ab2bc --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieRisingSun.cs @@ -0,0 +1,107 @@ +using Fie.Object; +using Fie.Object.Abilities; +using Fie.UI; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.RisingSun +{ + [FiePrefabInfo("Prefabs/RisingSun/RisingSun")] + public class FieRisingSun : FiePonies + { + private static List _ignoreAttackState = new List + { + typeof(FieStateMachineRisingSunTeleportation), + typeof(FieStateMachinePoniesStagger), + typeof(FieStateMachinePoniesStaggerFall), + typeof(FieStateMachinePoniesDead), + typeof(FieStateMachinePoniesRevive) + }; + + public const string SIGNATURE = "rising_sun"; + + public static List ignoreAttackState => _ignoreAttackState; + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineRisingSunBaseShot); + } + + public override Type getStormState() + { + return typeof(FieStateMachineRisingSunTeleportation); + } + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieRisingSunAnimationContainer()); + _staggerCancelableStateList.Add(typeof(FieStateMachineRisingSunTeleportation)); + abstractStateList.Add(typeof(FieStateMachinePoniesJump), typeof(FieStateMachineRisingSunJump)); + abstractStateList.Add(typeof(FieStateMachinePoniesEvasion), typeof(FieStateMachineRisingSunTeleportation)); + abstractStateList.Add(typeof(FieStateMachinePoniesBaseAttack), typeof(FieStateMachineRisingSunBaseShot)); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_1, new FieStateMachineRisingSunShinyArrow()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_2, new FieStateMachineRisingSunSummonArrow()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_3, new FieStateMachineRisingSunEmission()); + syncBindedAbilities(); + SetStateActivateCheckCallback(TeleportationActivateCheck); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + base.detector.intoTheBattleEvent += Detector_intoTheBattleEvent; + } + + private void Detector_intoTheBattleEvent(FieGameCharacter targetCharacter) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ENEMY_DETECTED)); + } + + private bool TeleportationActivateCheck() + { + if (healthStats.shield <= 0f) + { + return false; + } + return true; + } + + protected new void Start() + { + base.Start(); + getStateMachine(StateMachineType.Attack).setState(typeof(FieStateMachinePoniesAttackIdle), isForceSet: true); + getStateMachine().setState(typeof(FieStateMachineCommonIdle), isForceSet: false); + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ELEMENT_NAME_PONICO_SIMPLE); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.NONE; + } + + public override KeyValuePair getAbilitiesIconInfo() + { + return new KeyValuePair(typeof(FieGameUIAbilitiesIconRisingSun), "Prefabs/UI/AbilitiesIcons/RisingSunAbilityIcon"); + } + + public override GDEGameCharacterTypeData getCharacterTypeData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.GameCharacterType_MAGIC); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieRisingSunAnimationContainer.cs b/src/Fie.Ponies.RisingSun/FieRisingSunAnimationContainer.cs new file mode 100644 index 0000000..8152da4 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieRisingSunAnimationContainer.cs @@ -0,0 +1,37 @@ +using Fie.Object; + +namespace Fie.Ponies.RisingSun +{ + public class FieRisingSunAnimationContainer : FiePoniesAnimationContainer + { + public enum RisingSunAnimationList + { + JUMP_TAKEOFF = 19, + JUMP, + TELEPORTATION_AIR, + TELEPORTATION_GROUND, + FIRE_SMALL, + FIRE_SMALL2, + FIRE_LARGE, + FIRE_LARGE_IDLE, + FIRE_LARGE_END, + EMOTION_FIRE_LARGE, + HORN_SHINE, + MAX_RISING_SUN_ANIMATION + } + + public FieRisingSunAnimationContainer() + { + addAnimationData(19, new FieSkeletonAnimationObject(0, "jump")); + addAnimationData(20, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(21, new FieSkeletonAnimationObject(0, "teleportation_air")); + addAnimationData(22, new FieSkeletonAnimationObject(0, "teleportation_ground")); + addAnimationData(23, new FieSkeletonAnimationObject(0, "fire_small")); + addAnimationData(25, new FieSkeletonAnimationObject(0, "fire_large")); + addAnimationData(26, new FieSkeletonAnimationObject(0, "fire_large_idle")); + addAnimationData(27, new FieSkeletonAnimationObject(0, "fire_large_end")); + addAnimationData(28, new FieSkeletonAnimationObject(1, "emotion_fire_large")); + addAnimationData(29, new FieSkeletonAnimationObject(2, "horn_shine")); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieRisingSunBigLaserUvOffset.cs b/src/Fie.Ponies.RisingSun/FieRisingSunBigLaserUvOffset.cs new file mode 100644 index 0000000..96b8c2b --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieRisingSunBigLaserUvOffset.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieRisingSunBigLaserUvOffset : MonoBehaviour + { + private float _offsetX; + + private void Update() + { + _offsetX -= 1.5f * Time.deltaTime; + GetComponent().material.SetVector("_texUV", new Vector4(_offsetX, 0f, 0f, 0f)); + base.transform.Rotate(new Vector3(1f, 0f, 0f)); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieRisingSunForceFieldUvOffset.cs b/src/Fie.Ponies.RisingSun/FieRisingSunForceFieldUvOffset.cs new file mode 100644 index 0000000..4675a20 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieRisingSunForceFieldUvOffset.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieRisingSunForceFieldUvOffset : MonoBehaviour + { + private float _offsetX; + + private void Update() + { + _offsetX += 0.4f * Time.deltaTime; + GetComponent().material.SetTextureOffset("_Gradient_Edge_Fake", new Vector2(_offsetX, 0.65f)); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunBaseShot.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunBaseShot.cs new file mode 100644 index 0000000..df6c8bc --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunBaseShot.cs @@ -0,0 +1,64 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunBaseShot : FieStateMachineRisingSunInterface + { + private const float BASE_ATTACK_DEFAULT_SHILED_COST = 0.03f; + + private const float BASE_SHOT_DELAY = 0.2f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + if (!FieRisingSun.ignoreAttackState.Contains(fieRisingSun.getStateMachine().nowStateType())) + { + Vector3 flipDirectionVector = fieRisingSun.flipDirectionVector; + FieEmitObjectRisingSunBaseShot fieEmitObjectRisingSunBaseShot = FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, flipDirectionVector, fieRisingSun.detector.getLockonEnemyTransform(isCenter: true), fieRisingSun); + if (fieEmitObjectRisingSunBaseShot != null) + { + fieEmitObjectRisingSunBaseShot.setAdditionalVelocity(fieRisingSun.getNowMoveForce() * 0.05f); + } + Type type = fieRisingSun.getStateMachine().nowStateType(); + if ((type == typeof(FieStateMachineCommonIdle) || type == typeof(FieStateMachinePoniesIdle) || type == typeof(FieStateMachineRisingSunFireSmall) || type == typeof(FieStateMachineRisingSunTeleportationEndGround)) && fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + fieRisingSun.getStateMachine().setState(typeof(FieStateMachineRisingSunFireSmall), isForceSet: true, isDupulicate: true); + fieRisingSun.physicalForce.SetPhysicalForce(flipDirectionVector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 3000f, 0.1f); + } + fieRisingSun.damageSystem.calcShieldDirect((0f - fieRisingSun.healthStats.maxShield) * 0.03f); + fieRisingSun.damageSystem.setRegenerateDelay(fieRisingSun.healthStats.regenerateDelay * 0.1f, roundToBigger: true); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SUN_BASE_ATTACK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_BASE_ATTACK)); + _isEnd = true; + } + } + } + + public override float getDelay() + { + return 0.2f; + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunEmission.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunEmission.cs new file mode 100644 index 0000000..ad7cc93 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunEmission.cs @@ -0,0 +1,80 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunEmission : FieStateMachineAbilityBase + { + private const string FORCE_FIELD_SIGNATURE = "magic_bubble"; + + private const float FORCE_FIELD_DELAY = 0.3f; + + private const float FORCE_FIELD_DEFAULT_COOLDOWN = 3f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + if (!FieRisingSun.ignoreAttackState.Contains(fieRisingSun.getStateMachine().nowStateType())) + { + Vector3 a = (fieRisingSun.flipState != 0) ? Vector3.right : Vector3.left; + if (fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineRisingSunFireSmall)) + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + fieRisingSun.getStateMachine().setState(typeof(FieStateMachineRisingSunFireSmall), isForceSet: true, isDupulicate: true); + } + fieRisingSun.physicalForce.SetPhysicalForce(a * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 5000f, 0.1f); + } + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, Vector3.up, null, fieRisingSun); + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, Vector3.zero, null); + fieRisingSun.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SUN_ABILITY_3), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_ABILITY_3)); + fieRisingSun.abilitiesContainer.SetCooldown(3f); + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 3f; + } + + public override float getDelay() + { + return 0.3f; + } + + public override string getSignature() + { + return "magic_bubble"; + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireBig.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireBig.cs new file mode 100644 index 0000000..c2f1e97 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireBig.cs @@ -0,0 +1,97 @@ +using Fie.Object; +using Fie.Utility; +using Spine; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunFireBig : FieStateMachineRisingSunInterface + { + private enum FireState + { + FIRE_START, + FIRING + } + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 15f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + private bool _isSetEndAnim; + + private Tweener _groundForceTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + _timeCount += Time.deltaTime; + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + switch (_fireState) + { + case FireState.FIRE_START: + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + fieRisingSun.animationManager.SetAnimationChain(25, 26, isLoop: true); + } + else + { + _nextState = typeof(FieStateMachineRisingSunFlying); + } + TrackEntry trackEntry = fieRisingSun.animationManager.SetAnimationChain(28, 16, isLoop: true); + if (trackEntry != null) + { + _endTime = trackEntry.endTime; + } + _fireState = FireState.FIRING; + fieRisingSun.isEnableGravity = false; + break; + } + } + if (_timeCount > _endTime) + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding && !_isSetEndAnim) + { + TrackEntry trackEntry2 = fieRisingSun.animationManager.SetAnimation(27); + if (trackEntry2 != null) + { + _endTime += trackEntry2.endTime; + } + _isSetEndAnim = true; + } + else + { + _isEnd = true; + } + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableGravity = true; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireSmall.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireSmall.cs new file mode 100644 index 0000000..c0ecb94 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFireSmall.cs @@ -0,0 +1,72 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunFireSmall : FieStateMachineRisingSunInterface + { + private enum FireState + { + FIRE_START, + FIRING + } + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + _timeCount += Time.deltaTime; + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + switch (_fireState) + { + case FireState.FIRE_START: + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + int animationId = 23; + TrackEntry trackEntry = fieRisingSun.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + _endTime = trackEntry.endTime; + } + } + _fireState = FireState.FIRING; + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineRisingSunFlying)); + list.Add(typeof(FieStateMachinePoniesMove)); + list.Add(typeof(FieStateMachineRisingSunTeleportation)); + return list; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFlying.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFlying.cs new file mode 100644 index 0000000..0ad7ece --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunFlying.cs @@ -0,0 +1,92 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunFlying : FieStateMachineRisingSunInterface + { + private const float DEFAULT_FLYING_POWER = 11f; + + private const float MAX_FLYING_SPEED = 10f; + + private const float FLYING_UPPER_FORCE_DURATION = 3f; + + private const float LANDING_DELAY = 0.2f; + + private float _flyingTime = 3f; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachinePoniesLanding); + _isEnd = true; + } + else + { + if (fieRisingSun.animationManager.IsEndAnimation(0)) + { + fieRisingSun.animationManager.SetAnimation(20, isLoop: true); + } + Vector3 vector = fieRisingSun.externalInputVector; + _flyingTime -= Time.deltaTime; + _flyingTime = Mathf.Max(_flyingTime, 0f); + if (vector.y > 0f) + { + vector.y *= 1f * (_flyingTime / 3f); + } + vector *= 10f * fieRisingSun.externalInputForce; + vector.y *= 0.2f; + vector.y += 11f; + fieRisingSun.addMoveForce(vector, 1f); + fieRisingSun.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 1000f); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.setGravityRate(0.5f); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.setGravityRate(1f); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesEvasion)); + list.Add(typeof(FieStateMachineRisingSunTeleportation)); + return list; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunJump.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunJump.cs new file mode 100644 index 0000000..f9ec38d --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunJump.cs @@ -0,0 +1,116 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunJump : FieStateMachineRisingSunInterface + { + private enum JumpState + { + JUMP_TAKEOFF_START, + JUMP_TAKEOFF_STANDBY, + JUMP_TAKEOFF + } + + private const float TAKEOFF_FORCE = 6f; + + private const float TAKEOFF_PAST_TIME = 0.5f; + + private JumpState _jumpState; + + private float _takeoffTime; + + private float _flyingTime; + + private float _landingCount; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun rising_sun = gameCharacter as FieRisingSun; + if (_jumpState == JumpState.JUMP_TAKEOFF_START) + { + if (rising_sun.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineRisingSunFlying); + _isEnd = true; + return; + } + TrackEntry trackEntry = rising_sun.animationManager.SetAnimation(19); + _jumpState = JumpState.JUMP_TAKEOFF_STANDBY; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.name == "takeOff") + { + Vector3 vector = rising_sun.externalInputVector; + vector += Vector3.up; + vector.x *= 0.1f; + vector.Normalize(); + vector *= 6f; + rising_sun.setMoveForce(vector, 0.5f); + _jumpState = JumpState.JUMP_TAKEOFF; + } + else if (e.Data.name == "finished") + { + _nextState = typeof(FieStateMachineRisingSunFlying); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineRisingSunFlying); + _isEnd = true; + }; + } + } + rising_sun.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 1000f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.setGravityRate(0.5f); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.setGravityRate(1f); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesEvasion)); + list.Add(typeof(FieStateMachineRisingSunTeleportation)); + return list; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunShinyArrow.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunShinyArrow.cs new file mode 100644 index 0000000..61cfc53 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunShinyArrow.cs @@ -0,0 +1,80 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunShinyArrow : FieStateMachineAbilityBase + { + private const string SHINY_ARROW_SIGNATURE = "shiny_arrow"; + + private const float SHINY_ARROW_DELAY = 0.3f; + + private const float SHINY_ARROW_DEFAULT_COOLDOWN = 7f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + if (!FieRisingSun.ignoreAttackState.Contains(fieRisingSun.getStateMachine().nowStateType())) + { + Vector3 vector = (fieRisingSun.flipState != 0) ? Vector3.right : Vector3.left; + if (fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineRisingSunFireSmall)) + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + fieRisingSun.getStateMachine().setState(typeof(FieStateMachineRisingSunFireSmall), isForceSet: true, isDupulicate: true); + } + fieRisingSun.physicalForce.SetPhysicalForce(vector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 5000f, 0.5f); + } + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, vector, fieRisingSun.detector.getLockonEnemyTransform(isCenter: true), fieRisingSun); + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, Vector3.zero, null); + fieRisingSun.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SUN_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_ABILITY_1)); + fieRisingSun.abilitiesContainer.SetCooldown(7f); + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 7f; + } + + public override float getDelay() + { + return 0.3f; + } + + public override string getSignature() + { + return "shiny_arrow"; + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunSummonArrow.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunSummonArrow.cs new file mode 100644 index 0000000..2031d68 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunSummonArrow.cs @@ -0,0 +1,79 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunSummonArrow : FieStateMachineAbilityBase + { + private const string SUMMON_ARROW_SIGNATURE = "summon_arrow"; + + private const float SUMMON_ARROW_DELAY = 0.3f; + + private const float SUMMON_ARROW_DEFAULT_COOLDOWN = 6f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + if (!FieRisingSun.ignoreAttackState.Contains(fieRisingSun.getStateMachine().nowStateType())) + { + Vector3 vector = (fieRisingSun.flipState != 0) ? Vector3.right : Vector3.left; + if (fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieRisingSun.getStateMachine().nowStateType() == typeof(FieStateMachineRisingSunFireSmall)) + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + fieRisingSun.getStateMachine().setState(typeof(FieStateMachineRisingSunFireSmall), isForceSet: true, isDupulicate: true); + } + fieRisingSun.physicalForce.SetPhysicalForce(vector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 500f, 0.1f); + } + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, vector, fieRisingSun.detector.getLockonEnemyTransform(isCenter: true), fieRisingSun); + FieManagerBehaviour.I.EmitObject(fieRisingSun.hornTransform, Vector3.zero, null); + fieRisingSun.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + fieRisingSun.abilitiesContainer.SetCooldown(6f); + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 6f; + } + + public override float getDelay() + { + return 0.3f; + } + + public override string getSignature() + { + return "summon_arrow"; + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return null; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportation.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportation.cs new file mode 100644 index 0000000..152f896 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportation.cs @@ -0,0 +1,142 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunTeleportation : FieStateMachineRisingSunInterface + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_STANDBY, + TELEPORTATION, + TELEPORTATION_END + } + + private const float TELEPORT_DEFAULT_SHILED_COST = 0.1f; + + private const float TELEPORT_DELAY = 0.2f; + + private const float TELEPORT_DURATION = 0.3f; + + private const float TELEPORT_DISTANCE = 1.5f; + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private Type _nextState; + + private Vector3 _teleportNormalVec = Vector3.zero; + + private Vector3 _teleportTargetPos = Vector3.zero; + + private FieObjectGroundState _startGroundState; + + private Tweener _teleportTweener = new Tweener(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + _teleportNormalVec = fieRisingSun.externalInputVector.normalized; + _teleportNormalVec.y *= 0.5f; + if (fieRisingSun.groundState == FieObjectGroundState.Grounding && _teleportNormalVec.y <= 0f) + { + _teleportNormalVec.y = 0f; + _teleportNormalVec.Normalize(); + } + if (_teleportNormalVec == Vector3.zero) + { + if (fieRisingSun.flipState == FieObjectFlipState.Left) + { + _teleportNormalVec = Vector3.left; + } + else + { + _teleportNormalVec = Vector3.right; + } + } + _teleportTargetPos = fieRisingSun.position + _teleportNormalVec * 1.5f; + int layerMask = 262656; + if (Physics.Raycast(fieRisingSun.position, _teleportNormalVec, out RaycastHit hitInfo, 1.5f, layerMask)) + { + _teleportTargetPos = hitInfo.point; + } + fieRisingSun.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_EVADED), 25); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SUN_EVADE), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_EVADE)); + fieRisingSun.isEnableCollider = false; + _teleportTweener.InitTweener(0.3f, fieRisingSun.position, _teleportTargetPos); + _startGroundState = fieRisingSun.groundState; + _teleportationState = TeleportationState.TELEPORTATION; + break; + } + case TeleportationState.TELEPORTATION: + { + Vector3 lhs = fieRisingSun.position = _teleportTweener.UpdateParameterVec3(Time.deltaTime); + fieRisingSun.setFlipByVector(fieRisingSun.externalInputVector.normalized); + if (lhs == _teleportTargetPos) + { + fieRisingSun.damageSystem.calcShieldDirect((0f - fieRisingSun.healthStats.maxShield) * 0.1f); + fieRisingSun.damageSystem.setRegenerateDelay(fieRisingSun.healthStats.regenerateDelay * 0.75f, roundToBigger: true); + fieRisingSun.isEnableCollider = true; + _teleportationState = TeleportationState.TELEPORTATION_END; + _isEnd = true; + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + if (_startGroundState == FieObjectGroundState.Flying) + { + fieRisingSun.animationManager.SetAnimation(4); + } + _nextState = typeof(FieStateMachineCommonIdle); + } + else + { + _nextState = typeof(FieStateMachineRisingSunTeleportationEndAir); + } + } + break; + } + } + fieRisingSun.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 500f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableCollider = true; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndAir.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndAir.cs new file mode 100644 index 0000000..aa935e5 --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndAir.cs @@ -0,0 +1,109 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunTeleportationEndAir : FieStateMachineRisingSunInterface + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_END + } + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private bool _isFinished; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + TrackEntry trackEntry = fieRisingSun.animationManager.SetAnimation(21, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineRisingSunFlying); + _isFinished = true; + } + }; + trackEntry.End += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + Vector3 externalInputVector = fieRisingSun.externalInputVector; + fieRisingSun.setFlipByVector(externalInputVector); + _teleportationState = TeleportationState.TELEPORTATION_END; + break; + } + } + if (_isEnd) + { + if (fieRisingSun.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachineCommonIdle); + } + else + { + _nextState = typeof(FieStateMachineRisingSunFlying); + } + } + else if (_isFinished && fieRisingSun.externalInputForce > 0.5f && fieRisingSun.groundState != 0) + { + _nextState = typeof(FieStateMachineRisingSunFlying); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableGravity = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableGravity = true; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRisingSunTeleportation)); + list.Add(typeof(FieStateMachineRisingSunFlying)); + } + return list; + } + } +} diff --git a/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndGround.cs b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndGround.cs new file mode 100644 index 0000000..42eee5c --- /dev/null +++ b/src/Fie.Ponies.RisingSun/FieStateMachineRisingSunTeleportationEndGround.cs @@ -0,0 +1,92 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.RisingSun +{ + public class FieStateMachineRisingSunTeleportationEndGround : FieStateMachineRisingSunInterface + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_END + } + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private bool _isFinished; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieRisingSun) + { + FieRisingSun fieRisingSun = gameCharacter as FieRisingSun; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + TrackEntry trackEntry = fieRisingSun.animationManager.SetAnimation(27, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry.End += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _teleportationState = TeleportationState.TELEPORTATION_END; + Vector3 externalInputVector = fieRisingSun.externalInputVector; + fieRisingSun.setFlipByVector(externalInputVector); + if (fieRisingSun.externalInputForce > 0.1f) + { + fieRisingSun.addMoveForce(fieRisingSun.flipDirectionVector.normalized * 10000f, 1f); + } + break; + } + } + if (_isEnd) + { + _nextState = typeof(FieStateMachineCommonIdle); + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineRisingSunTeleportation)); + list.Add(typeof(FieStateMachinePoniesMove)); + list.Add(typeof(FieStateMachineRisingSunFlying)); + } + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightBaseShot.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightBaseShot.cs new file mode 100644 index 0000000..79e7019 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightBaseShot.cs @@ -0,0 +1,156 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightBaseShot")] + public class FieEmitObjectTwilightBaseShot : FieEmittableObjectBase + { + [SerializeField] + private float BaseShotDuration = 1.5f; + + [SerializeField] + private float BaseShotVelocityMax = 2.5f; + + [SerializeField] + private float BaseShotVelocityAccelTime = 0.1f; + + [SerializeField] + private float BaseShotDestroyDuration = 0.7f; + + [SerializeField] + private Light light; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PKFxFX trail; + + private const float HORMING_DISTANCE_MAX = 1f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _additionalVelocity = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _defualtLightIntensity; + + private bool _isEndUpdate; + + private bool _isInitializedHormingVector; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + effectModel.transform.localScale = _initEffectModelScale; + if (light != null) + { + _defualtLightIntensity = light.intensity; + } + trail.StopEffect(); + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(BaseShotVelocityAccelTime, 0f, BaseShotVelocityMax); + _scaleTweener.InitTweener(BaseShotVelocityAccelTime, Vector3.zero, Vector3.one); + trail.StopEffect(); + trail.StartEffect(); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized + directionalVec * 4f; + _initDirectionalVec.Normalize(); + } + if (light != null) + { + light.intensity = _defualtLightIntensity; + } + if (effectModel != null) + { + effectModel.transform.localScale = _initEffectModelScale; + } + base.emitObjectType = EmitObjectType.RANGED_ATTACK_REFLECTIVE; + if (base.ownerCharacter != null && base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV4_AGRESSIVE_CASTING) != null) + { + base.emitObjectType = EmitObjectType.RANGED_ATTACK; + } + } + + public void setAdditionalVelocity(Vector3 additionalVelocity) + { + _additionalVelocity = additionalVelocity; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 directionalVec = base.directionalVec; + if (targetTransform != null) + { + float num = Vector3.Distance(targetTransform.position, base.transform.position); + float num2 = num / 1f; + Vector3 vector = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + float num3 = Mathf.Max(Vector3.Dot(directionalVec, vector), 0f); + num2 *= num3 * 0.5f; + vector.z *= 1.2f; + directionalVec += vector * num2; + directionalVec.Normalize(); + if (!_isInitializedHormingVector) + { + base.directionalVec = directionalVec; + _isInitializedHormingVector = true; + } + } + Vector3 vector2 = base.directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector2 * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= BaseShotDuration) + { + destoryEmitObject(BaseShotDestroyDuration); + trail.StopEffect(); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector2); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + destoryEmitObject(BaseShotDestroyDuration); + light.intensity = 0f; + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightChargedEffect.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightChargedEffect.cs new file mode 100644 index 0000000..4928cf2 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightChargedEffect.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightChargedEffect")] + public class FieEmitObjectTwilightChargedEffect : FieEmittableObjectBase + { + private const float DURATION = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightExplosiveTeleportation.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightExplosiveTeleportation.cs new file mode 100644 index 0000000..a26fb83 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightExplosiveTeleportation.cs @@ -0,0 +1,56 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwiilghtExplosiveTeleportation")] + public class FieEmitObjectTwilightExplosiveTeleportation : FieEmittableObjectBase + { + [SerializeField] + private float ExplodeDuration = 0.5f; + + [SerializeField] + private float ExplodeWarmup = 0.1f; + + [SerializeField] + private float ExplodeDestroyDuration = 1f; + + [SerializeField] + private float ExplodePysicalForce = 1f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > ExplodeDuration) + { + destoryEmitObject(ExplodeDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && !(_lifeCount > ExplodeDuration + ExplodeWarmup) && !(_lifeCount < ExplodeWarmup) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - base.transform.position; + vector2 = new Vector3(vector2.x, 0f, vector2.z).normalized; + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(vector2 * ExplodePysicalForce, 0f, useRound: false); + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero).transform.position = vector; + } + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceField.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceField.cs new file mode 100644 index 0000000..855b070 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceField.cs @@ -0,0 +1,84 @@ +using Fie.Manager; +using Fie.Object; +using ParticlePlayground; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightForceField")] + public class FieEmitObjectTwilightForceField : FieEmittableObjectBase + { + [SerializeField] + private float ForceFieldSeedDuration = 4f; + + [SerializeField] + private float ForceFieldSeedDestroyDuration = 1f; + + [SerializeField] + private float entytyInstantiateDelay = 0.3f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private IEnumerator EmitSphereCoroutine() + { + yield return (object)new WaitForSeconds(entytyInstantiateDelay); + /*Error: Unable to find new state assignment for yield return*/; + } + + public override void awakeEmitObject() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: true); + }); + } + + public void Update() + { + base.transform.localRotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) + { + stopParticleEmitting(); + destoryEmitObject(ForceFieldSeedDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnCollisionEnter(Collision collision) + { + if (!_isEndUpdate && !(_lifeTimeCount > ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) && collision.gameObject.tag == "Floor") + { + emitForceFieldEntity(); + stopParticleEmitting(); + destoryEmitObject(ForceFieldSeedDestroyDuration); + _isEndUpdate = true; + } + } + + private void stopParticleEmitting() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + } + + private void emitForceFieldEntity() + { + Transform targetTransform = null; + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, targetTransform, base.ownerCharacter); + StartCoroutine(EmitSphereCoroutine()); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEmitEffect.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEmitEffect.cs new file mode 100644 index 0000000..01ae097 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEmitEffect.cs @@ -0,0 +1,21 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightForceFieldEmitEffects")] + public class FieEmitObjectTwilightForceFieldEmitEffect : FieEmittableObjectBase + { + [SerializeField] + private float duration = 3f; + + public override void awakeEmitObject() + { + destoryEmitObject(duration); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEntity.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEntity.cs new file mode 100644 index 0000000..8e970d0 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldEntity.cs @@ -0,0 +1,252 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightForceFieldEntity")] + public class FieEmitObjectTwilightForceFieldEntity : FieEmittableObjectBase + { + [SerializeField] + private Transform _forceFieldCenterTransform; + + [SerializeField] + private float ForceFieldDuration = 12f; + + [SerializeField] + private float ForceFieldDestroyDuration = 0.5f; + + [SerializeField] + private float ForceFieldScaleAnimationDuration = 0.5f; + + [SerializeField] + private float ShieldReginInterval = 1f; + + [SerializeField] + private float ShieldReginPerInterval = 0.05f; + + [SerializeField] + private GameObject _sphereObject; + + [SerializeField] + private GameObject _normalSphereObject; + + [SerializeField] + private AnimationCurve damageCurvePerLifeRatio; + + [SerializeField] + private Texture2D defaultSphereTexture; + + [SerializeField] + private Texture2D disruptorSphereTexture; + + [SerializeField] + private Texture2D healingSphereTexture; + + private Tweener _sphereScaleTweener = new Tweener(); + + private Tweener _sphereDeathTweener = new Tweener(); + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + private float _angle; + + private Vector3 _initScale = Vector3.one; + + private float _currentDuration; + + private float _healingDelay; + + private float _healingRate; + + private Dictionary _healRoutine = new Dictionary(); + + private Material _emissiveMaterial; + + private Material _normalMaterial; + + private FieStatusEffectsBuffAndDebuffToDeffence _debuffToDeffenceBuff; + + private IEnumerator HealingEffectCoroutine(int instanceID, float delay, float healingRate, FieGameCharacter targetCharacter) + { + if (targetCharacter != null) + { + targetCharacter.damageSystem.Regen((targetCharacter.healthStats.maxHitPoint + targetCharacter.healthStats.maxShield) * healingRate); + } + yield return (object)new WaitForSeconds(delay); + /*Error: Unable to find new state assignment for yield return*/; + } + + public void Awake() + { + _initScale = base.transform.localScale; + } + + public override void awakeEmitObject() + { + _healRoutine = new Dictionary(); + base.transform.localScale = _initScale; + Vector3 vector = Vector3.one; + Vector3 one = Vector3.one; + float num = ForceFieldDuration; + float forceFieldDuration = ForceFieldDuration; + float num2 = 0f; + float num3 = 1f; + bool flag = false; + bool flag2 = false; + _debuffToDeffenceBuff = base.gameObject.GetComponent(); + if (_debuffToDeffenceBuff != null) + { + _debuffToDeffenceBuff.isActive = false; + } + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV2_1); + if (skill != null) + { + vector += one * skill.Value1; + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV3_2); + if (skill2 != null) + { + vector += one * skill2.Value1; + } + GDESkillTreeData skill3 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV1_2); + if (skill3 != null) + { + num += forceFieldDuration * skill3.Value1; + } + GDESkillTreeData skill4 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV2_2); + if (skill4 != null) + { + num += forceFieldDuration * skill4.Value1; + } + GDESkillTreeData skill5 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV4_HEALING_BUBBLE); + if (skill5 != null) + { + num2 += skill5.Value1; + num3 += skill5.Value2; + flag = true; + } + else + { + GDESkillTreeData skill6 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_MAGIC_BUBBLE_LV4_DISRUPTOR_BUBBLE); + if (skill6 != null) + { + if (_debuffToDeffenceBuff == null) + { + _debuffToDeffenceBuff = base.gameObject.AddComponent(); + } + _debuffToDeffenceBuff.isActive = true; + _debuffToDeffenceBuff.duration = base.HitInterval; + _debuffToDeffenceBuff.magni = 0f - skill6.Value1; + _debuffToDeffenceBuff.skillID = skill6.ID; + _debuffToDeffenceBuff.isEnableStack = true; + flag2 = true; + } + } + } + _sphereScaleTweener.InitTweener(ForceFieldScaleAnimationDuration, _initScale, vector); + _currentDuration = Mathf.Max(1f, num); + _healingRate = num2; + _healingDelay = num3; + _emissiveMaterial = _sphereObject.GetComponent().material; + _normalMaterial = _normalSphereObject.GetComponent().material; + _emissiveMaterial.SetFloat("_Brightness", 1f); + _emissiveMaterial.SetTexture("_Gradient_Color", flag ? healingSphereTexture : ((!flag2) ? defaultSphereTexture : disruptorSphereTexture)); + _normalMaterial.SetColor(0, Color.white); + } + + public void Update() + { + if (_isEndUpdate) + { + float num = _sphereDeathTweener.UpdateParameterFloat(Time.deltaTime); + if (_emissiveMaterial != null) + { + _emissiveMaterial.SetFloat("_Brightness", num); + } + if (_normalMaterial != null) + { + _normalMaterial.SetColor(0, new Color(num, num, num, num)); + } + } + else + { + base.transform.localScale = _sphereScaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= _currentDuration - ForceFieldDestroyDuration) + { + destoryEmitObject(ForceFieldDestroyDuration); + _sphereDeathTweener.InitTweener(ForceFieldDestroyDuration, 1f, 0f); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate) + { + FieEmittableObjectBase component = collider.GetComponent(); + if (component != null && reflectEmitObject(component)) + { + Vector3 vector = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector2 = vector - _forceFieldCenterTransform.position; + FieEmitObjectTwilightForceFieldReflectEffect fieEmitObjectTwilightForceFieldReflectEffect = FieManagerBehaviour.I.EmitObject(base.transform, vector2.normalized); + if (fieEmitObjectTwilightForceFieldReflectEffect != null) + { + fieEmitObjectTwilightForceFieldReflectEffect.transform.position = vector; + } + } + FieCollider component2 = collider.gameObject.GetComponent(); + if (!(component2 == null) && component2.isRoot) + { + FieGameCharacter parentGameCharacter = component2.getParentGameCharacter(); + if (!(parentGameCharacter == null)) + { + } + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate) + { + if (collider.gameObject.tag == getHostileTagString() && _healingRate <= 0f) + { + FieDamage defaultDamageObject = getDefaultDamageObject(); + float num = damageCurvePerLifeRatio.Evaluate(_lifeTimeCount / (_currentDuration - ForceFieldDestroyDuration)); + defaultDamageObject.damage *= num; + defaultDamageObject.stagger *= num; + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, defaultDamageObject); + } + else if (collider.gameObject.tag == getAllyTagString()) + { + FieCollider component = collider.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (!(parentGameCharacter == null)) + { + int instanceID = parentGameCharacter.GetInstanceID(); + _healRoutine.TryGetValue(instanceID, out Coroutine value); + if (value == null) + { + value = StartCoroutine(HealingEffectCoroutine(instanceID, _healingDelay, _healingRate, parentGameCharacter)); + _healRoutine.Add(instanceID, value); + } + } + } + } + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldReflectEffect.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldReflectEffect.cs new file mode 100644 index 0000000..6e27239 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightForceFieldReflectEffect.cs @@ -0,0 +1,18 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightForceFieldReflectEffect")] + public class FieEmitObjectTwilightForceFieldReflectEffect : FieEmittableObjectBase + { + [SerializeField] + private float reflectEffectDuration = 0.6f; + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + destoryEmitObject(reflectEffectDuration); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectMiddle.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectMiddle.cs new file mode 100644 index 0000000..63aa04d --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectMiddle.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightHitEffectMiddle")] + public class FieEmitObjectTwilightHitEffectMiddle : FieEmittableObjectBase + { + private const float DURATION = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSemiMiddle.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSemiMiddle.cs new file mode 100644 index 0000000..57f95f9 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSemiMiddle.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightHitEffectSemiMiddle")] + public class FieEmitObjectTwilightHitEffectSemiMiddle : FieEmittableObjectBase + { + private const float DURATION = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSmall.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSmall.cs new file mode 100644 index 0000000..b4b519f --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightHitEffectSmall.cs @@ -0,0 +1,15 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightHitEffectSmall")] + public class FieEmitObjectTwilightHitEffectSmall : FieEmittableObjectBase + { + private const float DURATION = 1f; + + public override void awakeEmitObject() + { + destoryEmitObject(1f); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaser.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaser.cs new file mode 100644 index 0000000..e726f79 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaser.cs @@ -0,0 +1,133 @@ +using Fie.Manager; +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightLaser")] + public class FieEmitObjectTwilightLaser : FieEmittableObjectBase + { + [SerializeField] + private float LaserDuration = 4f; + + [SerializeField] + private float LaserEmitDuration = 2f; + + [SerializeField] + private int LaserEmitNum = 17; + + [SerializeField] + private float LaserEmitInterval = 0.1f; + + [SerializeField] + private AnimationCurve OutputCurve; + + [SerializeField] + private List _childParticles = new List(); + + [SerializeField] + private GameObject _collisionObject; + + private float _lifeTimeCount; + + private float _emitTimeCount; + + private int _emitCount; + + private bool _isEndUpdate; + + private bool _isEndEmit; + + public void Awake() + { + _emitTimeCount = LaserEmitInterval; + } + + public override void awakeEmitObject() + { + base.transform.rotation = Quaternion.LookRotation(directionalVec); + foreach (PlaygroundParticlesC childParticle in _childParticles) + { + childParticle.Emit(setEmission: true); + } + if (targetTransform != null) + { + Vector3 forward = targetTransform.position - base.transform.position; + float t = Mathf.Clamp(Vector3.Dot(directionalVec.normalized, forward.normalized), 0f, 1f); + base.transform.rotation = Quaternion.Slerp(base.transform.rotation, Quaternion.LookRotation(forward), t); + directionalVec = base.transform.rotation * Vector3.forward; + } + } + + public void Update() + { + base.transform.position = initTransform.position; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + _emitTimeCount += Time.deltaTime; + if (_emitTimeCount >= LaserEmitInterval && _lifeTimeCount <= LaserEmitDuration) + { + emitChild(); + _emitTimeCount = 0f; + } + if (_lifeTimeCount > LaserEmitDuration && !_isEndEmit) + { + foreach (PlaygroundParticlesC childParticle in _childParticles) + { + childParticle.Emit(setEmission: false); + } + _isEndEmit = true; + } + if (_lifeTimeCount >= LaserDuration) + { + destoryEmitObject(); + } + if (_collisionObject != null) + { + float currentOutput = getCurrentOutput(); + _collisionObject.transform.localScale = new Vector3(Mathf.Max(1f, 1f * currentOutput), Mathf.Max(1f, 1f * currentOutput), 1f); + } + } + } + + public float getLaserDuration() + { + return LaserEmitDuration; + } + + private void emitChild() + { + FieEmitObjectTwilightLaserChild fieEmitObjectTwilightLaserChild = FieManagerBehaviour.I.EmitObject(base.transform, directionalVec, targetTransform, base.ownerCharacter); + if (fieEmitObjectTwilightLaserChild != null) + { + fieEmitObjectTwilightLaserChild.SetOutputRate(getCurrentOutput()); + } + _emitCount++; + } + + public float getCurrentOutput() + { + return OutputCurve.Evaluate(Mathf.Clamp(_lifeTimeCount / Mathf.Max(LaserEmitDuration, 0.01f), 0f, 1f)); + } + + private void OnTriggerStay(Collider collider) + { + if (!(_lifeTimeCount >= LaserEmitDuration) && collider.gameObject.tag == getHostileTagString()) + { + float currentOutput = getCurrentOutput(); + FieDamage defaultDamageObject = getDefaultDamageObject(); + defaultDamageObject.damage *= currentOutput; + defaultDamageObject.stagger *= currentOutput; + addDamageToCollisionCharacter(collider, defaultDamageObject); + } + } + + internal void Stop() + { + _lifeTimeCount = LaserEmitDuration; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserChild.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserChild.cs new file mode 100644 index 0000000..492422f --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserChild.cs @@ -0,0 +1,69 @@ +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightLaserChild")] + public class FieEmitObjectTwilightLaserChild : FieEmittableObjectBase + { + [SerializeField] + private float LaserChildDuration = 0.3f; + + [SerializeField] + private float LaserChildMaxScale = 1.2f; + + private Tweener _startScaleTweener = new Tweener(); + + private Tweener _endScaleTweener = new Tweener(); + + private float _outputRate = 1f; + + private float _lifeTimeCount; + + private float _laserWidthRate = 1f; + + public override void awakeEmitObject() + { + _startScaleTweener.InitTweener(LaserChildDuration * 0.5f, 0f, LaserChildMaxScale); + _endScaleTweener.InitTweener(LaserChildDuration * 0.5f, LaserChildMaxScale, 0f); + base.transform.rotation = Quaternion.LookRotation(directionalVec); + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SPARKLY_CANNON_LV4__DEFFENSIVE_CANNON); + if (skill != null) + { + defaultDamage += baseDamage * skill.Value2; + } + GDESkillTreeData skill2 = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SPARKLY_CANNON_LV2_2); + if (skill2 != null) + { + _laserWidthRate += skill2.Value1; + } + } + } + + public void SetOutputRate(float outputRate) + { + _outputRate = outputRate; + } + + public void Update() + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount > LaserChildDuration) + { + destoryEmitObject(); + } + float num = 0f; + num = (_startScaleTweener.IsEnd() ? _endScaleTweener.UpdateParameterFloat(Time.deltaTime) : _startScaleTweener.UpdateParameterFloat(Time.deltaTime)); + num *= _laserWidthRate; + base.transform.localScale = new Vector3(num * _outputRate, num * _outputRate, 0.2f); + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserDust.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserDust.cs new file mode 100644 index 0000000..4c6ce1c --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightLaserDust.cs @@ -0,0 +1,60 @@ +using Fie.Object; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightLaserDust")] + public class FieEmitObjectTwilightLaserDust : FieEmittableObjectBase + { + [SerializeField] + private float DustDuration = 3f; + + [SerializeField] + private float DustEmitDuration = 1.8f; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTime; + + private bool _isEndUpdate; + + public void setDuration(float duration) + { + DustEmitDuration = duration; + } + + public override void awakeEmitObject() + { + foreach (PlaygroundParticlesC childParticle in _childParticles) + { + childParticle.Emit(setEmission: true); + } + } + + private void Update() + { + if (!_isEndUpdate) + { + base.transform.position = initTransform.position; + _lifeTime += Time.deltaTime; + if (_lifeTime > DustEmitDuration) + { + foreach (PlaygroundParticlesC childParticle in _childParticles) + { + childParticle.Emit(setEmission: false); + } + _isEndUpdate = true; + destoryEmitObject(DustDuration - _lifeTime); + } + } + } + + internal void Stop() + { + _lifeTime = DustEmitDuration; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightShinyArrow.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightShinyArrow.cs new file mode 100644 index 0000000..1094938 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightShinyArrow.cs @@ -0,0 +1,154 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightShinyArrow")] + public class FieEmitObjectTwilightShinyArrow : FieEmittableObjectBase + { + [SerializeField] + private float shinyArrowDuration = 1f; + + [SerializeField] + private float ShinyArrowVelocityMax = 4f; + + [SerializeField] + private float ShinyArrowAccelTime = 0.1f; + + [SerializeField] + private float ShinyArrowPysicalForce = 5f; + + [SerializeField] + private float ShinyArrowDestroyDuration = 0.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private FieOnetimeLight shotLight; + + [SerializeField] + private PKFxFX trail; + + private const float HORMING_DISTANCE_MAX = 5f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _minDistance = 3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isInitializedHormingVector; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + trail.StopEffect(); + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(ShinyArrowAccelTime, 0f, ShinyArrowVelocityMax); + _scaleTweener.InitTweener(ShinyArrowAccelTime, Vector3.zero, Vector3.one); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized + directionalVec * 4f; + _initDirectionalVec.Normalize(); + } + effectModel.transform.localScale = _initEffectModelScale; + trail.StopEffect(); + trail.StartEffect(); + base.emitObjectType = EmitObjectType.RANGED_ATTACK_REFLECTIVE; + if (base.ownerCharacter != null && base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV4_AGRESSIVE_CASTING) != null) + { + base.emitObjectType = EmitObjectType.RANGED_ATTACK; + } + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 initDirectionalVec = _initDirectionalVec; + if (targetTransform != null) + { + float num = Vector3.Distance(targetTransform.position, base.transform.position); + float d = 1f; + Vector3 vector = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + float num2 = Vector3.Dot(initDirectionalVec, vector); + if (num2 < 0.5f) + { + d = 0f; + } + initDirectionalVec *= 0.2f; + initDirectionalVec += vector * d; + initDirectionalVec.Normalize(); + if (!_isInitializedHormingVector) + { + directionalVec = initDirectionalVec; + _isInitializedHormingVector = true; + } + } + Vector3 vector2 = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector2 * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= shinyArrowDuration) + { + trail.StopEffect(); + destoryEmitObject(ShinyArrowDestroyDuration); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector2); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (collider.gameObject.tag == getHostileTagString()) + { + FieManagerBehaviour.I.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_MIDDLE); + } + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce((directionalVec + Vector3.up).normalized * ShinyArrowPysicalForce, 0f, useRound: false); + } + trail.StopEffect(); + shotLight.Kill(); + effectModel.transform.localScale = Vector3.zero; + destoryEmitObject(shinyArrowDuration - _lifeTimeCount); + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSpellEffect.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSpellEffect.cs new file mode 100644 index 0000000..05a5c1b --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSpellEffect.cs @@ -0,0 +1,19 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightSpellEffect")] + public class FieEmitObjectTwilightSpellEffect : FieEmittableObjectBase + { + private const float duration = 2f; + + public override void awakeEmitObject() + { + destoryEmitObject(2f); + } + + private void Update() + { + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightStunningSummonArrowChild.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightStunningSummonArrowChild.cs new file mode 100644 index 0000000..5d0bdb5 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightStunningSummonArrowChild.cs @@ -0,0 +1,168 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightStunningSummonArrowChild")] + public class FieEmitObjectTwilightStunningSummonArrowChild : FieEmittableObjectBase + { + [SerializeField] + private float SummonArrowChildDuration = 1.5f; + + [SerializeField] + private float SummonArrowVelocityMax = 2f; + + [SerializeField] + private float SummonArrowVelocityAccelTime = 0.3f; + + [SerializeField] + private float SummonArrowDestroyDuration = 0.7f; + + [SerializeField] + private float SummonArrowTiltDuration = 0.5f; + + [SerializeField] + private float HormingDuration = 1.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PKFxFX trail; + + private const float RANDOM_TILT_DISTANCE = 2f; + + private const float HORMING_DISTANCE_MAX = 10f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _randomTiltVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private bool _isInitRandomTilt; + + private float _totalMoveDistance; + + private float _initEnemyDistance = -3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isEndHorming; + + private float _initHormingDuration; + + private Vector3 _initEffectModelScale = Vector3.zero; + + private Vector3 _latestDirectionalVec = Vector3.zero; + + public int childId; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + trail.StopEffect(); + } + + public override void awakeEmitObject() + { + trail.StopEffect(); + trail.StartEffect(); + _velocityTweener.InitTweener(SummonArrowVelocityAccelTime, 0f, SummonArrowVelocityMax); + _tiltForceTweener.InitTweener(SummonArrowTiltDuration, 1f, 0f); + effectModel.transform.localScale = _initEffectModelScale; + _latestDirectionalVec = (directionalVec = new Vector3((float)Random.Range(-1, 1), (float)Random.Range(-1, 1), (float)Random.Range(-1, 1))); + } + + public void Update() + { + if (!_isEndUpdate) + { + if (!_isInitRandomTilt) + { + initRandomTilt(); + } + if (directionalVec != _latestDirectionalVec) + { + _lastDirectionalVec = (_latestDirectionalVec = directionalVec); + } + float num = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + Vector3 a = directionalVec * (1f - num); + Vector3 b = _randomTiltVec * num; + a += b; + a.Normalize(); + if (base.ownerCharacter != null) + { + targetTransform = base.ownerCharacter.detector.getLockonEnemyTransform(isCenter: true); + } + if (targetTransform != null) + { + if (_initEnemyDistance <= 0f) + { + _initEnemyDistance = Vector3.Distance(base.transform.position, targetTransform.position); + } + Vector3 a2 = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + a *= num; + a += a2 * (1f - num); + a.Normalize(); + a = (_lastDirectionalVec = Vector3.Lerp(a, _lastDirectionalVec, Mathf.Clamp(_lifeTimeCount / HormingDuration, 0f, 1f))); + } + Vector3 vector = a * _velocityTweener.UpdateParameterFloat(Time.deltaTime) * Time.deltaTime; + _totalMoveDistance += Vector3.Distance(base.transform.position, base.transform.position + vector); + base.transform.position += vector; + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= SummonArrowChildDuration) + { + destoryEmitObject(SummonArrowDestroyDuration); + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + if (vector != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + } + + private void initRandomTilt() + { + Vector3 a = base.transform.position + directionalVec * 2f; + Vector3 a2 = Quaternion.AngleAxis(Random.Range(0f, 360f), directionalVec) * Vector3.up; + a2 *= 2f; + a += a2 * 2f; + _randomTiltVec = Quaternion.LookRotation(a - base.transform.position) * Vector3.forward; + _randomTiltVec.Normalize(); + _isInitRandomTilt = true; + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + trail.StopEffect(); + destoryEmitObject(SummonArrowDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrow.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrow.cs new file mode 100644 index 0000000..c690ff9 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrow.cs @@ -0,0 +1,128 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using ParticlePlayground; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightSummonArrow")] + public class FieEmitObjectTwilightSummonArrow : FieEmittableObjectBase + { + [SerializeField] + private float SummonArrowDuration = 1.5f; + + [SerializeField] + private float SummonArrowEmitDuration = 1f; + + [SerializeField] + private int SummonArrowEmitNum = 10; + + [SerializeField] + private float SummonArrowEmitInterval = 0.1f; + + [SerializeField] + private FieDetector _emitPointDetector; + + [SerializeField] + private List _childParticles = new List(); + + private float _lifeTimeCount; + + private float _emitTimeCount; + + private float _emitInterval; + + private int _emitCount; + + private bool _isEndUpdate; + + private bool _isEndEmit; + + public override void awakeEmitObject() + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: true); + }); + _emitPointDetector.Initialize(); + if (base.ownerCharacter != null) + { + GDESkillTreeData skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SUMMON_ARROW_LV1_2); + if (skill != null) + { + SummonArrowEmitNum += (int)skill.Value1; + } + else + { + skill = base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SUMMON_ARROW_LV3_2); + if (skill != null) + { + SummonArrowEmitNum += (int)skill.Value1; + } + } + } + SummonArrowEmitInterval = SummonArrowDuration / (float)SummonArrowEmitNum; + _emitTimeCount = SummonArrowEmitInterval; + } + + public void Update() + { + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + _emitTimeCount += Time.deltaTime; + if (_emitTimeCount >= SummonArrowEmitInterval && _emitCount < SummonArrowEmitNum) + { + FieManagerBehaviour.I.RequestLobbyOnlyActivity(base.ownerCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_ABILITY_2), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_ABILITY_2)); + emitChild(); + _emitTimeCount = 0f; + } + if (_lifeTimeCount > SummonArrowEmitDuration && !_isEndEmit) + { + _childParticles.ForEach(delegate(PlaygroundParticlesC particle) + { + particle.Emit(setEmission: false); + }); + _isEndEmit = true; + } + if (_lifeTimeCount >= SummonArrowDuration) + { + destoryEmitObject(); + } + } + } + + private void emitChild() + { + Transform transform = null; + Vector3 directionalVec = base.directionalVec; + if (_emitPointDetector != null) + { + transform = _emitPointDetector.getRandomEnemyTransform(isCenter: true); + if (transform != null) + { + directionalVec = Quaternion.LookRotation(transform.position - base.transform.position) * Vector3.forward; + } + } + if (base.ownerCharacter != null && base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SUMMON_ARROW_LV4_STUNNING_ARROW) != null) + { + FieEmitObjectTwilightStunningSummonArrowChild fieEmitObjectTwilightStunningSummonArrowChild = FieManagerBehaviour.I.EmitObject(base.transform, directionalVec, transform, base.ownerCharacter); + if (fieEmitObjectTwilightStunningSummonArrowChild != null) + { + fieEmitObjectTwilightStunningSummonArrowChild.childId = _emitCount; + } + } + else + { + FieEmitObjectTwilightSummonArrowChild fieEmitObjectTwilightSummonArrowChild = FieManagerBehaviour.I.EmitObject(base.transform, directionalVec, transform, base.ownerCharacter); + if (fieEmitObjectTwilightSummonArrowChild != null) + { + fieEmitObjectTwilightSummonArrowChild.childId = _emitCount; + } + } + _emitCount++; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrowChild.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrowChild.cs new file mode 100644 index 0000000..ab79878 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonArrowChild.cs @@ -0,0 +1,168 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightSummonArrowChild")] + public class FieEmitObjectTwilightSummonArrowChild : FieEmittableObjectBase + { + [SerializeField] + private float SummonArrowChildDuration = 1.5f; + + [SerializeField] + private float SummonArrowVelocityMax = 2f; + + [SerializeField] + private float SummonArrowVelocityAccelTime = 0.3f; + + [SerializeField] + private float SummonArrowDestroyDuration = 0.7f; + + [SerializeField] + private float SummonArrowTiltDuration = 0.5f; + + [SerializeField] + private float HormingDuration = 1.5f; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PKFxFX trail; + + private const float RANDOM_TILT_DISTANCE = 2f; + + private const float HORMING_DISTANCE_MAX = 10f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _randomTiltVec = Vector3.zero; + + private Vector3 _lastDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private bool _isInitRandomTilt; + + private float _totalMoveDistance; + + private float _initEnemyDistance = -3.40282347E+38f; + + private bool _isEndUpdate; + + private bool _isEndHorming; + + private float _initHormingDuration; + + private Vector3 _initEffectModelScale = Vector3.zero; + + private Vector3 _latestDirectionalVec = Vector3.zero; + + public int childId; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + trail.StopEffect(); + } + + public override void awakeEmitObject() + { + trail.StopEffect(); + trail.StartEffect(); + _velocityTweener.InitTweener(SummonArrowVelocityAccelTime, 0f, SummonArrowVelocityMax); + _tiltForceTweener.InitTweener(SummonArrowTiltDuration, 1f, 0f); + effectModel.transform.localScale = _initEffectModelScale; + _latestDirectionalVec = (directionalVec = new Vector3((float)Random.Range(-1, 1), (float)Random.Range(-1, 1), (float)Random.Range(-1, 1))); + } + + public void Update() + { + if (!_isEndUpdate) + { + if (!_isInitRandomTilt) + { + initRandomTilt(); + } + if (directionalVec != _latestDirectionalVec) + { + _lastDirectionalVec = (_latestDirectionalVec = directionalVec); + } + float num = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + Vector3 a = directionalVec * (1f - num); + Vector3 b = _randomTiltVec * num; + a += b; + a.Normalize(); + if (base.ownerCharacter != null) + { + targetTransform = base.ownerCharacter.detector.getLockonEnemyTransform(isCenter: true); + } + if (targetTransform != null) + { + if (_initEnemyDistance <= 0f) + { + _initEnemyDistance = Vector3.Distance(base.transform.position, targetTransform.position); + } + Vector3 a2 = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + a *= num; + a += a2 * (1f - num); + a.Normalize(); + a = (_lastDirectionalVec = Vector3.Lerp(a, _lastDirectionalVec, Mathf.Clamp(_lifeTimeCount / HormingDuration, 0f, 1f))); + } + Vector3 vector = a * _velocityTweener.UpdateParameterFloat(Time.deltaTime) * Time.deltaTime; + _totalMoveDistance += Vector3.Distance(base.transform.position, base.transform.position + vector); + base.transform.position += vector; + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= SummonArrowChildDuration) + { + destoryEmitObject(SummonArrowDestroyDuration); + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + if (vector != Vector3.zero) + { + base.transform.rotation = Quaternion.LookRotation(vector); + } + } + } + + private void initRandomTilt() + { + Vector3 a = base.transform.position + directionalVec * 2f; + Vector3 a2 = Quaternion.AngleAxis(Random.Range(0f, 360f), directionalVec) * Vector3.up; + a2 *= 2f; + a += a2 * 2f; + _randomTiltVec = Quaternion.LookRotation(a - base.transform.position) * Vector3.forward; + _randomTiltVec.Normalize(); + _isInitRandomTilt = true; + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + trail.StopEffect(); + destoryEmitObject(SummonArrowDestroyDuration); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrap.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrap.cs new file mode 100644 index 0000000..375b484 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrap.cs @@ -0,0 +1,54 @@ +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwiilghtSummonTrapExplosion")] + public class FieEmitObjectTwilightSummonTrap : FieEmittableObjectBase + { + [SerializeField] + private float ExplodeDuration = 0.5f; + + [SerializeField] + private float ExplodeWarmup = 0.5f; + + [SerializeField] + private float ExplodeDestroyDuration = 1f; + + [SerializeField] + private float ExplodePysicalForce = 1f; + + private bool _isEndUpdate; + + private float _lifeCount; + + private void Update() + { + if (!_isEndUpdate) + { + _lifeCount += Time.deltaTime; + if (_lifeCount > ExplodeDuration) + { + destoryEmitObject(ExplodeDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!_isEndUpdate && !(_lifeCount > ExplodeDuration + ExplodeWarmup) && !(_lifeCount < ExplodeWarmup) && collider.gameObject.tag == getHostileTagString()) + { + FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + if (fieGameCharacter != null) + { + Vector3 a = collider.ClosestPointOnBounds(base.transform.position); + Vector3 vector = a - base.transform.position; + vector = new Vector3(vector.x, 0f, vector.z).normalized; + fieGameCharacter.resetMoveForce(); + fieGameCharacter.setMoveForce(vector * ExplodePysicalForce, 0f, useRound: false); + } + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrapEntity.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrapEntity.cs new file mode 100644 index 0000000..52b7347 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightSummonTrapEntity.cs @@ -0,0 +1,74 @@ +using Fie.Manager; +using Fie.Object; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwiilghtSummonTrapEntity")] + public class FieEmitObjectTwilightSummonTrapEntity : FieEmittableObjectBase + { + [SerializeField] + private float TrapEntityDuration = 20f; + + [SerializeField] + private float TrapEntityDestroyDuration = 1f; + + [SerializeField] + private PKFxFX EntityEffect; + + private float _lifeTimeCount; + + private bool _isEndUpdate; + + public override void awakeEmitObject() + { + if (initTransform != null) + { + base.transform.position = initTransform.position; + } + if (EntityEffect != null) + { + EntityEffect.StopEffect(); + EntityEffect.StartEffect(); + } + } + + public void Update() + { + base.transform.localRotation = Quaternion.identity; + if (!_isEndUpdate) + { + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= TrapEntityDuration - TrapEntityDestroyDuration) + { + if (EntityEffect != null) + { + EntityEffect.StopEffect(); + } + destoryEmitObject(TrapEntityDestroyDuration); + _isEndUpdate = true; + } + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && !(_lifeTimeCount > TrapEntityDuration - TrapEntityDestroyDuration) && collider.gameObject.tag == getHostileTagString()) + { + Explode(); + if (EntityEffect != null) + { + EntityEffect.StopEffect(); + } + destoryEmitObject(TrapEntityDestroyDuration); + _isEndUpdate = true; + } + } + + private void Explode() + { + Transform targetTransform = null; + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, targetTransform, base.ownerCharacter); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieEmitObjectTwilightTwinkleArrow.cs b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightTwinkleArrow.cs new file mode 100644 index 0000000..aac5a1e --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieEmitObjectTwilightTwinkleArrow.cs @@ -0,0 +1,160 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/Power/TwilightTwinkleArrow")] + public class FieEmitObjectTwilightTwinkleArrow : FieEmittableObjectBase + { + [SerializeField] + private float BaseShotDuration = 1.5f; + + [SerializeField] + private float BaseShotVelocityMax = 2.5f; + + [SerializeField] + private float BaseShotVelocityAccelTime = 0.1f; + + [SerializeField] + private float BaseShotDestroyDuration = 0.7f; + + [SerializeField] + private Light light; + + [SerializeField] + private GameObject effectModel; + + [SerializeField] + private PKFxFX trail; + + private const float HORMING_DISTANCE_MAX = 1f; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _scaleTweener = new Tweener(); + + private Vector3 _velocityVec = Vector3.zero; + + private Vector3 _scale = Vector3.zero; + + private Vector3 _additionalVelocity = Vector3.zero; + + private Vector3 _initDirectionalVec = Vector3.zero; + + private float _lifeTimeCount; + + private float _defualtLightIntensity; + + private bool _isEndUpdate; + + private bool _isInitializedHormingVector; + + private Vector3 _initEffectModelScale = Vector3.zero; + + public void Awake() + { + _initEffectModelScale = effectModel.transform.localScale; + effectModel.transform.localScale = _initEffectModelScale; + if (light != null) + { + _defualtLightIntensity = light.intensity; + } + trail.StopEffect(); + } + + public override void awakeEmitObject() + { + _velocityTweener.InitTweener(BaseShotVelocityAccelTime, 0f, BaseShotVelocityMax); + _scaleTweener.InitTweener(BaseShotVelocityAccelTime, Vector3.zero, Vector3.one); + trail.StopEffect(); + trail.StartEffect(); + _initDirectionalVec = directionalVec; + if (targetTransform != null) + { + _initDirectionalVec = (targetTransform.position - base.transform.position).normalized + directionalVec * 4f; + _initDirectionalVec.Normalize(); + } + if (light != null) + { + light.intensity = _defualtLightIntensity; + } + if (effectModel != null) + { + effectModel.transform.localScale = _initEffectModelScale; + } + base.emitObjectType = EmitObjectType.RANGED_ATTACK_REFLECTIVE; + if (base.ownerCharacter != null && base.ownerCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV4_AGRESSIVE_CASTING) != null) + { + base.emitObjectType = EmitObjectType.RANGED_ATTACK; + } + } + + public void setAdditionalVelocity(Vector3 additionalVelocity) + { + _additionalVelocity = additionalVelocity; + } + + public void Update() + { + if (!_isEndUpdate) + { + Vector3 directionalVec = base.directionalVec; + if (targetTransform != null) + { + float num = Vector3.Distance(targetTransform.position, base.transform.position); + float num2 = num / 1f; + Vector3 vector = Quaternion.LookRotation(targetTransform.position - base.transform.position) * Vector3.forward; + float num3 = Mathf.Max(Vector3.Dot(directionalVec, vector), 0f); + num2 *= num3 * 0.5f; + vector.z *= 1.2f; + directionalVec += vector * num2; + directionalVec.Normalize(); + if (!_isInitializedHormingVector) + { + base.directionalVec = directionalVec; + _isInitializedHormingVector = true; + } + } + Vector3 vector2 = base.directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position += vector2 * Time.deltaTime; + base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime); + _lifeTimeCount += Time.deltaTime; + if (_lifeTimeCount >= BaseShotDuration) + { + destoryEmitObject(BaseShotDestroyDuration); + trail.StopEffect(); + _isEndUpdate = true; + } + base.transform.rotation = Quaternion.LookRotation(vector2); + } + } + + private void OnTriggerEnter(Collider collider) + { + if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor")) + { + FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero); + if (collider.gameObject.tag == getHostileTagString()) + { + FieManagerBehaviour.I.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_SMALL); + } + addDamageToCollisionCharacter(collider, getDefaultDamageObject()); + destoryEmitObject(BaseShotDestroyDuration); + light.intensity = 0f; + trail.StopEffect(); + effectModel.transform.localScale = Vector3.zero; + _isEndUpdate = true; + } + } + + private void OnDisable() + { + if (trail != null) + { + trail.StopEffect(); + } + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightAttackIdle.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightAttackIdle.cs new file mode 100644 index 0000000..162de7e --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightAttackIdle.cs @@ -0,0 +1,51 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightAttackIdle : FieStateMachineGameCharacterBase + { + private Type _nextState; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!(fieTwilight == null) && fieTwilight.baseAttackChargedForce > 0f) + { + _nextState = typeof(FieStateMachineTwilightBaseShotActivator); + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineTwilightBaseShotCharging)); + list.Add(typeof(FieStateMachineTwilightForceField)); + list.Add(typeof(FieStateMachineTwilightSparklyCannon)); + list.Add(typeof(FieStateMachineTwilightSummonArrow)); + return list; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotActivator.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotActivator.cs new file mode 100644 index 0000000..d46784f --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotActivator.cs @@ -0,0 +1,80 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightBaseShotActivator : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineTwilightAttackIdle); + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!(fieTwilight == null)) + { + if (fieTwilight.baseAttackChargedForce <= 0f) + { + _isEnd = true; + } + else if (FieTwilight.ignoreAttackState.Contains(fieTwilight.getStateMachine().nowStateType())) + { + _isEnd = true; + } + else + { + _nextState = typeof(FieStateMachineTwilightBaseShotLevel1); + int chargedCount = fieTwilight.chargedCount; + if (chargedCount >= 2) + { + _nextState = typeof(FieStateMachineTwilightBaseShotLevel3); + } + else if (chargedCount == 1) + { + _nextState = typeof(FieStateMachineTwilightBaseShotLevel2); + } + _isEnd = true; + fieTwilight.baseAttackChargedForce = 0f; + } + } + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FieTwilight x = gameCharacter as FieTwilight; + if (!(x == null)) + { + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineTwilightAttackIdle)); + list.Add(typeof(FieStateMachineTwilightBaseShotLevel1)); + list.Add(typeof(FieStateMachineTwilightBaseShotLevel2)); + list.Add(typeof(FieStateMachineTwilightBaseShotLevel3)); + return list; + } + + public override Type getNextState() + { + return _nextState; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotCharging.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotCharging.cs new file mode 100644 index 0000000..2dc612f --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotCharging.cs @@ -0,0 +1,59 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightBaseShotCharging : FieStateMachineGameCharacterBase + { + private const float BASE_SHOT_DELAY = 0.25f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!(fieTwilight == null)) + { + float num = fieTwilight.healthStats.maxShield * (0.1f * fieTwilight.baseAttackConsumeShieldRate); + fieTwilight.baseAttackChargedForce += Time.deltaTime * fieTwilight.baseAttackChargingTimeRate; + fieTwilight.damageSystem.calcShieldDirect((0f - num) * Time.deltaTime); + fieTwilight.damageSystem.setRegenerateDelay(fieTwilight.healthStats.regenerateDelay * 0.2f, roundToBigger: true); + if (fieTwilight.healthStats.shield <= 0f) + { + _isEnd = true; + } + } + } + } + + public override float getDelay() + { + return 0.25f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesAttackIdle)); + list.Add(typeof(FieStateMachineTwilightBaseShotActivator)); + list.Add(typeof(FieStateMachineTwilightForceField)); + list.Add(typeof(FieStateMachineTwilightSparklyCannon)); + list.Add(typeof(FieStateMachineTwilightSummonArrow)); + return list; + } + + public override Type getNextState() + { + return typeof(FieStateMachineTwilightBaseShotActivator); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel1.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel1.cs new file mode 100644 index 0000000..40f3f68 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel1.cs @@ -0,0 +1,58 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightBaseShotLevel1 : FieStateMachineGameCharacterBase + { + private const float BASE_ATTACK_DEFAULT_SHILED_COST = 0.015f; + + private const float BASE_SHOT_DELAY = 0.3f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!(fieTwilight == null)) + { + FieEmitObjectTwilightBaseShot fieEmitObjectTwilightBaseShot = FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, fieTwilight.flipDirectionVector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + if (fieEmitObjectTwilightBaseShot != null) + { + fieEmitObjectTwilightBaseShot.setAdditionalVelocity(fieTwilight.getNowMoveForce() * 0.05f); + } + Type type = fieTwilight.getStateMachine().nowStateType(); + if ((type == typeof(FieStateMachineCommonIdle) || type == typeof(FieStateMachinePoniesIdle) || type == typeof(FieStateMachineTwilightFireSmall) || type == typeof(FieStateMachineTwilightTeleportationEndGround)) && fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + fieTwilight.physicalForce.SetPhysicalForce(fieTwilight.flipDirectionVector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 3000f, 0.1f); + } + fieTwilight.damageSystem.calcShieldDirect((0f - fieTwilight.healthStats.maxShield) * (0.015f * fieTwilight.baseAttackConsumeShieldRate)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_BASE_ATTACK), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_BASE_ATTACK)); + _isEnd = true; + } + } + } + + public override float getDelay() + { + return 0.3f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineTwilightAttackIdle); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel2.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel2.cs new file mode 100644 index 0000000..23ef1ea --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel2.cs @@ -0,0 +1,56 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightBaseShotLevel2 : FieStateMachineGameCharacterBase + { + private const float BASE_ATTACK_DEFAULT_SHILED_COST = 0.05f; + + private const float BASE_SHOT_DELAY = 0.2f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!(fieTwilight == null)) + { + FieEmitObjectTwilightTwinkleArrow fieEmitObjectTwilightTwinkleArrow = FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, fieTwilight.flipDirectionVector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + if (fieEmitObjectTwilightTwinkleArrow != null) + { + fieEmitObjectTwilightTwinkleArrow.setAdditionalVelocity(fieTwilight.getNowMoveForce() * 0.05f); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, Vector3.zero, null); + Type type = fieTwilight.getStateMachine().nowStateType(); + if ((type == typeof(FieStateMachineCommonIdle) || type == typeof(FieStateMachinePoniesIdle) || type == typeof(FieStateMachineTwilightFireSmall) || type == typeof(FieStateMachineTwilightTeleportationEndGround)) && fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + fieTwilight.physicalForce.SetPhysicalForce(fieTwilight.flipDirectionVector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 3000f, 0.1f); + } + _isEnd = true; + } + } + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineTwilightAttackIdle); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel3.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel3.cs new file mode 100644 index 0000000..984affc --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightBaseShotLevel3.cs @@ -0,0 +1,54 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightBaseShotLevel3 : FieStateMachineGameCharacterBase + { + private const float BASE_ATTACK_DEFAULT_SHILED_COST = 0.05f; + + private const float BASE_SHOT_DELAY = 0.2f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineTwilightFireSmall)) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + } + fieTwilight.physicalForce.SetPhysicalForce(fieTwilight.flipDirectionVector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 5000f, 0.5f); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, fieTwilight.flipDirectionVector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, Vector3.zero, null); + fieTwilight.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_ABILITY_1)); + _isEnd = true; + } + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineTwilightAttackIdle); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightFireSmall.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightFireSmall.cs new file mode 100644 index 0000000..e8dfc46 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightFireSmall.cs @@ -0,0 +1,73 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightFireSmall : FieStateMachineGameCharacterBase + { + private enum FireState + { + FIRE_START, + FIRING + } + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 3.40282347E+38f; + + private float _timeCount; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + _timeCount += Time.deltaTime; + FieTwilight fieTwilight = gameCharacter as FieTwilight; + switch (_fireState) + { + case FireState.FIRE_START: + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + int animationId = 23; + TrackEntry trackEntry = fieTwilight.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + _endTime = trackEntry.endTime; + } + } + _fireState = FireState.FIRING; + break; + } + if (_timeCount > _endTime) + { + _isEnd = true; + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineTwilightFlying)); + list.Add(typeof(FieStateMachinePoniesGallop)); + list.Add(typeof(FieStateMachinePoniesMove)); + list.Add(typeof(FieStateMachineTwilightTeleportation)); + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightFlying.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightFlying.cs new file mode 100644 index 0000000..fab1884 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightFlying.cs @@ -0,0 +1,93 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightFlying : FieStateMachineGameCharacterBase + { + private const float DEFAULT_FLYING_POWER = 11f; + + private const float MAX_FLYING_SPEED = 10f; + + private const float FLYING_UPPER_FORCE_DURATION = 3f; + + private const float LANDING_DELAY = 0.2f; + + private float _flyingTime = 3f; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachinePoniesLanding); + _isEnd = true; + } + else + { + if (fieTwilight.animationManager.IsEndAnimation(0)) + { + fieTwilight.animationManager.SetAnimation(20, isLoop: true); + } + Vector3 vector = fieTwilight.externalInputVector; + _flyingTime -= Time.deltaTime; + _flyingTime = Mathf.Max(_flyingTime, 0f); + if (vector.y > 0f) + { + vector.y *= 1f * (_flyingTime / 3f); + } + vector *= 10f * fieTwilight.externalInputForce; + vector.y *= 0.2f; + vector.y += 11f; + fieTwilight.addMoveForce(vector, 1f); + fieTwilight.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 1000f); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.setGravityRate(0.5f); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.setGravityRate(1f); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesEvasion)); + list.Add(typeof(FieStateMachineTwilightTeleportation)); + list.Add(typeof(FieStateMachineTwilightSparklyCannonShooting)); + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightForceField.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightForceField.cs new file mode 100644 index 0000000..ae5a7bc --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightForceField.cs @@ -0,0 +1,78 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FieAbilityID(FieConstValues.FieAbility.MAGIC_BUBBLE)] + public class FieStateMachineTwilightForceField : FieStateMachineAbilityBase + { + private const string FORCE_FIELD_SIGNATURE = "magic_bubble"; + + private const float FORCE_FIELD_DELAY = 0.3f; + + private const float FORCE_FIELD_DEFAULT_COOLDOWN = 60f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!FieTwilight.ignoreAttackState.Contains(fieTwilight.getStateMachine().nowStateType())) + { + Vector3 vector = (fieTwilight.flipState != 0) ? Vector3.right : Vector3.left; + if (fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineTwilightFireSmall)) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + } + fieTwilight.physicalForce.SetPhysicalForce(vector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 5000f, 0.1f); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, vector, null, fieTwilight); + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, Vector3.zero, null); + fieTwilight.SetDialog(100, FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_MAGIC_ABILITY_MAGIC_BUBBLE_1), FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptsList_P_MAGIC_ABILITY_MAGIC_BUBBLE_2)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_ABILITY_3), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_ABILITY_3)); + float cooldown = 60f; + fieTwilight.abilitiesContainer.SetCooldown(cooldown); + _isEnd = true; + } + } + } + + public override float getDelay() + { + return 0.3f; + } + + public override string getSignature() + { + return "magic_bubble"; + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 60f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightJump.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightJump.cs new file mode 100644 index 0000000..88f69d9 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightJump.cs @@ -0,0 +1,116 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightJump : FieStateMachineGameCharacterBase + { + private enum JumpState + { + JUMP_TAKEOFF_START, + JUMP_TAKEOFF_STANDBY, + JUMP_TAKEOFF + } + + private const float TAKEOFF_FORCE = 6f; + + private const float TAKEOFF_PAST_TIME = 0.5f; + + private JumpState _jumpState; + + private float _takeoffTime; + + private float _flyingTime; + + private float _landingCount; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight twilight = gameCharacter as FieTwilight; + if (_jumpState == JumpState.JUMP_TAKEOFF_START) + { + if (twilight.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachineTwilightFlying); + _isEnd = true; + return; + } + TrackEntry trackEntry = twilight.animationManager.SetAnimation(19); + _jumpState = JumpState.JUMP_TAKEOFF_STANDBY; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.name == "takeOff") + { + Vector3 vector = twilight.externalInputVector; + vector += Vector3.up; + vector.x *= 0.1f; + vector.Normalize(); + vector *= 6f; + twilight.setMoveForce(vector, 0.5f); + _jumpState = JumpState.JUMP_TAKEOFF; + } + else if (e.Data.name == "finished") + { + _nextState = typeof(FieStateMachineTwilightFlying); + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _nextState = typeof(FieStateMachineTwilightFlying); + _isEnd = true; + }; + } + } + twilight.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 1000f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + gameCharacter.setGravityRate(0.5f); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableGravity = true; + gameCharacter.setGravityRate(1f); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesEvasion)); + list.Add(typeof(FieStateMachineTwilightTeleportation)); + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightShinyArrow.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightShinyArrow.cs new file mode 100644 index 0000000..64911af --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightShinyArrow.cs @@ -0,0 +1,69 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightShinyArrow : FieStateMachineGameCharacterBase + { + private const string SHINY_ARROW_SIGNATURE = "shiny_arrow"; + + private const float SHINY_ARROW_DELAY = 0.3f; + + private const float SHINY_ARROW_DEFAULT_COOLDOWN = 8f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!FieTwilight.ignoreAttackState.Contains(fieTwilight.getStateMachine().nowStateType())) + { + Vector3 vector = (fieTwilight.flipState != 0) ? Vector3.right : Vector3.left; + if (fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineTwilightFireSmall)) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + } + fieTwilight.physicalForce.SetPhysicalForce(vector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 5000f, 0.5f); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, vector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, Vector3.zero, null); + fieTwilight.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_ABILITY_1)); + _isEnd = true; + } + } + } + + public override float getDelay() + { + return 0.3f; + } + + public string getSignature() + { + return "shiny_arrow"; + } + + private void emitShot() + { + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachinePoniesAttackIdle); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannon.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannon.cs new file mode 100644 index 0000000..062ecd8 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannon.cs @@ -0,0 +1,66 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies.Twilight +{ + [FieAbilityID(FieConstValues.FieAbility.SPARKLY_CANNON)] + public class FieStateMachineTwilightSparklyCannon : FieStateMachineAbilityBase + { + private const string SPARKLY_CANNON_SIGNATURE = "sparkly_cannon"; + + public const float SPARKLY_CANNON_DEFAULT_COOLDOWN = 15f; + + private Type _nextState = typeof(FieStateMachinePoniesAttackIdle); + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (!_isEnd && gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_ABILITY_1), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_ABILITY_1)); + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightSparklyCannonShooting), isForceSet: false); + _isEnd = true; + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 15f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override string getSignature() + { + return "sparkly_cannon"; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + + public override bool isNotNetworkSync() + { + return true; + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannonShooting.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannonShooting.cs new file mode 100644 index 0000000..a3e0d39 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSparklyCannonShooting.cs @@ -0,0 +1,218 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightSparklyCannonShooting : FieStateMachineGameCharacterBase + { + private enum FireState + { + FIRE_START, + FIRING + } + + private const string SPARKLY_CANNON_SIGNATURE = "shiny_arrow"; + + private const float SPARKLY_CANNON_DEFAULT_DURATION = 2f; + + private const float GROUND_FORCE_TIME = 1.5f; + + private const float GROUND_FORCE = 1.5f; + + private const float SHIELD_CONSUMING_INTERVAL = 0.5f; + + private const float SHIELD_CONSUME_PERCENT = 0.04f; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private FireState _fireState; + + private bool _isEnd; + + private float _endTime = 2f; + + private float _maxEmittionTime; + + private float _timeCount; + + private bool _isSetEndAnim; + + private float _shieldConsumingInterval = 0.5f; + + private float _damegeTakenRate = 1f; + + private float _damageReducionEffectDuration; + + private bool _isDeffensive; + + private bool _isUnstoppable; + + private FieEmitObjectTwilightLaser _laserObject; + + private FieEmitObjectTwilightLaserDust _dustObject; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + _timeCount += Time.deltaTime; + FieTwilight fieTwilight = gameCharacter as FieTwilight; + switch (_fireState) + { + case FireState.FIRE_START: + fieTwilight.animationManager.SetAnimation(28, isLoop: false, isForceSet: true); + _laserObject = FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, fieTwilight.flipDirectionVector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + if (_laserObject != null) + { + _maxEmittionTime = (_endTime = _laserObject.getLaserDuration()); + } + else + { + _maxEmittionTime = (_endTime = 2f); + } + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.addMoveForce(fieTwilight.flipDirectionVector * -100f, 1f, useRound: false); + fieTwilight.animationManager.SetAnimationChain(25, 26, isLoop: true, isForceSet: true); + _dustObject = FieManagerBehaviour.I.EmitObject(fieTwilight.transform, Vector3.up, null, fieTwilight); + if (_dustObject != null) + { + _dustObject.setDuration(_endTime); + } + } + else + { + fieTwilight.animationManager.SetAnimation(20, isLoop: true, isForceSet: true); + fieTwilight.addMoveForce(fieTwilight.flipDirectionVector * -50f, 1f, useRound: false); + _nextState = typeof(FieStateMachineTwilightFlying); + fieTwilight.isEnableGravity = false; + } + _fireState = FireState.FIRING; + fieTwilight.resetMoveForce(); + break; + case FireState.FIRING: + if (!_isDeffensive) + { + _shieldConsumingInterval -= Time.deltaTime; + if (_shieldConsumingInterval <= 0f) + { + fieTwilight.damageSystem.calcShieldDirect((0f - fieTwilight.healthStats.maxShield) * 0.04f); + fieTwilight.damageSystem.setRegenerateDelay(fieTwilight.healthStats.regenerateDelay * 0.5f, roundToBigger: true); + _shieldConsumingInterval = 0.5f; + } + } + break; + } + if (_timeCount > _endTime) + { + if (!_isSetEndAnim) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.animationManager.SetAnimation(27); + } + TrackEntry trackEntry = fieTwilight.animationManager.SetAnimation(29, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + _endTime += trackEntry.endTime; + } + _isSetEndAnim = true; + } + else + { + _isEnd = true; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.emotionController.StopAutoAnimation(); + gameCharacter.isEnableAutoFlip = false; + if (gameCharacter != null) + { + GDESkillTreeData skill = gameCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SPARKLY_CANNON_LV4__DEFFENSIVE_CANNON); + if (skill != null) + { + _damegeTakenRate = skill.Value1; + _damageReducionEffectDuration = skill.Value2; + gameCharacter.damageSystem.beforeDamageEvent += this.HealthSystem_beforeDamageEvent; + _isDeffensive = true; + } + else + { + GDESkillTreeData skill2 = gameCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_SPARKLY_CANNON_LV4_UNSTOPPABLE_CANNON); + if (skill2 != null) + { + _isUnstoppable = true; + } + } + } + } + } + + private void HealthSystem_beforeDamageEvent(FieGameCharacter attacker, ref FieDamage damage) + { + damage.damage *= _damegeTakenRate; + damage.stagger *= _damegeTakenRate; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.emotionController.RestartAutoAnimation(); + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableAutoFlip = true; + gameCharacter.isEnableGravity = true; + gameCharacter.isSpeakable = true; + float num = Mathf.Min(3f, Mathf.Max(0.05f, _timeCount / Mathf.Max(0.1f, _maxEmittionTime))); + if (_dustObject != null) + { + _dustObject.Stop(); + } + if (_laserObject != null) + { + num = Mathf.Clamp(_timeCount / Mathf.Max(1f, _endTime), 0f, 1f); + _laserObject.Stop(); + } + gameCharacter.abilitiesContainer.SetCooldown(15f * num); + if (_isDeffensive) + { + gameCharacter.damageSystem.AddDefenceMagni(7, Mathf.Max(0f, 1f - _damegeTakenRate), _damageReducionEffectDuration); + } + gameCharacter.damageSystem.beforeDamageEvent -= this.HealthSystem_beforeDamageEvent; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (!_isUnstoppable) + { + list.Add(typeof(FieStateMachinePoniesEvasion)); + list.Add(typeof(FieStateMachineTwilightTeleportation)); + list.Add(typeof(FieStateMachineTwilightJump)); + } + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightSummonArrow.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSummonArrow.cs new file mode 100644 index 0000000..717fbd0 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightSummonArrow.cs @@ -0,0 +1,86 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FieAbilityID(FieConstValues.FieAbility.SUMMON_ARROW)] + public class FieStateMachineTwilightSummonArrow : FieStateMachineAbilityBase + { + private const string SUMMON_ARROW_SIGNATURE = "summon_arrow"; + + private const float SUMMON_ARROW_DELAY = 0.3f; + + private const float SUMMON_ARROW_DEFAULT_COOLDOWN = 24f; + + private bool _isEnd; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + if (!FieTwilight.ignoreAttackState.Contains(fieTwilight.getStateMachine().nowStateType())) + { + Vector3 vector = (fieTwilight.flipState != 0) ? Vector3.right : Vector3.left; + if (fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineCommonIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachinePoniesIdle) || fieTwilight.getStateMachine().nowStateType() == typeof(FieStateMachineTwilightFireSmall)) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + fieTwilight.getStateMachine().setState(typeof(FieStateMachineTwilightFireSmall), isForceSet: true, isDupulicate: true); + } + fieTwilight.physicalForce.SetPhysicalForce(vector * -1f + Vector3.up * FieRandom.Range(-0.2f, 0.2f), 500f, 0.1f); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, vector, fieTwilight.detector.getLockonEnemyTransform(isCenter: true), fieTwilight); + if (fieTwilight.GetSkill(FieConstValues.FieSkill.MAGIC_SUMMON_ARROW_LV4_SUMMON_TRAP) != null) + { + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, vector, null, fieTwilight); + } + FieManagerBehaviour.I.EmitObject(fieTwilight.hornTransform, Vector3.zero, null); + fieTwilight.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_USED_ABILITY)); + float num = 24f; + GDESkillTreeData skill = fieTwilight.GetSkill(FieConstValues.FieSkill.MAGIC_SUMMON_ARROW_LV4_SUMMON_TRAP); + if (skill != null) + { + num *= skill.Value1; + } + fieTwilight.abilitiesContainer.SetCooldown(24f); + _isEnd = true; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + defaultCoolDown = 24f; + } + + public override float getDelay() + { + return 0.3f; + } + + public override string getSignature() + { + return "summon_arrow"; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return null; + } + + public override FieAbilityActivationType getActivationType() + { + return FieAbilityActivationType.COOLDOWN; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportation.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportation.cs new file mode 100644 index 0000000..681df26 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportation.cs @@ -0,0 +1,179 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using System; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightTeleportation : FieStateMachineGameCharacterBase + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_STANDBY, + TELEPORTATION, + TELEPORTATION_END + } + + private const float TELEPORT_DEFAULT_SHILED_COST = 0.03f; + + private const float TELEPORT_DELAY = 0.2f; + + private const float TELEPORT_DURATION = 0.5f; + + private const float TELEPORT_DISTANCE = 3f; + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private Type _nextState; + + private Vector3 _teleportNormalVec = Vector3.zero; + + private Vector3 _teleportTargetPos = Vector3.zero; + + private FieObjectGroundState _startGroundState; + + private Tweener _teleportTweener = new Tweener(); + + private float _consumeShield; + + private float _reduceCooldownTime; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + _teleportNormalVec = fieTwilight.externalInputVector.normalized; + _teleportNormalVec.y *= 0.5f; + if (fieTwilight.groundState == FieObjectGroundState.Grounding && _teleportNormalVec.y <= 0f) + { + _teleportNormalVec.y = 0f; + _teleportNormalVec.Normalize(); + } + if (_teleportNormalVec == Vector3.zero) + { + if (fieTwilight.flipState == FieObjectFlipState.Left) + { + _teleportNormalVec = Vector3.left; + } + else + { + _teleportNormalVec = Vector3.right; + } + } + _teleportTargetPos = fieTwilight.position + _teleportNormalVec * 3f; + int layerMask = 262656; + if (Physics.Raycast(fieTwilight.centerTransform.position, _teleportNormalVec, out RaycastHit hitInfo, 3f, layerMask)) + { + _teleportTargetPos = hitInfo.point; + if (Physics.Raycast(hitInfo.point, Vector3.down, out hitInfo, 0.75f, layerMask)) + { + _teleportTargetPos = hitInfo.point; + } + } + fieTwilight.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_EVADED), 25); + FieManagerBehaviour.I.RequestLobbyOnlyActivity(gameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_EVADE), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_EVADE)); + fieTwilight.isEnableCollider = false; + _teleportTweener.InitTweener(0.5f, fieTwilight.position, _teleportTargetPos); + _startGroundState = fieTwilight.groundState; + _teleportationState = TeleportationState.TELEPORTATION; + break; + } + case TeleportationState.TELEPORTATION: + { + Vector3 vector2 = fieTwilight.position = _teleportTweener.UpdateParameterVec3(Time.deltaTime); + fieTwilight.setFlipByVector(fieTwilight.externalInputVector.normalized); + if (_teleportTweener.IsEnd()) + { + fieTwilight.damageSystem.calcShieldDirect(0f - _consumeShield); + fieTwilight.damageSystem.setRegenerateDelay(fieTwilight.healthStats.regenerateDelay * 0.75f, roundToBigger: true); + if (_reduceCooldownTime < 0f) + { + fieTwilight.abilitiesContainer.IncreaseOrReduceCooldownAll(_reduceCooldownTime); + } + fieTwilight.isEnableCollider = true; + _teleportationState = TeleportationState.TELEPORTATION_END; + _isEnd = true; + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + if (_startGroundState == FieObjectGroundState.Flying) + { + fieTwilight.animationManager.SetAnimation(4); + } + _nextState = typeof(FieStateMachineCommonIdle); + } + else + { + _nextState = typeof(FieStateMachineTwilightTeleportationEndAir); + } + if (fieTwilight.GetSkill(FieConstValues.FieSkill.MAGIC_DIFFENCE_PASSIVE_LV4_EXPLOSIVE_TELEPORTATION) != null) + { + FieManagerBehaviour.I.EmitObject(fieTwilight.centerTransform, Vector3.zero, null, fieTwilight); + } + } + break; + } + } + fieTwilight.physicalForce.SetPhysicalForce(gameCharacter.getNowMoveForce() * -1f, 500f); + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (gameCharacter != null) + { + _consumeShield = gameCharacter.healthStats.maxShield * 0.03f; + float consumeShield = _consumeShield; + GDESkillTreeData skill = gameCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_DIFFENCE_PASSIVE_LV2_1); + if (skill != null) + { + _consumeShield += consumeShield * skill.Value1; + } + GDESkillTreeData skill2 = gameCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_DIFFENCE_PASSIVE_LV4_EXPLOSIVE_TELEPORTATION); + if (skill2 != null) + { + _consumeShield += consumeShield * skill2.Value1; + } + GDESkillTreeData skill3 = gameCharacter.GetSkill(FieConstValues.FieSkill.MAGIC_DIFFENCE_PASSIVE_LV4_CONCENTRATIVE_TELEPORTATION); + if (skill3 != null) + { + _reduceCooldownTime -= skill3.Value1; + _consumeShield += consumeShield * skill3.Value2; + } + } + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.transform.localRotation = Quaternion.identity; + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableCollider = true; + } + + public override float getDelay() + { + return 0.2f; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndAir.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndAir.cs new file mode 100644 index 0000000..214cc6c --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndAir.cs @@ -0,0 +1,109 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightTeleportationEndAir : FieStateMachineGameCharacterBase + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_END + } + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private bool _isFinished; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + TrackEntry trackEntry = fieTwilight.animationManager.SetAnimation(21, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _nextState = typeof(FieStateMachineTwilightFlying); + _isFinished = true; + } + }; + trackEntry.End += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + Vector3 externalInputVector = fieTwilight.externalInputVector; + fieTwilight.setFlipByVector(externalInputVector); + _teleportationState = TeleportationState.TELEPORTATION_END; + break; + } + } + if (_isEnd) + { + if (fieTwilight.groundState == FieObjectGroundState.Grounding) + { + _nextState = typeof(FieStateMachineCommonIdle); + } + else + { + _nextState = typeof(FieStateMachineTwilightFlying); + } + } + else if (_isFinished && fieTwilight.externalInputForce > 0.5f && fieTwilight.groundState != 0) + { + _nextState = typeof(FieStateMachineTwilightFlying); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableGravity = false; + } + + public override void terminate(FieGameCharacter gameCharacter) + { + gameCharacter.isEnableGravity = true; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineTwilightTeleportation)); + list.Add(typeof(FieStateMachineTwilightFlying)); + } + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndGround.cs b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndGround.cs new file mode 100644 index 0000000..94cae54 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieStateMachineTwilightTeleportationEndGround.cs @@ -0,0 +1,92 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieStateMachineTwilightTeleportationEndGround : FieStateMachineGameCharacterBase + { + private enum TeleportationState + { + TELEPORTATION_START, + TELEPORTATION_END + } + + private TeleportationState _teleportationState; + + private bool _isEnd; + + private bool _isFinished; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FieTwilight) + { + FieTwilight fieTwilight = gameCharacter as FieTwilight; + switch (_teleportationState) + { + case TeleportationState.TELEPORTATION_START: + { + TrackEntry trackEntry = fieTwilight.animationManager.SetAnimation(27, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry.End += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _teleportationState = TeleportationState.TELEPORTATION_END; + Vector3 externalInputVector = fieTwilight.externalInputVector; + fieTwilight.setFlipByVector(externalInputVector); + if (fieTwilight.externalInputForce > 0.1f) + { + fieTwilight.addMoveForce(fieTwilight.flipDirectionVector.normalized * 10000f, 1f); + } + break; + } + } + if (_isEnd) + { + _nextState = typeof(FieStateMachineCommonIdle); + } + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + if (_isFinished) + { + list.Add(typeof(FieStateMachineTwilightTeleportation)); + list.Add(typeof(FieStateMachinePoniesMove)); + list.Add(typeof(FieStateMachineTwilightFlying)); + } + return list; + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieTwilight.cs b/src/Fie.Ponies.Twilight/FieTwilight.cs new file mode 100644 index 0000000..83a528a --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieTwilight.cs @@ -0,0 +1,216 @@ +using Fie.AI; +using Fie.Manager; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.UI; +using GameDataEditor; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + [FiePrefabInfo("Prefabs/Twilight/TwilightSparkle")] + public class FieTwilight : FiePonies, FiePlayableGameCharacterInterface + { + public const float TWILIGHT_BASE_SHOT_CHARGE_DURATION_PER_SEGMENT = 0.8f; + + public const float TWILIGHT_BASE_SHOT_SHIELD_COST_FOR_CHARGNING_PER_SEC = 0.1f; + + public const int TWILIGHT_BASE_SHOT_DEFAULT_MAXIMUM_CHARGE_COUNT = 2; + + private int _maximumCharge = 2; + + private int _currentBaseAttackChargedCount; + + public float baseAttackChargedForce; + + public float baseAttackConsumeShieldRate = 1f; + + public float baseAttackChargingTimeRate = 1f; + + private static List _ignoreAttackState = new List + { + typeof(FieStateMachineTwilightTeleportation), + typeof(FieStateMachineTwilightSparklyCannonShooting), + typeof(FieStateMachinePoniesStagger), + typeof(FieStateMachinePoniesStaggerFall), + typeof(FieStateMachinePoniesStaggerFallRecover), + typeof(FieStateMachinePoniesDead), + typeof(FieStateMachinePoniesRevive), + typeof(FieStateMachinePoniesGrabbed) + }; + + public int chargedCount + { + get + { + if (Mathf.FloorToInt(baseAttackChargedForce / 3.2f) > 0) + { + return 2; + } + if (Mathf.FloorToInt(baseAttackChargedForce / 0.8f) > 0) + { + return 1; + } + return 0; + } + } + + public static List ignoreAttackState => _ignoreAttackState; + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachineTwilightBaseShotCharging); + } + + public override Type getStormState() + { + return typeof(FieStateMachineTwilightTeleportation); + } + + protected new void Awake() + { + base.Awake(); + base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieTwilightAnimationContainer()); + _staggerCancelableStateList.Add(typeof(FieStateMachineTwilightTeleportation)); + abstractStateList.Add(typeof(FieStateMachinePoniesJump), typeof(FieStateMachineTwilightJump)); + abstractStateList.Add(typeof(FieStateMachinePoniesEvasion), typeof(FieStateMachineTwilightTeleportation)); + abstractStateList.Add(typeof(FieStateMachinePoniesBaseAttack), typeof(FieStateMachineTwilightBaseShotCharging)); + abstractStateList.Add(typeof(FieStateMachinePoniesAttackIdle), typeof(FieStateMachineTwilightBaseShotActivator)); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_1, new FieStateMachineTwilightSparklyCannon()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_2, new FieStateMachineTwilightSummonArrow()); + base.abilitiesContainer.AssignAbility(FieAbilitiesSlot.SlotType.SLOT_3, new FieStateMachineTwilightForceField()); + syncBindedAbilities(); + SetStateActivateCheckCallback(TeleportationActivateCheck); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + base.detector.intoTheBattleEvent += Detector_intoTheBattleEvent; + } + + private void Detector_intoTheBattleEvent(FieGameCharacter targetCharacter) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ENEMY_DETECTED)); + } + + private bool TeleportationActivateCheck() + { + if (healthStats.shield <= 0f) + { + return false; + } + return true; + } + + protected new void Start() + { + base.Start(); + getStateMachine(StateMachineType.Attack).setState(typeof(FieStateMachinePoniesAttackIdle), isForceSet: true); + getStateMachine().setState(typeof(FieStateMachineCommonIdle), isForceSet: false); + ReCalcSkillData(); + } + + protected override void ReCalcSkillData() + { + baseAttackConsumeShieldRate = 1f; + baseAttackChargingTimeRate = 1f; + GDESkillTreeData skill = GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV1_2); + if (skill != null) + { + baseAttackConsumeShieldRate += skill.Value1; + } + GDESkillTreeData skill2 = GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV4_AGRESSIVE_CASTING); + if (skill2 != null) + { + baseAttackConsumeShieldRate += skill2.Value1; + } + GDESkillTreeData skill3 = GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV4_SMART_CASTING); + if (skill3 != null) + { + baseAttackChargingTimeRate *= skill3.Value1; + baseAttackConsumeShieldRate += skill3.Value2; + } + GDESkillTreeData skill4 = GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV2_1); + if (skill4 != null) + { + baseAttackChargingTimeRate *= 1f + skill4.Value1; + } + GDESkillTreeData skill5 = GetSkill(FieConstValues.FieSkill.MAGIC_ATTACK_PASSIVE_LV3_2); + if (skill5 != null) + { + baseAttackChargingTimeRate *= 1f + skill5.Value1; + } + } + + public new void Update() + { + base.Update(); + int chargedCount = this.chargedCount; + if (_currentBaseAttackChargedCount != chargedCount) + { + if (chargedCount > _currentBaseAttackChargedCount) + { + FieManagerBehaviour.I.EmitObject(base.hornTransform, Vector3.zero, null); + } + _currentBaseAttackChargedCount = chargedCount; + } + } + + public override void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) + { + base.OnPhotonSerializeView(stream, info); + if (stream.isWriting) + { + stream.SendNext(baseAttackChargedForce); + } + else + { + baseAttackChargedForce = (float)stream.ReceiveNext(); + } + } + + public override string getDefaultName() + { + return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ELEMENT_NAME_MAGIC_SIMPLE); + } + + public override Type getDefaultAITask() + { + return typeof(FieAITaskTwilightIdle); + } + + public override FieConstValues.FieGameCharacter getGameCharacterID() + { + return FieConstValues.FieGameCharacter.MAGIC; + } + + public override KeyValuePair getAbilitiesIconInfo() + { + return new KeyValuePair(typeof(FieGameUIAbilitiesIconTwilight), "Prefabs/UI/AbilitiesIcons/TwilightAbilityIcon"); + } + + public override GDEGameCharacterTypeData getCharacterTypeData() + { + return FieMasterData.I.GetMasterData(GDEItemKeys.GameCharacterType_MAGIC); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieTwilightAnimationContainer.cs b/src/Fie.Ponies.Twilight/FieTwilightAnimationContainer.cs new file mode 100644 index 0000000..ff7cdfd --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieTwilightAnimationContainer.cs @@ -0,0 +1,39 @@ +using Fie.Object; + +namespace Fie.Ponies.Twilight +{ + public class FieTwilightAnimationContainer : FiePoniesAnimationContainer + { + public enum TwilightAnimationList + { + JUMP_TAKEOFF = 19, + JUMP, + TELEPORTATION_AIR, + TELEPORTATION_GROUND, + FIRE_SMALL, + FIRE_SMALL2, + FIRE_LARGE, + FIRE_LARGE_IDLE, + FIRE_LARGE_END, + EMOTION_FIRE_LARGE, + EMOTION_FIRE_LARGE_END, + HORN_SHINE, + MAX_TWILIGHT_ANIMATION + } + + public FieTwilightAnimationContainer() + { + addAnimationData(19, new FieSkeletonAnimationObject(0, "jump")); + addAnimationData(20, new FieSkeletonAnimationObject(0, "jump_idle")); + addAnimationData(21, new FieSkeletonAnimationObject(0, "teleportation_air")); + addAnimationData(22, new FieSkeletonAnimationObject(0, "teleportation_ground")); + addAnimationData(23, new FieSkeletonAnimationObject(0, "fire_small")); + addAnimationData(25, new FieSkeletonAnimationObject(0, "fire_large")); + addAnimationData(26, new FieSkeletonAnimationObject(0, "fire_large_idle")); + addAnimationData(27, new FieSkeletonAnimationObject(0, "fire_large_end")); + addAnimationData(28, new FieSkeletonAnimationObject(1, "emotion_fire_large")); + addAnimationData(29, new FieSkeletonAnimationObject(1, "emotion_fire_large_end")); + addAnimationData(30, new FieSkeletonAnimationObject(2, "horn_shine")); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieTwilightBigLaserUvOffset.cs b/src/Fie.Ponies.Twilight/FieTwilightBigLaserUvOffset.cs new file mode 100644 index 0000000..f0c8dc5 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieTwilightBigLaserUvOffset.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieTwilightBigLaserUvOffset : MonoBehaviour + { + private float _offsetX; + + private void Update() + { + _offsetX -= 1.5f * Time.deltaTime; + GetComponent().material.SetVector("_texUV", new Vector4(_offsetX, 0f, 0f, 0f)); + base.transform.Rotate(new Vector3(1f, 0f, 0f)); + } + } +} diff --git a/src/Fie.Ponies.Twilight/FieTwilightForceFieldUvOffset.cs b/src/Fie.Ponies.Twilight/FieTwilightForceFieldUvOffset.cs new file mode 100644 index 0000000..a530017 --- /dev/null +++ b/src/Fie.Ponies.Twilight/FieTwilightForceFieldUvOffset.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace Fie.Ponies.Twilight +{ + public class FieTwilightForceFieldUvOffset : MonoBehaviour + { + private float _offsetX; + + private void Update() + { + _offsetX += 0.4f * Time.deltaTime; + GetComponent().material.SetTextureOffset("_Gradient_Edge_Fake", new Vector2(_offsetX, 0.65f)); + } + } +} diff --git a/src/Fie.Ponies/FiePonies.cs b/src/Fie.Ponies/FiePonies.cs new file mode 100644 index 0000000..86caf49 --- /dev/null +++ b/src/Fie.Ponies/FiePonies.cs @@ -0,0 +1,632 @@ +using Fie.Core; +using Fie.Manager; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.Scene; +using Fie.UI; +using Fie.Utility; +using GameDataEditor; +using Spine; +using Spine.Unity; +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Fie.Ponies +{ + public abstract class FiePonies : FieGameCharacter + { + public enum RaceType + { + EarthPony = 1, + Unicorn = 2, + Pegasus = 4, + Alicorn = 8, + Other = 0x10 + } + + public const string PONIES_ANIMATION_TAKEOFF_EVENT_NAME = "takeOff"; + + public const int PONIES_DEFAULT_FRIENDSHIP_POINT = 2; + + public const int FRIENDSHIP_COST_FOR_REVIVING_ISSELF = 3; + + public const int FRIENDSHIP_COST_FOR_REVIVING_ANYONE = 2; + + public const float LOST_SECONDRY_HP_DIALG_SEND_INTERVAL = 3f; + + public const float PRIMARY_HP_LESS_THAN_HALF_INTERVAL = 5f; + + public const float STANDARD_ATTACK_CHARGE_1_THRESHOLD = 0.5f; + + public const float STANDARD_ATTACK_CHARGE_2_THRESHOLD = 2.5f; + + public const float STANDARD_ATTACK_CHARGE_3_THRESHOLD = 4.5f; + + public const float FRIENDSHIP_ADD_RATE_FOR_OTHER_PLAYER = 0.5f; + + public const float FRIENDSHIP_SEND_INTERVAL = 0.5f; + + public static readonly Color PONIES_DEFAULT_COLOR = new Color(0.65f, 0.65f, 0.65f, 1f); + + public static readonly Color PONIES_INVISIBLE_COLOR = new Color(0f, 0f, 0f, 0f); + + [SerializeField] + private RaceType _race = RaceType.EarthPony; + + [SerializeField] + private FieAttribute _shieldType; + + [SerializeField] + private FiePhysicalForce _physicalForce; + + [SerializeField] + private SkeletonUtilityBone _headBone; + + [SerializeField] + private Transform _torsoTransform; + + [SerializeField] + private Transform _leftFrontHoofTransform; + + [SerializeField] + private Transform _rightFrontHoofTransform; + + [SerializeField] + private Transform _leftBackHoofTransform; + + [SerializeField] + private Transform _rightBackHoofTransform; + + [SerializeField] + private Transform _hornTransform; + + [SerializeField] + private Transform _mouthTransform; + + [SerializeField] + private Transform _neckTransform; + + private Transform _headTrackingTransform; + + private bool _isEnableHeadTracking = true; + + private Vector3 _headboneDefaultAngle = Vector3.zero; + + private Tweener _headTrackingTweener = new Tweener(); + + private Dictionary _dialogIntervalTable = new Dictionary(); + + protected List _staggerCancelableStateList = new List(); + + private int _latestFriendshipPoint; + + private float _stackedFriendshipPointForOtherPlayer; + + private float _friendshipPointSendDelay; + + public FiePhysicalForce physicalForce => _physicalForce; + + public Transform torsoTransform => _torsoTransform; + + public Transform leftFrontHoofTransform => _leftFrontHoofTransform; + + public Transform rightFrontHoofTransform => _rightFrontHoofTransform; + + public Transform leftBackHoofTransform => _leftBackHoofTransform; + + public Transform rightBackHoofTransform => _rightBackHoofTransform; + + public Transform hornTransform => _hornTransform; + + public Transform mouthTransform => _mouthTransform; + + public Transform neckTransform => _neckTransform; + + public bool isEnableHeadTracking + { + get + { + return _isEnableHeadTracking; + } + set + { + if (_headBone != null) + { + if (value) + { + _headBone.mode = SkeletonUtilityBone.Mode.Override; + _headBone.flip = false; + _headBone.flipX = false; + _headBone.overrideAlpha = 0f; + if (_headTrackingTweener != null) + { + _headTrackingTweener.InitTweener(0.1f, 0f, 0f); + } + } + else + { + _headBone.mode = SkeletonUtilityBone.Mode.Follow; + _headBone.flip = true; + } + } + _isEnableHeadTracking = value; + } + } + + public override Type getDefaultAttackState() + { + return typeof(FieStateMachinePoniesBaseAttack); + } + + protected override void Awake() + { + base.Awake(); + abstractStateList.Add(typeof(FieStateMachineCommonIdle), typeof(FieStateMachinePoniesIdle)); + healthStats.shieldType = _shieldType; + base.damageSystem.staggerEvent += delegate + { + if (!base.damageSystem.isDying) + { + setStateToStatheMachine(typeof(FieStateMachinePoniesStagger), isForceSet: true, isDupulicate: true); + if (base.gameObject.GetInstanceID() == FieManagerBehaviour.I.gameOwnerCharacter.gameObject.GetInstanceID()) + { + FieManagerBehaviour.I.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_BIG); + } + } + }; + _headboneDefaultAngle = _headBone.transform.localEulerAngles; + base.detector.targetChangedEvent += delegate(FieGameCharacter from, FieGameCharacter to) + { + if (to != null) + { + _headTrackingTransform = to.centerTransform; + } + else + { + _headTrackingTransform = null; + _headTrackingTweener.InitTweener(0.3f, _headBone.overrideAlpha, 0f); + } + }; + base.friendshipStats.friendshipAddEvent += delegate(float friendship) + { + if ((!(base.photonView != null) || base.photonView.isMine) && !(friendship <= 0f)) + { + _stackedFriendshipPointForOtherPlayer += friendship * 0.5f; + } + }; + base.damageSystem.damagedEvent += damageEventCallback; + base.damageSystem.deathEvent += delegate + { + setStateToStatheMachine(typeof(FieStateMachinePoniesDead), isForceSet: true, isDupulicate: false); + }; + base.changeScoreEvent += ChangeScoreClalback; + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_PoniesCommonRift); + base.damageSystem.addStatusEffectCallback(ApplyStatusEffect_PoniesCommonGrab); + FieManagerBehaviour.I.dialogEndEvent += dialogEndEventCallback; + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + PreAssignEmittableObject(); + _headBone.overrideAlpha = 0.5f; + base.friendshipStats.friendship = 60f; + _latestFriendshipPoint = 2; + base.transform.SetParent(FieManagerBehaviour.I.transform); + } + + private void ChangeScoreClalback(int score, bool isDefeater) + { + if (base.ownerUser != null) + { + FieManagerBehaviour.I.AddCurrentGameExp(this, score); + if (score > 0) + { + FieGameUIGainedScore fieGameUIGainedScore = FieManagerBehaviour.I.EmitObject(base.guiPointTransform, Vector3.zero); + if (fieGameUIGainedScore != null) + { + fieGameUIGainedScore.SetScore(score, isDefeater); + } + } + } + } + + private void ApplyStatusEffect_PoniesCommonGrab(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsGrabEntity fieStatusEffectsGrabEntity = statusEffect as FieStatusEffectsGrabEntity; + if (fieStatusEffectsGrabEntity != null) + { + FieStateMachinePoniesGrabbed fieStateMachinePoniesGrabbed = setStateToStatheMachine(typeof(FieStateMachinePoniesGrabbed), isForceSet: true, isDupulicate: true) as FieStateMachinePoniesGrabbed; + } + } + } + } + + private void ApplyStatusEffect_PoniesCommonRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage) + { + if (damage.statusEffects.Count > 0) + { + foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects) + { + FieStatusEffectsRiftEntity fieStatusEffectsRiftEntity = statusEffect as FieStatusEffectsRiftEntity; + if (fieStatusEffectsRiftEntity != null && healthStats.stagger + damage.stagger >= healthStats.staggerResistance) + { + FieStateMachinePoniesRift fieStateMachinePoniesRift = setStateToStatheMachine(typeof(FieStateMachinePoniesRift), isForceSet: true, isDupulicate: true) as FieStateMachinePoniesRift; + if (fieStateMachinePoniesRift != null) + { + fieStateMachinePoniesRift.ResetMoveForce(fieStatusEffectsRiftEntity.resetMoveForce); + fieStateMachinePoniesRift.SetRiftForceRate(fieStatusEffectsRiftEntity.riftForceRate); + } + damage.stagger = 0f; + healthStats.stagger = 0f; + } + } + } + } + + private void damageEventCallback(FieGameCharacter attacker, FieDamage damage) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_TOOK_DAMAGE), 75); + if (healthStats.hitPoint <= healthStats.maxHitPoint * 0.5f && !_dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_PRIMARY_HP_LESS_THAN_HALF]) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_PRIMARY_HP_LESS_THAN_HALF)); + _dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_PRIMARY_HP_LESS_THAN_HALF] = true; + } + else if (healthStats.shield <= 0f && !_dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_LOST_SECONDARY_HP]) + { + SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_LOST_SECONDARY_HP)); + _dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_LOST_SECONDARY_HP] = true; + } + } + + private void dialogEndEventCallback(FieGameCharacter actor, GDEWordScriptsListData dialogData) + { + if (actor != null && actor.GetInstanceID() != GetInstanceID()) + { + if (dialogData.Trigger.Key == GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_DEFEATED) + { + FieManagerBehaviour.I.RequestDialog(this, LotteryWordScriptData(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ALLY_DEFEATED))); + } + else if (dialogData.Trigger.Key == GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ALLY_DEFEAT_ENEMY) + { + FieManagerBehaviour.I.RequestDialog(this, LotteryWordScriptData(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ALLY_DEFEAT_ENEMY))); + } + } + } + + protected override void Start() + { + base.Start(); + base.detector.locatedEvent += Detector_locatedEvent; + base.detector.missedEvent += Detector_missedEvent; + base.emotionController.SetDefaultEmoteAnimationID(15); + base.emotionController.RestoreEmotionFromDefaultData(); + base.animationManager.commonAnimationEvent += AnimationManager_commonAnimationEvent; + if (FieBootstrap.isBootedFromBootStrap && base.photonView != null && !base.photonView.isMine) + { + InitializeIntelligenceSystem(IntelligenceType.Connection); + } + SceneManager.sceneLoaded += delegate + { + if (FieManagerFactory.I.currentSceneType == FieSceneType.INGAME) + { + FieManagerBehaviour.I.RetryEvent += RetryEvent; + } + }; + } + + private void RetryEvent() + { + base.damageSystem.resetHealthSystem(); + if (base.photonView.isMine) + { + getStateMachine().SetStateDynamic(typeof(FieStateMachinePoniesIdle)); + getStateMachine(StateMachineType.Attack).SetStateDynamic(typeof(FieStateMachinePoniesAttackIdle)); + ReduceOrIncreaseScore(-Mathf.RoundToInt((float)base.score * 0.5f), isDefeater: false); + } + isEnableCollider = true; + base.isEnableAutoFlip = true; + base.isEnableGravity = true; + setGravityRate(1f); + isEnableHeadTracking = true; + base.isSpeakable = true; + base.friendshipStats.friendship = 60f; + _latestFriendshipPoint = 2; + base.abilitiesContainer.ResetAllCoolDown(); + } + + private void AnimationManager_commonAnimationEvent(TrackEntry entry) + { + if (entry != null) + { + entry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "footstep" && base.currentFootstepMaterial != null) + { + base.currentFootstepMaterial.playFootstepAudio(base.footstepPlayer); + } + }; + } + } + + private void Detector_missedEvent(FieGameCharacter targetCharacter) + { + if (base.isSpeakable && base.detector.lockonTargetObject == null) + { + base.emotionController.SetDefaultEmoteAnimationID(15); + base.emotionController.RestoreEmotionFromDefaultData(); + } + } + + private void Detector_locatedEvent(FieGameCharacter targetCharacter) + { + if (base.isSpeakable) + { + base.emotionController.SetDefaultEmoteAnimationID(16); + base.emotionController.RestoreEmotionFromDefaultData(); + } + } + + protected override void Update() + { + base.Update(); + if (healthStats.hitPoint >= healthStats.maxHitPoint) + { + _dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_PRIMARY_HP_LESS_THAN_HALF] = false; + } + if (healthStats.shield >= healthStats.maxShield) + { + _dialogIntervalTable[GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_LOST_SECONDARY_HP] = false; + } + int currentFriendshipPoint = base.friendshipStats.getCurrentFriendshipPoint(); + if (currentFriendshipPoint > _latestFriendshipPoint) + { + FieManagerBehaviour.I.EmitObject(base.centerTransform, Vector3.forward).transform.rotation = Quaternion.identity; + } + _latestFriendshipPoint = currentFriendshipPoint; + UpdateHeadTracking(); + UpdateSendingStateOfFriendship(); + } + + private void UpdateSendingStateOfFriendship() + { + if (_friendshipPointSendDelay > 0f) + { + _friendshipPointSendDelay -= Time.deltaTime; + } + else if (_stackedFriendshipPointForOtherPlayer > 0f) + { + FieManagerBehaviour.I.AddFriendshipPointToOtherPlayer(this, _stackedFriendshipPointForOtherPlayer); + _stackedFriendshipPointForOtherPlayer = 0f; + _friendshipPointSendDelay = 0.5f; + } + } + + private void UpdateHeadTracking() + { + if (isEnableHeadTracking) + { + _headBone.overrideAlpha = _headTrackingTweener.UpdateParameterFloat(Time.deltaTime); + if (_headBone.overrideAlpha <= 0f && _headBone.mode == SkeletonUtilityBone.Mode.Override) + { + Transform transform = _headBone.transform; + Vector3 localEulerAngles = _headBone.transform.localEulerAngles; + transform.localEulerAngles = new Vector3(0f, 0f, localEulerAngles.z); + _headBone.mode = SkeletonUtilityBone.Mode.Follow; + } + else if (_headBone.overrideAlpha > 0f && _headBone.mode == SkeletonUtilityBone.Mode.Follow) + { + _headBone.mode = SkeletonUtilityBone.Mode.Override; + } + if (_headTrackingTransform == null) + { + if (_headTrackingTweener.IsEnd()) + { + _headTrackingTweener.InitTweener(0.3f, _headBone.overrideAlpha, 0f); + } + } + else + { + Vector3 vector = _headBone.transform.position - _headTrackingTransform.position; + vector.z = 0f; + vector.Normalize(); + if (base.flipState == FieObjectFlipState.Right) + { + vector *= -1f; + } + Vector3 vector2 = Vector3.Cross(Vector3.up, vector) * -1f; + if (vector2.z > 0.2f) + { + float angle = Vector3.Angle((base.flipState != 0) ? Vector3.up : Vector3.down, vector); + _headBone.transform.rotation = Quaternion.AngleAxis((base.flipState != FieObjectFlipState.Right) ? 0f : 180f, Vector3.up) * Quaternion.AngleAxis(angle, Vector3.forward); + Transform transform2 = _headBone.transform; + Vector3 localEulerAngles2 = _headBone.transform.localEulerAngles; + transform2.localEulerAngles = new Vector3(0f, 0f, localEulerAngles2.z); + if (_headTrackingTweener.IsEnd()) + { + _headTrackingTweener.InitTweener(0.3f, _headBone.overrideAlpha, 0.6f); + } + } + else if (_headTrackingTweener.IsEnd()) + { + _headTrackingTweener.InitTweener(0.3f, _headBone.overrideAlpha, 0f); + } + } + } + } + + public override void RequestToChangeState(Vector3 directionalVec, float force, StateMachineType type) + { + getStateMachine(type).setState(typeof(T), isForceSet: false); + if (type == StateMachineType.Base) + { + base.externalInputVector = directionalVec; + base.externalInputForce = force; + } + } + + public override FieStateMachineInterface getDefaultState(StateMachineType type) + { + if (type == StateMachineType.Base) + { + return new FieStateMachineCommonIdle(); + } + return new FieStateMachinePoniesBaseAttack(); + } + + protected void syncBindedAbilities() + { + Type ability = base.abilitiesContainer.getAbility(FieAbilitiesSlot.SlotType.SLOT_1); + Type ability2 = base.abilitiesContainer.getAbility(FieAbilitiesSlot.SlotType.SLOT_2); + Type ability3 = base.abilitiesContainer.getAbility(FieAbilitiesSlot.SlotType.SLOT_3); + if (ability != null) + { + abstractStateList[typeof(FieStateMachinePoniesAbilitySlot1)] = ability; + } + if (ability != null) + { + abstractStateList[typeof(FieStateMachinePoniesAbilitySlot2)] = ability2; + } + if (ability != null) + { + abstractStateList[typeof(FieStateMachinePoniesAbilitySlot3)] = ability3; + } + } + + public FieStateMachineAbilityInterface getAbilityInstance(FieAbilitiesSlot.SlotType slotType) + { + Type ability = base.abilitiesContainer.getAbility(slotType); + if (ability != null) + { + FieStateMachineAbilityInterface fieStateMachineAbilityInterface = Activator.CreateInstance(ability) as FieStateMachineAbilityInterface; + if (fieStateMachineAbilityInterface != null) + { + return fieStateMachineAbilityInterface; + } + } + return null; + } + + public virtual List getStaggerCancelableStateList() + { + return _staggerCancelableStateList; + } + + public void Revive(FieGameCharacter injured) + { + if (!(injured == null) && injured.damageSystem.isDead) + { + injured.setStateToStatheMachine(typeof(FieStateMachinePoniesRevive), isForceSet: true, isDupulicate: false); + } + } + + public void TryToRevive() + { + if (base.damageSystem.revivable) + { + if (base.friendshipStats.getCurrentFriendshipPoint() >= 3) + { + base.friendshipStats.addFriendshipPoint(-3); + Revive(this); + } + } + else + { + int layerMask = 16640; + RaycastHit[] array = Physics.SphereCastAll(base.centerTransform.position, 1.5f, Vector3.down, 0.5f, layerMask); + if (array != null && array.Length > 0) + { + RaycastHit[] array2 = array; + int num = 0; + FiePonies fiePonies; + while (true) + { + if (num >= array2.Length) + { + return; + } + RaycastHit raycastHit = array2[num]; + FieCollider component = raycastHit.collider.gameObject.GetComponent(); + if (component != null) + { + fiePonies = (component.getParentGameCharacter() as FiePonies); + if (fiePonies != null && fiePonies.damageSystem.revivable) + { + break; + } + } + num++; + } + if (base.friendshipStats.getCurrentFriendshipPoint() >= 2) + { + base.friendshipStats.addFriendshipPoint(-2); + if (fiePonies.photonView == null || fiePonies.photonView.isMine) + { + Revive(fiePonies); + } + else + { + object[] parameters = new object[1] + { + base.photonView.viewID + }; + fiePonies.photonView.RPC("ReviveRPC", PhotonTargets.Others, parameters); + } + } + } + } + } + + [PunRPC] + public void ReviveRPC(int reviverViewID) + { + if (base.photonView.isMine) + { + Revive(this); + } + } + + [PunRPC] + public void AddFriendshipRPC(float friendship) + { + if (!(base.photonView != null) || base.photonView.isMine) + { + base.friendshipStats.safeAddFriendship(friendship, triggerEvent: false); + } + } + + public override void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) + { + base.OnPhotonSerializeView(stream, info); + if (stream.isWriting) + { + stream.SendNext(base.friendshipStats.friendship); + } + else + { + base.friendshipStats.friendship = (float)stream.ReceiveNext(); + } + } + + protected override void initSkillTree() + { + GDEGameCharacterTypeData characterType = getCharacterTypeData(); + List list = FieMasterData.FindMasterDataList(delegate(GDESkillTreeData data) + { + if (characterType.Key != data.GameCharacterType.Key) + { + return false; + } + return true; + }); + } + + public abstract Type getStormState(); + + public abstract KeyValuePair getAbilitiesIconInfo(); + } +} diff --git a/src/Fie.Ponies/FiePoniesAnimationContainer.cs b/src/Fie.Ponies/FiePoniesAnimationContainer.cs new file mode 100644 index 0000000..f19a696 --- /dev/null +++ b/src/Fie.Ponies/FiePoniesAnimationContainer.cs @@ -0,0 +1,59 @@ +using Fie.Object; + +namespace Fie.Ponies +{ + public class FiePoniesAnimationContainer : FieAnimationContainerBase + { + public enum PoniesAnimTrack + { + HORN = 2, + MAX_PONIES_TRACK + } + + public enum PoniesAnimList + { + IDLE_RELAX = 1, + WALK, + GALLOP, + LANDING, + LANDING_SMOOTH, + STAGGER, + STAGGER_AIR, + STAGGER_FALL, + STAGGER_FALL_RECOVER, + ARRIVAL, + DEAD, + DEAD_LOOP, + DEAD_RECOVER, + GRABBED, + EMOTION_NORMAL, + EMOTION_SERIOUS, + EMOTION_DAMAGE, + EMOTION_DEAD, + MAX_PONIES_ANIMATION + } + + public FiePoniesAnimationContainer() + { + addAnimationData(0, new FieSkeletonAnimationObject(0, "idle")); + addAnimationData(1, new FieSkeletonAnimationObject(0, "idle_relax")); + addAnimationData(2, new FieSkeletonAnimationObject(0, "walk")); + addAnimationData(3, new FieSkeletonAnimationObject(0, "gallop")); + addAnimationData(4, new FieSkeletonAnimationObject(0, "landing")); + addAnimationData(5, new FieSkeletonAnimationObject(0, "landing_smooth")); + addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger")); + addAnimationData(7, new FieSkeletonAnimationObject(0, "stagger_air")); + addAnimationData(8, new FieSkeletonAnimationObject(0, "stagger_fall")); + addAnimationData(9, new FieSkeletonAnimationObject(0, "stagger_fall_recover")); + addAnimationData(10, new FieSkeletonAnimationObject(0, "arrival")); + addAnimationData(11, new FieSkeletonAnimationObject(0, "dead")); + addAnimationData(12, new FieSkeletonAnimationObject(0, "dead_loop")); + addAnimationData(13, new FieSkeletonAnimationObject(0, "dead_recover")); + addAnimationData(14, new FieSkeletonAnimationObject(0, "grabbed")); + addAnimationData(15, new FieSkeletonAnimationObject(1, "emotion_normal")); + addAnimationData(16, new FieSkeletonAnimationObject(1, "emotion_serious")); + addAnimationData(17, new FieSkeletonAnimationObject(1, "emotion_damage")); + addAnimationData(18, new FieSkeletonAnimationObject(1, "emotion_dead")); + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot1.cs b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot1.cs new file mode 100644 index 0000000..c8d5ae5 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot1.cs @@ -0,0 +1,24 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesAbilitySlot1 : FieStateMachineGameCharacterBase + { + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return true; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot2.cs b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot2.cs new file mode 100644 index 0000000..148e8d9 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot2.cs @@ -0,0 +1,24 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesAbilitySlot2 : FieStateMachineGameCharacterBase + { + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return true; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot3.cs b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot3.cs new file mode 100644 index 0000000..ec2b909 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesAbilitySlot3.cs @@ -0,0 +1,24 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesAbilitySlot3 : FieStateMachineGameCharacterBase + { + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return true; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesArrival.cs b/src/Fie.Ponies/FieStateMachinePoniesArrival.cs new file mode 100644 index 0000000..16ed4bf --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesArrival.cs @@ -0,0 +1,110 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesArrival : FieStateMachineGameCharacterBase + { + private enum ArrivalfState + { + STATE_START, + STATE_PREPARE, + STATE_END + } + + private const float ARRIVAL_INVISIBLE_DURATION = 1.9f; + + private ArrivalfState _arrivalState; + + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies ponies = gameCharacter as FiePonies; + if (_arrivalState == ArrivalfState.STATE_START) + { + FieEmitObjectPoniesArrival fieEmitObjectPoniesArrival = FieManagerBehaviour.I.EmitObject(ponies.centerTransform, Vector3.zero); + if (fieEmitObjectPoniesArrival == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + fieEmitObjectPoniesArrival.SetSubMeshObject(ponies.gameObject); + TrackEntry trackEntry = ponies.animationManager.SetAnimation(10, isLoop: false, isForceSet: true); + if (trackEntry == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + ponies.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_ARRIVAL)); + ponies.submeshObject.enabled = true; + } + }; + trackEntry.End += delegate + { + ponies.submeshObject.enabled = true; + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + }; + ponies.submeshObject.enabled = false; + _arrivalState = ArrivalfState.STATE_PREPARE; + gameCharacter.setFlip(FieObjectFlipState.Right); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isEnableAutoFlip = false; + fiePonies.emotionController.StopAutoAnimation(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + fiePonies.emotionController.RestartAutoAnimation(); + fiePonies.setGravityRate(1f); + fiePonies.isEnableHeadTracking = true; + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesArrival)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesAttackIdle.cs b/src/Fie.Ponies/FieStateMachinePoniesAttackIdle.cs new file mode 100644 index 0000000..f5cd8cf --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesAttackIdle.cs @@ -0,0 +1,35 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesAttackIdle : FieStateMachineGameCharacterBase + { + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return false; + } + + public override Type getNextState() + { + return null; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + + public override bool isNotNetworkSync() + { + return true; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesBaseAttack.cs b/src/Fie.Ponies/FieStateMachinePoniesBaseAttack.cs new file mode 100644 index 0000000..a1d8769 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesBaseAttack.cs @@ -0,0 +1,28 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesBaseAttack : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + _nextState = gameCharacter.getDefaultAttackState(); + _isEnd = true; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesDead.cs b/src/Fie.Ponies/FieStateMachinePoniesDead.cs new file mode 100644 index 0000000..7432eed --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesDead.cs @@ -0,0 +1,129 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesDead : FieStateMachineGameCharacterBase + { + private enum ArrivalfState + { + STATE_START, + STATE_DEAD_PREPARE, + STATE_DEAD + } + + private const float STAGGER_MOVE_FORCE = 8f; + + private const float ARRIVAL_INVISIBLE_DURATION = 1.9f; + + private ArrivalfState _arrivalState; + + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies ponies = gameCharacter as FiePonies; + switch (_arrivalState) + { + case ArrivalfState.STATE_START: + if (ponies.groundState != 0) + { + ponies.isEnableGravity = false; + ponies.isEnableGravity = true; + gameCharacter.setGravityRate(0.2f); + Vector3 vector = Vector3.Normalize(ponies.centerTransform.position - ponies.latestDamageWorldPoint); + vector.y *= 0.1f; + vector.z = 0f; + vector.Normalize(); + ponies.setFlipByVector(vector * -1f); + ponies.setMoveForce((Vector3.up + vector).normalized * 8f, 1f, useRound: false); + ponies.emotionController.SetDefaultEmoteAnimationID(18); + TrackEntry trackEntry = ponies.animationManager.SetAnimation(8, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + _arrivalState = ArrivalfState.STATE_DEAD_PREPARE; + } + else + { + TrackEntry trackEntry2 = ponies.animationManager.SetAnimation(18, isLoop: false, isForceSet: true); + if (trackEntry2 == null) + { + _nextState = typeof(FieStateMachineCommonIdle); + _isEnd = true; + } + trackEntry2.End += delegate + { + ponies.animationManager.SetAnimation(11, isLoop: false, isForceSet: true); + ponies.isSpeakable = false; + ponies.damageSystem.revivable = true; + }; + ponies.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_DEFEATED)); + ponies.emotionController.SetDefaultEmoteAnimationID(18); + if (gameCharacter.GetInstanceID() != FieManagerBehaviour.I.gameOwnerCharacter.GetInstanceID()) + { + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ANYONE_DEFEATED), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ANYONE_DEFEATED)); + } + else + { + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_MYSELF_DEFEATED), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_MYSELF_DEFEATED)); + } + _arrivalState = ArrivalfState.STATE_DEAD; + } + break; + case ArrivalfState.STATE_DEAD_PREPARE: + if (ponies.groundState == FieObjectGroundState.Grounding) + { + _arrivalState = ArrivalfState.STATE_START; + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isEnableAutoFlip = false; + fiePonies.isEnableCollider = false; + fiePonies.isEnableHeadTracking = false; + fiePonies.UnbindFromDetecter(); + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isSpeakable = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesArrival)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesEvasion.cs b/src/Fie.Ponies/FieStateMachinePoniesEvasion.cs new file mode 100644 index 0000000..63c31aa --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesEvasion.cs @@ -0,0 +1,26 @@ +using Fie.Object; +using System; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesEvasion : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + } + + public override bool isEnd() + { + return true; + } + + public override Type getNextState() + { + return _nextState; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesGallop.cs b/src/Fie.Ponies/FieStateMachinePoniesGallop.cs new file mode 100644 index 0000000..81d6581 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesGallop.cs @@ -0,0 +1,86 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesGallop : FieStateMachineGameCharacterBase + { + private const float MOVE_THRESHOLD = 0.05f; + + private const float WALK_FORCE_THRESHOLD = 0.2f; + + private const float WALK_MOVESPEED_MAGNI = 0.5f; + + private bool _isEnd; + + private Type _nextState; + + private float _physicalSinWave; + + private bool _nowMoving; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + if (gameCharacter.externalInputForce <= 0.3f) + { + _isEnd = true; + _nextState = typeof(FieStateMachinePoniesIdle); + } + else + { + FiePonies fiePonies = gameCharacter as FiePonies; + Vector3 externalInputVector = gameCharacter.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + externalInputVector.y = 0f; + Vector3 velocity = gameCharacter.GetComponent().velocity; + float num = Math.Abs(velocity.x); + float num2 = num / 5f; + float defaultMoveSpeed = gameCharacter.getDefaultMoveSpeed(); + _physicalSinWave += 12.5f * Time.deltaTime; + gameCharacter.animationManager.SetAnimation(3, isLoop: true); + gameCharacter.addMoveForce(externalInputVector * (defaultMoveSpeed * gameCharacter.externalInputForce), 0.4f); + Vector3 normalVec = (gameCharacter.getNowMoveForce().normalized + Vector3.down * (0.65f * Mathf.Sin(_physicalSinWave))) * -1f; + fiePonies.physicalForce.SetPhysicalForce(normalVec, 2000f * num2, 0.5f); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.animationManager.ResetAllAnimationTimescale(); + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesGrabbed.cs b/src/Fie.Ponies/FieStateMachinePoniesGrabbed.cs new file mode 100644 index 0000000..7e18b31 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesGrabbed.cs @@ -0,0 +1,129 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesGrabbed : FieStateMachineGameCharacterBase + { + private enum GrabbedState + { + STATE_PREPARE, + STATE_GRABBED, + STATE_GRABBED_END + } + + private const float MAXIMUM_GRABBED_TIME = 6f; + + private GrabbedState _staggerState; + + private float _totalTime; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private bool _isReleased; + + private Transform _anchorTransform; + + private Transform _anchorCharacterCenterTransform; + + private Quaternion _initialRotation = Quaternion.identity; + + private FieGameCharacter _grabbingCharacter; + + public void SetReleaseState(bool isReleased) + { + _isReleased = isReleased; + } + + public void SetAnchorTransform(Transform anchorTransform, Transform anchorCharacterCenterTransform) + { + _anchorTransform = anchorTransform; + _anchorCharacterCenterTransform = anchorCharacterCenterTransform; + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + _totalTime += Time.deltaTime; + switch (_staggerState) + { + case GrabbedState.STATE_PREPARE: + { + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(14, isLoop: true, isForceSet: true); + _staggerState = GrabbedState.STATE_GRABBED; + break; + } + case GrabbedState.STATE_GRABBED: + if (_anchorTransform != null && _anchorCharacterCenterTransform != null) + { + fiePonies.position = _anchorTransform.position; + fiePonies.transform.rotation = _anchorTransform.rotation; + fiePonies.setFlipByVector((_anchorCharacterCenterTransform.position - fiePonies.transform.position).normalized); + } + if (_isReleased || _totalTime > 6f) + { + _nextState = typeof(FieStateMachinePoniesStagger); + _isEnd = true; + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.StopAutoAnimation(); + fiePonies.isEnableAutoFlip = false; + fiePonies.isEnableCollider = false; + fiePonies.isEnableGravity = false; + fiePonies.isEnableHeadTracking = false; + fiePonies.isSpeakable = false; + fiePonies.resetMoveForce(); + _initialRotation = fiePonies.transform.rotation; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestartAutoAnimation(); + fiePonies.setGravityRate(1f); + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + fiePonies.isEnableCollider = true; + fiePonies.isEnableHeadTracking = true; + fiePonies.isSpeakable = true; + fiePonies.transform.rotation = _initialRotation; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesStagger)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesJump.cs b/src/Fie.Ponies/FieStateMachinePoniesJump.cs new file mode 100644 index 0000000..cc80267 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesJump.cs @@ -0,0 +1,33 @@ +using Fie.Object; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesJump : FieStateMachineGameCharacterBase + { + private bool _isEnd; + + private Type _nextState; + + public override void updateState(ref T gameCharacter) + { + _isEnd = true; + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return new List(); + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesLanding.cs b/src/Fie.Ponies/FieStateMachinePoniesLanding.cs new file mode 100644 index 0000000..5a45c04 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesLanding.cs @@ -0,0 +1,112 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesLanding : FieStateMachineGameCharacterBase + { + public enum LandingState + { + LANDING_START, + LANDING + } + + private const float LANDING_DELAY = 0.5f; + + private bool _isEnd; + + private bool _isFinished; + + private LandingState _landingState; + + private float _landingCount = 0.05f; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + Vector3 a = fiePonies.externalInputVector; + a.y = (a.z = 0f); + switch (_landingState) + { + case LandingState.LANDING_START: + if (fiePonies.groundState == FieObjectGroundState.Grounding) + { + Vector3 externalInputVector = fiePonies.externalInputVector; + fiePonies.addMoveForce(new Vector3(externalInputVector.x * (500f * fiePonies.externalInputForce), 0f, 0f), 0.5f); + _landingCount = 0.5f; + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(4, isLoop: false, isForceSet: true); + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isFinished = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + _landingState = LandingState.LANDING; + } + break; + case LandingState.LANDING: + _landingCount -= Time.deltaTime; + if (_landingCount <= 0f) + { + _isEnd = true; + } + a *= 0.5f; + fiePonies.physicalForce.SetPhysicalForce(Vector3.zero, 0f); + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.setGravityRate(1f); + gameCharacter.isEnableGravity = true; + gameCharacter.isEnableAutoFlip = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return typeof(FieStateMachineCommonIdle); + } + + public override List getAllowedStateList() + { + if (!_isFinished) + { + return new List(); + } + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesMove.cs b/src/Fie.Ponies/FieStateMachinePoniesMove.cs new file mode 100644 index 0000000..8ef501b --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesMove.cs @@ -0,0 +1,90 @@ +using Fie.Object; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesMove : FieStateMachineGameCharacterBase + { + private const float MOVE_THRESHOLD = 0.05f; + + private const float WALK_FORCE_THRESHOLD = 0.2f; + + private const float WALK_MOVESPEED_MAGNI = 0.5f; + + private bool _isEnd; + + private Type _nextState; + + private float _physicalSinWave; + + private bool _nowMoving; + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + if (gameCharacter.externalInputForce <= 0.3f) + { + _isEnd = true; + _nextState = typeof(FieStateMachinePoniesIdle); + } + else + { + FiePonies fiePonies = gameCharacter as FiePonies; + Vector3 externalInputVector = gameCharacter.externalInputVector; + externalInputVector.z = externalInputVector.y * 0.5f; + externalInputVector.y = 0f; + float num = 0.38f; + Vector3 velocity = gameCharacter.GetComponent().velocity; + float num2 = Math.Abs(velocity.x); + float num3 = num2 / 5f; + float defaultMoveSpeed = gameCharacter.getDefaultMoveSpeed(); + _physicalSinWave += 3f * Time.deltaTime; + float timescale = Mathf.Min(Mathf.Max(num3 / 0.1f, 0.25f), 1f); + gameCharacter.animationManager.SetAnimation(2, isLoop: true); + gameCharacter.animationManager.SetAnimationTimescale(2, timescale); + _nowMoving = true; + gameCharacter.addMoveForce(externalInputVector * (defaultMoveSpeed * num), 0.1f); + Vector3 normalVec = (gameCharacter.getNowMoveForce().normalized + Vector3.down * (0.75f * Mathf.Sin(_physicalSinWave))) * -1f; + fiePonies.physicalForce.SetPhysicalForce(normalVec, 1000f, 0.5f); + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.isEnableAutoFlip = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + if (!(gameCharacter == null)) + { + gameCharacter.animationManager.ResetAllAnimationTimescale(); + gameCharacter.isEnableAutoFlip = false; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachineAnyConsider)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesRevive.cs b/src/Fie.Ponies/FieStateMachinePoniesRevive.cs new file mode 100644 index 0000000..8b326e2 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesRevive.cs @@ -0,0 +1,98 @@ +using Fie.Manager; +using Fie.Object; +using GameDataEditor; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesRevive : FieStateMachineGameCharacterBase + { + private enum RevivingState + { + STATE_START, + STATE_REVIVING + } + + private RevivingState _revivingState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private List _allowedStateList = new List(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (_revivingState == RevivingState.STATE_START) + { + fiePonies.SetDialog(FieMasterData.I.GetMasterData(GDEItemKeys.WordScriptTriggerType_WS_TRIGGER_TYPE_RESURRECTED)); + fiePonies.emotionController.SetDefaultEmoteAnimationID(16); + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(13, isLoop: false, isForceSet: true); + FieManagerBehaviour.I.EmitObject(fiePonies.transform, Vector3.up); + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + _revivingState = RevivingState.STATE_REVIVING; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.damageSystem.resetHealthSystem(); + fiePonies.isEnableCollider = false; + fiePonies.isEnableHeadTracking = false; + fiePonies.isEnableGravity = true; + fiePonies.isEnableAutoFlip = false; + fiePonies.isSpeakable = true; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + fiePonies.isSpeakable = true; + fiePonies.isEnableHeadTracking = true; + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + fiePonies.isEnableCollider = true; + fiePonies.setGravityRate(1f); + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return _allowedStateList; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesRift.cs b/src/Fie.Ponies/FieStateMachinePoniesRift.cs new file mode 100644 index 0000000..327eb12 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesRift.cs @@ -0,0 +1,125 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesRift : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private float _riftForceRate = 1f; + + private bool _resetMoveForce; + + public void SetRiftForceRate(float forceRate) + { + _riftForceRate = forceRate; + } + + public void ResetMoveForce(bool resetMoveForce) + { + _resetMoveForce = resetMoveForce; + } + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + _staggerState = StaggerState.STATE_STAGGER; + break; + case StaggerState.STATE_STAGGER: + { + int num = 6; + _nextState = typeof(FieStateMachinePoniesStaggerFall); + fiePonies.isEnableGravity = false; + fiePonies.isEnableGravity = true; + gameCharacter.setGravityRate(0.2f); + if (_resetMoveForce) + { + fiePonies.resetMoveForce(); + } + fiePonies.setMoveForce(Vector3.up * 8f * _riftForceRate, 1f, useRound: false); + num = 7; + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(num, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER_END; + break; + } + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.setGravityRate(1f); + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesStagger)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesStagger.cs b/src/Fie.Ponies/FieStateMachinePoniesStagger.cs new file mode 100644 index 0000000..f8c5f6e --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesStagger.cs @@ -0,0 +1,112 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesStagger : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER + } + + private const float STAGGER_MOVE_FORCE = 6f; + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (_staggerState == StaggerState.STATE_PREPARE) + { + fiePonies.emotionController.SetEmoteAnimation(17, isForceSet: true); + int animationId = 6; + if (fiePonies.groundState == FieObjectGroundState.Flying) + { + _nextState = typeof(FieStateMachinePoniesStaggerFall); + fiePonies.isEnableGravity = false; + fiePonies.isEnableGravity = true; + gameCharacter.setGravityRate(0.2f); + Vector3 a = Vector3.Normalize(fiePonies.centerTransform.position - fiePonies.latestDamageWorldPoint); + a.y *= 0.5f; + a.z = 0f; + a.Normalize(); + fiePonies.setFlipByVector(a * -1f); + fiePonies.setMoveForce((Vector3.up + a * 0.5f).normalized * 6f, 1f, useRound: false); + animationId = 7; + } + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + if (trackEntry != null) + { + trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + } + else + { + _isEnd = true; + } + _staggerState = StaggerState.STATE_STAGGER; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isEnableAutoFlip = false; + fiePonies.isEnableHeadTracking = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + fiePonies.setGravityRate(1f); + fiePonies.isEnableHeadTracking = true; + fiePonies.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + List list = new List(); + list.Add(typeof(FieStateMachinePoniesStagger)); + return list; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesStaggerFall.cs b/src/Fie.Ponies/FieStateMachinePoniesStaggerFall.cs new file mode 100644 index 0000000..b7a5e20 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesStaggerFall.cs @@ -0,0 +1,103 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesStaggerFall : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private List _allowedStateList = new List(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + switch (_staggerState) + { + case StaggerState.STATE_PREPARE: + { + _allowedStateList = fiePonies.getStaggerCancelableStateList(); + fiePonies.emotionController.SetEmoteAnimation(17, isForceSet: true); + int animationId = 8; + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(animationId, isLoop: false, isForceSet: true); + trackEntry.mixDuration = 0f; + _staggerState = StaggerState.STATE_STAGGER; + break; + } + case StaggerState.STATE_STAGGER: + if (fiePonies.groundState == FieObjectGroundState.Grounding) + { + if (fiePonies.damageSystem.isDying) + { + _nextState = typeof(FieStateMachinePoniesDead); + _isEnd = true; + } + else + { + _nextState = typeof(FieStateMachinePoniesStaggerFallRecover); + _isEnd = true; + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + _staggerState = StaggerState.STATE_STAGGER_END; + } + } + break; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.isEnableHeadTracking = false; + fiePonies.isEnableGravity = true; + fiePonies.setGravityRate(0.5f); + fiePonies.isEnableAutoFlip = false; + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + fiePonies.isEnableHeadTracking = true; + fiePonies.setGravityRate(1f); + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return _allowedStateList; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachinePoniesStaggerFallRecover.cs b/src/Fie.Ponies/FieStateMachinePoniesStaggerFallRecover.cs new file mode 100644 index 0000000..6521a43 --- /dev/null +++ b/src/Fie.Ponies/FieStateMachinePoniesStaggerFallRecover.cs @@ -0,0 +1,86 @@ +using Fie.Object; +using Spine; +using System; +using System.Collections.Generic; + +namespace Fie.Ponies +{ + public class FieStateMachinePoniesStaggerFallRecover : FieStateMachineGameCharacterBase + { + private enum StaggerState + { + STATE_PREPARE, + STATE_STAGGER, + STATE_STAGGER_END + } + + private StaggerState _staggerState; + + private bool _isEnd; + + private Type _nextState = typeof(FieStateMachineCommonIdle); + + private List _allowedStateList = new List(); + + public override void updateState(ref T gameCharacter) + { + if (gameCharacter is FiePonies) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (_staggerState == StaggerState.STATE_PREPARE) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + TrackEntry trackEntry = fiePonies.animationManager.SetAnimation(9, isLoop: false, isForceSet: true); + trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e) + { + if (e.Data.Name == "finished") + { + _isEnd = true; + } + }; + trackEntry.Complete += delegate + { + _isEnd = true; + }; + _staggerState = StaggerState.STATE_STAGGER_END; + } + } + } + + public override void initialize(FieGameCharacter gameCharacter) + { + FiePonies x = gameCharacter as FiePonies; + if (!(x == null)) + { + } + } + + public override void terminate(FieGameCharacter gameCharacter) + { + FiePonies fiePonies = gameCharacter as FiePonies; + if (!(fiePonies == null)) + { + fiePonies.emotionController.RestoreEmotionFromDefaultData(); + fiePonies.isEnableHeadTracking = true; + fiePonies.setGravityRate(1f); + fiePonies.isEnableAutoFlip = true; + fiePonies.isEnableGravity = true; + } + } + + public override bool isEnd() + { + return _isEnd; + } + + public override Type getNextState() + { + return _nextState; + } + + public override List getAllowedStateList() + { + return _allowedStateList; + } + } +} diff --git a/src/Fie.Ponies/FieStateMachineRisingSunInterface.cs b/src/Fie.Ponies/FieStateMachineRisingSunInterface.cs new file mode 100644 index 0000000..b5689de --- /dev/null +++ b/src/Fie.Ponies/FieStateMachineRisingSunInterface.cs @@ -0,0 +1,8 @@ +using Fie.Object; + +namespace Fie.Ponies +{ + public abstract class FieStateMachineRisingSunInterface : FieStateMachineGameCharacterBase + { + } +} diff --git a/src/Fie.Portal/FieDeparturePortal.cs b/src/Fie.Portal/FieDeparturePortal.cs new file mode 100644 index 0000000..e16583d --- /dev/null +++ b/src/Fie.Portal/FieDeparturePortal.cs @@ -0,0 +1,77 @@ +using Fie.Manager; +using Fie.Scene; +using GameDataEditor; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Portal +{ + public sealed class FieDeparturePortal : FieVisualizedPortal + { + public FieConstValues.DefinedScenes nextScene; + + public bool isEnableActivity; + + private readonly Dictionary _sceneList = new Dictionary + { + { + FieConstValues.DefinedScenes.FIE_TITLE, + new FieSceneTitle() + }, + { + FieConstValues.DefinedScenes.FIE_LOBBY, + new FieSceneLobby() + }, + { + FieConstValues.DefinedScenes.FIE_MAP1_1, + new FieSceneMap1_1() + }, + { + FieConstValues.DefinedScenes.FIE_MAP1_2, + new FieSceneMap1_2() + }, + { + FieConstValues.DefinedScenes.FIE_MAP1_3, + new FieSceneMap1_3() + }, + { + FieConstValues.DefinedScenes.FIE_MAP1_4, + new FieSceneMap1_4() + }, + { + FieConstValues.DefinedScenes.FIE_RESULT, + new FieSceneResult() + } + }; + + public new void Update() + { + base.Update(); + } + + protected override void Trigger() + { + if (PhotonNetwork.isMasterClient && !PhotonNetwork.offlineMode) + { + PhotonNetwork.room.IsOpen = false; + } + FieManagerBehaviour.I.LoadScene(_sceneList[nextScene], allowSceneActivation: true, FieFaderManager.FadeType.OUT_TO_WHITE, FieFaderManager.FadeType.IN_FROM_WHITE, 1f); + } + + private void OnTriggerEnter(Collider other) + { + if (!(other == null) && !(other.gameObject == null)) + { + FieCollider component = other.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (!(parentGameCharacter == null) && isEnableActivity) + { + FieManagerBehaviour.I.RequestGameOwnerOnlyActivity(parentGameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_DEPATURE_PORTAL_INFO), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_DEPATURE_PORTAL_INFO)); + } + } + } + } + } +} diff --git a/src/Fie.Portal/FiePortalBase.cs b/src/Fie.Portal/FiePortalBase.cs new file mode 100644 index 0000000..4b497f9 --- /dev/null +++ b/src/Fie.Portal/FiePortalBase.cs @@ -0,0 +1,177 @@ +using Fie.Manager; +using Fie.User; +using Photon; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Portal +{ + public abstract class FiePortalBase : Photon.MonoBehaviour + { + public enum PortalTriggerType + { + SINGLE, + COOP + } + + private const float DEFAULT_TRIGGERING_SEC = 10f; + + [SerializeField] + private float _triggeringSec = 10f; + + [SerializeField] + protected PortalTriggerType _portalType; + + protected float _localProgress; + + protected float _globalProgress; + + private int _hittedFlags; + + private int _currentHittedCount; + + protected bool _isTriggerd; + + private bool _hittedMySelf; + + private Dictionary _hittedCharacterList = new Dictionary(); + + public float progress + { + get + { + return (_portalType != 0) ? _globalProgress : _localProgress; + } + set + { + if (_portalType == PortalTriggerType.SINGLE) + { + _localProgress = value; + } + else + { + _globalProgress = value; + } + } + } + + public float triggeringSec => _triggeringSec; + + public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) + { + if (stream.isWriting) + { + stream.SendNext(_globalProgress); + } + else + { + _globalProgress = (float)stream.ReceiveNext(); + } + } + + public void Update() + { + bool flag = false; + switch (_portalType) + { + case PortalTriggerType.SINGLE: + if (_hittedMySelf) + { + flag = true; + _hittedMySelf = false; + } + break; + case PortalTriggerType.COOP: + if (FieManagerBehaviour.I.nowPlayerNum > 0) + { + int num = 0; + for (int i = 0; i < FieManagerBehaviour.I.nowPlayerNum; i++) + { + if ((_hittedFlags & (1 << i)) != 0) + { + num++; + } + } + if (num >= FieManagerBehaviour.I.nowPlayerNum) + { + flag = true; + } + } + break; + } + if (flag) + { + progress = Mathf.Min(_triggeringSec, progress + Time.deltaTime); + } + else if (!_isTriggerd) + { + progress = Mathf.Max(0f, progress - Time.deltaTime); + } + if (progress >= _triggeringSec && !_isTriggerd) + { + if (_portalType == PortalTriggerType.SINGLE) + { + Trigger(); + } + else if (_portalType == PortalTriggerType.COOP && (PhotonNetwork.offlineMode || base.photonView.isMine)) + { + Trigger(); + base.photonView.RPC("TriggerRPC", PhotonTargets.Others, null); + } + _isTriggerd = true; + } + _hittedFlags = 0; + } + + [PunRPC] + public void TriggerRPC() + { + Trigger(); + } + + private void OnTriggerStay(Collider other) + { + if (!(other == null) && !(other.gameObject == null)) + { + FieCollider component = other.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (!(parentGameCharacter == null)) + { + int num = 0; + _hittedMySelf = false; + FieUser[] allUserData = FieManagerBehaviour.I.getAllUserData(); + foreach (FieUser fieUser in allUserData) + { + if (fieUser != null && !(fieUser.usersCharacter == null)) + { + if (PhotonNetwork.offlineMode) + { + if (parentGameCharacter.GetInstanceID() == fieUser.usersCharacter.GetInstanceID()) + { + _hittedFlags |= 1 << num; + } + } + else + { + if (parentGameCharacter.photonView.isMine) + { + _hittedMySelf = true; + } + if (parentGameCharacter.photonView.viewID == fieUser.usersCharacter.photonView.viewID) + { + _hittedFlags |= 1 << num; + } + } + num++; + } + } + } + } + } + } + + protected abstract void Trigger(); + } +} diff --git a/src/Fie.Portal/FieReturnPortal.cs b/src/Fie.Portal/FieReturnPortal.cs new file mode 100644 index 0000000..b98ab12 --- /dev/null +++ b/src/Fie.Portal/FieReturnPortal.cs @@ -0,0 +1,35 @@ +using Fie.Manager; +using GameDataEditor; +using UnityEngine; + +namespace Fie.Portal +{ + public sealed class FieReturnPortal : FieVisualizedPortal + { + public new void Update() + { + base.Update(); + } + + protected override void Trigger() + { + FieManagerFactory.I.Restart(); + } + + private void OnTriggerEnter(Collider other) + { + if (!(other == null) && !(other.gameObject == null)) + { + FieCollider component = other.gameObject.GetComponent(); + if (!(component == null)) + { + FieGameCharacter parentGameCharacter = component.getParentGameCharacter(); + if (!(parentGameCharacter == null)) + { + FieManagerBehaviour.I.RequestGameOwnerOnlyActivity(parentGameCharacter, FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RETURNING_PORTAL_INFO), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RETURNING_PORTAL_INFO)); + } + } + } + } + } +} diff --git a/src/Fie.Portal/FieVisualizedPortal.cs b/src/Fie.Portal/FieVisualizedPortal.cs new file mode 100644 index 0000000..6880025 --- /dev/null +++ b/src/Fie.Portal/FieVisualizedPortal.cs @@ -0,0 +1,70 @@ +using UnityEngine; + +namespace Fie.Portal +{ + public abstract class FieVisualizedPortal : FiePortalBase + { + [SerializeField] + private AnimationCurve _fxCurve; + + [SerializeField] + private PKFxFX _gaugeFx; + + [SerializeField] + private PKFxFX _portalParticleFx; + + [SerializeField] + private PKFxFX _portalHoleFx; + + [SerializeField] + private AudioSource _soundFx; + + private PKFxManager.Attribute _progessAttr; + + private PKFxManager.Attribute _teleportStartupAttr; + + private PKFxManager.Attribute _portalHoleAttr; + + private float _latestProgress = -1f; + + public void Awake() + { + _progessAttr = new PKFxManager.Attribute("Value", 0f); + _teleportStartupAttr = new PKFxManager.Attribute("TeleportStartup", 0f); + _portalHoleAttr = new PKFxManager.Attribute("Scale", 0f); + } + + public void OnEnable() + { + } + + public new void Update() + { + base.Update(); + if (_latestProgress != base.progress) + { + float num = _fxCurve.Evaluate(base.progress / base.triggeringSec); + _progessAttr.ValueFloat = base.progress / base.triggeringSec; + _teleportStartupAttr.ValueFloat = num; + _portalHoleAttr.ValueFloat = num; + if (_gaugeFx != null) + { + _gaugeFx.SetAttribute(_progessAttr); + } + if (_portalParticleFx != null) + { + _portalParticleFx.SetAttribute(_teleportStartupAttr); + } + if (_portalHoleFx != null) + { + _portalHoleFx.SetAttribute(_portalHoleAttr); + } + if (_soundFx != null) + { + _soundFx.volume = num; + } + _latestProgress = base.progress; + } + } + } +} diff --git a/src/Fie.PostEffect/FieCommandBufferReflection.cs b/src/Fie.PostEffect/FieCommandBufferReflection.cs new file mode 100644 index 0000000..efbe8fd --- /dev/null +++ b/src/Fie.PostEffect/FieCommandBufferReflection.cs @@ -0,0 +1,70 @@ +using UnityEngine; +using UnityEngine.Rendering; + +namespace Fie.PostEffect +{ + [ExecuteInEditMode] + [RequireComponent(typeof(UnityEngine.Camera))] + public class FieCommandBufferReflection : MonoBehaviour + { + [Range(0f, 10f)] + public float m_BlurScale = 1f; + + public Shader m_BlurShader; + + private UnityEngine.Camera m_Cam; + + private Material m_Material; + + private CommandBuffer m_CommandBuffer; + + private void Awake() + { + m_Cam = GetComponent(); + if (m_BlurShader != null) + { + m_Material = new Material(m_BlurShader); + m_Material.hideFlags = HideFlags.HideAndDontSave; + } + } + + private void OnEnable() + { + int qualityLevel = QualitySettings.GetQualityLevel(); + if (qualityLevel > 1 && !(m_Cam == null) && m_CommandBuffer == null) + { + m_CommandBuffer = new CommandBuffer(); + m_CommandBuffer.name = "Grab screen and blur"; + int nameID = Shader.PropertyToID("_ScreenCopyTexture"); + m_CommandBuffer.GetTemporaryRT(nameID, -1, -1, 0, FilterMode.Bilinear); + m_CommandBuffer.Blit(BuiltinRenderTextureType.CurrentActive, nameID); + m_CommandBuffer.SetGlobalTexture("_GrabRawTexture", nameID); + int nameID2 = Shader.PropertyToID("_Temp1"); + int nameID3 = Shader.PropertyToID("_Temp2"); + m_CommandBuffer.GetTemporaryRT(nameID2, -2, -2, 0, FilterMode.Bilinear); + m_CommandBuffer.GetTemporaryRT(nameID3, -2, -2, 0, FilterMode.Bilinear); + m_CommandBuffer.Blit(nameID, nameID2); + m_CommandBuffer.ReleaseTemporaryRT(nameID); + m_CommandBuffer.SetGlobalVector("offsets", new Vector4(1f * m_BlurScale / (float)Screen.width, 0f, 0f, 0f)); + m_CommandBuffer.Blit(nameID2, nameID3, m_Material); + m_CommandBuffer.SetGlobalVector("offsets", new Vector4(0f, 2f * m_BlurScale / (float)Screen.height, 0f, 0f)); + m_CommandBuffer.Blit(nameID3, nameID2, m_Material); + m_CommandBuffer.SetGlobalVector("offsets", new Vector4(4f * m_BlurScale / (float)Screen.width, 0f, 0f, 0f)); + m_CommandBuffer.Blit(nameID2, nameID3, m_Material); + m_CommandBuffer.SetGlobalVector("offsets", new Vector4(0f, 4f * m_BlurScale / (float)Screen.height, 0f, 0f)); + m_CommandBuffer.Blit(nameID3, nameID2, m_Material); + m_CommandBuffer.SetGlobalTexture("_GrabBlurTexture", nameID2); + m_Cam.AddCommandBuffer(CameraEvent.AfterEverything, m_CommandBuffer); + } + } + + private void OnDisable() + { + if (!(m_Cam == null) && m_CommandBuffer != null) + { + m_Cam.RemoveCommandBuffer(CameraEvent.AfterEverything, m_CommandBuffer); + m_CommandBuffer = null; + } + } + } +} diff --git a/src/Fie.Scene/FieSceneBase.cs b/src/Fie.Scene/FieSceneBase.cs new file mode 100644 index 0000000..b5ce787 --- /dev/null +++ b/src/Fie.Scene/FieSceneBase.cs @@ -0,0 +1,20 @@ +using System; + +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.UNDEFINED, FieSceneType.UNDEFINED)] + public abstract class FieSceneBase + { + public FieSceneLink GetSceneLinkInfo() + { + FieSceneLink fieSceneLink = (FieSceneLink)Attribute.GetCustomAttribute(GetType(), typeof(FieSceneLink)); + if (fieSceneLink != null) + { + return fieSceneLink; + } + return null; + } + + public abstract void StartUp(); + } +} diff --git a/src/Fie.Scene/FieSceneBootstrap.cs b/src/Fie.Scene/FieSceneBootstrap.cs new file mode 100644 index 0000000..c688033 --- /dev/null +++ b/src/Fie.Scene/FieSceneBootstrap.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_BOOTSTRAP, FieSceneType.OUTGAME)] + public class FieSceneBootstrap : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneLink.cs b/src/Fie.Scene/FieSceneLink.cs new file mode 100644 index 0000000..607f030 --- /dev/null +++ b/src/Fie.Scene/FieSceneLink.cs @@ -0,0 +1,18 @@ +using System; + +namespace Fie.Scene +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class FieSceneLink : Attribute + { + public readonly FieConstValues.DefinedScenes linkedScene; + + public readonly FieSceneType definedSceneType; + + public FieSceneLink(FieConstValues.DefinedScenes linkScene, FieSceneType sceneType) + { + linkedScene = linkScene; + definedSceneType = sceneType; + } + } +} diff --git a/src/Fie.Scene/FieSceneLobby.cs b/src/Fie.Scene/FieSceneLobby.cs new file mode 100644 index 0000000..efae197 --- /dev/null +++ b/src/Fie.Scene/FieSceneLobby.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_LOBBY, FieSceneType.OUTGAME)] + public class FieSceneLobby : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneMap1_1.cs b/src/Fie.Scene/FieSceneMap1_1.cs new file mode 100644 index 0000000..e9f2204 --- /dev/null +++ b/src/Fie.Scene/FieSceneMap1_1.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_MAP1_1, FieSceneType.INGAME)] + public class FieSceneMap1_1 : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneMap1_2.cs b/src/Fie.Scene/FieSceneMap1_2.cs new file mode 100644 index 0000000..cdba507 --- /dev/null +++ b/src/Fie.Scene/FieSceneMap1_2.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_MAP1_2, FieSceneType.INGAME)] + public class FieSceneMap1_2 : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneMap1_3.cs b/src/Fie.Scene/FieSceneMap1_3.cs new file mode 100644 index 0000000..af82aec --- /dev/null +++ b/src/Fie.Scene/FieSceneMap1_3.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_MAP1_3, FieSceneType.INGAME)] + public class FieSceneMap1_3 : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneMap1_4.cs b/src/Fie.Scene/FieSceneMap1_4.cs new file mode 100644 index 0000000..c93dbe3 --- /dev/null +++ b/src/Fie.Scene/FieSceneMap1_4.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_MAP1_4, FieSceneType.INGAME)] + public class FieSceneMap1_4 : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneResult.cs b/src/Fie.Scene/FieSceneResult.cs new file mode 100644 index 0000000..6fa29ee --- /dev/null +++ b/src/Fie.Scene/FieSceneResult.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_RESULT, FieSceneType.OUTGAME)] + public class FieSceneResult : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneSurvivalLevel.cs b/src/Fie.Scene/FieSceneSurvivalLevel.cs new file mode 100644 index 0000000..ff20b4e --- /dev/null +++ b/src/Fie.Scene/FieSceneSurvivalLevel.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_MAP1_4, FieSceneType.INGAME)] + public class FieSceneSurvivalLevel : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneTitle.cs b/src/Fie.Scene/FieSceneTitle.cs new file mode 100644 index 0000000..1e1967a --- /dev/null +++ b/src/Fie.Scene/FieSceneTitle.cs @@ -0,0 +1,10 @@ +namespace Fie.Scene +{ + [FieSceneLink(FieConstValues.DefinedScenes.FIE_TITLE, FieSceneType.OUTGAME)] + public class FieSceneTitle : FieSceneBase + { + public override void StartUp() + { + } + } +} diff --git a/src/Fie.Scene/FieSceneType.cs b/src/Fie.Scene/FieSceneType.cs new file mode 100644 index 0000000..e193285 --- /dev/null +++ b/src/Fie.Scene/FieSceneType.cs @@ -0,0 +1,12 @@ +using System; + +namespace Fie.Scene +{ + [Flags] + public enum FieSceneType + { + UNDEFINED = 0x0, + OUTGAME = 0x1, + INGAME = 0x2 + } +} diff --git a/src/Fie.Title/FieTitleAuthController.cs b/src/Fie.Title/FieTitleAuthController.cs new file mode 100644 index 0000000..e49603f --- /dev/null +++ b/src/Fie.Title/FieTitleAuthController.cs @@ -0,0 +1,79 @@ +using Fie.Manager; +using MBS; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleAuthController : MonoBehaviour + { + public delegate void FinishedLoginProcessCallback(); + + public enum RecomendedLoginState + { + AUTH, + CONNECT_TO_MASTER, + UNNECESSARY + } + + [SerializeField] + private WUUGLoginGUI _loginGUIComponent; + + public event FinishedLoginProcessCallback finishedEvent; + + public RecomendedLoginState GetRecomendedLoginState() + { + if (PhotonNetwork.offlineMode) + { + return RecomendedLoginState.UNNECESSARY; + } + if (WULogin.logged_in) + { + if (!PhotonNetwork.connected) + { + return RecomendedLoginState.CONNECT_TO_MASTER; + } + return RecomendedLoginState.UNNECESSARY; + } + return RecomendedLoginState.AUTH; + } + + public void SetupLoginComponents(RecomendedLoginState recomendedState) + { + switch (recomendedState) + { + case RecomendedLoginState.AUTH: + _loginGUIComponent.gameObject.SetActive(value: true); + _loginGUIComponent.InitWULoginGUI(); + _loginGUIComponent.loginEvent += _loginGUIComponent_loginCallback; + break; + case RecomendedLoginState.CONNECT_TO_MASTER: + FieManagerBehaviour.I.connectedToMasterServerEvent += _connectedToMasterServerCallback; + FieManagerBehaviour.I.feiledToConnectToMasterServerEvent += _connectedToMasterServerCallback; + FieManagerBehaviour.I.ConnectToMasterServer(); + break; + case RecomendedLoginState.UNNECESSARY: + if (this.finishedEvent != null) + { + this.finishedEvent(); + } + break; + } + } + + private void _connectedToMasterServerCallback(FieNetworkManager.FieNetowrkErrorCode errorCode) + { + if (this.finishedEvent != null) + { + this.finishedEvent(); + } + } + + private void _loginGUIComponent_loginCallback() + { + if (this.finishedEvent != null) + { + this.finishedEvent(); + } + } + } +} diff --git a/src/Fie.Title/FieTitleCameraOrbit.cs b/src/Fie.Title/FieTitleCameraOrbit.cs new file mode 100644 index 0000000..577116d --- /dev/null +++ b/src/Fie.Title/FieTitleCameraOrbit.cs @@ -0,0 +1,231 @@ +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleCameraOrbit : MonoBehaviour + { + public GameObject target; + + public Transform targetFocus; + + public float distance = 1f; + + [Range(0.1f, 4f)] + public float ZoomWheelSpeed = 4f; + + public float minDistance = 0.5f; + + public float maxDistance = 10f; + + public float xSpeed = 250f; + + public float ySpeed = 120f; + + public float xObjSpeed = 250f; + + public float yObjSpeed = 120f; + + public float yMinLimit = -20f; + + public float yMaxLimit = 80f; + + private float x; + + private float y; + + private float normal_angle; + + private float cur_distance; + + private float cur_xSpeed; + + private float cur_ySpeed; + + private float req_xSpeed; + + private float req_ySpeed; + + private float cur_ObjxSpeed; + + private float cur_ObjySpeed; + + private float req_ObjxSpeed; + + private float req_ObjySpeed; + + private bool DraggingObject; + + private bool lastLMBState; + + private Collider[] surfaceColliders; + + private float bounds_MaxSize = 20f; + + [HideInInspector] + public bool disableSteering; + + private void Start() + { + Vector3 eulerAngles = base.transform.eulerAngles; + x = eulerAngles.y; + y = eulerAngles.x; + Reset(); + } + + public void DisableSteering(bool state) + { + disableSteering = state; + } + + public void Reset() + { + lastLMBState = Input.GetMouseButton(0); + disableSteering = false; + cur_distance = distance; + cur_xSpeed = 0f; + cur_ySpeed = 0f; + req_xSpeed = 0f; + req_ySpeed = 0f; + surfaceColliders = null; + cur_ObjxSpeed = 0f; + cur_ObjySpeed = 0f; + req_ObjxSpeed = 0f; + req_ObjySpeed = 0f; + if ((bool)target) + { + Renderer[] componentsInChildren = target.GetComponentsInChildren(); + Bounds bounds = default(Bounds); + bool flag = false; + Renderer[] array = componentsInChildren; + foreach (Renderer renderer in array) + { + if (!flag) + { + flag = true; + bounds = renderer.bounds; + } + else + { + bounds.Encapsulate(renderer.bounds); + } + } + Vector3 size = bounds.size; + float num = (!(size.x > size.y)) ? size.y : size.x; + num = (bounds_MaxSize = ((!(size.z > num)) ? num : size.z)); + cur_distance += bounds_MaxSize * 1.2f; + surfaceColliders = target.GetComponentsInChildren(); + } + } + + private void LateUpdate() + { + if ((bool)target && (bool)targetFocus) + { + if (!lastLMBState && Input.GetMouseButton(0)) + { + DraggingObject = false; + if (surfaceColliders != null) + { + RaycastHit hitInfo = default(RaycastHit); + Ray ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition); + Collider[] array = surfaceColliders; + foreach (Collider collider in array) + { + if (collider.Raycast(ray, out hitInfo, float.PositiveInfinity)) + { + DraggingObject = true; + break; + } + } + } + } + else if (lastLMBState && !Input.GetMouseButton(0)) + { + DraggingObject = false; + } + lastLMBState = Input.GetMouseButton(0); + if (DraggingObject) + { + if (Input.GetMouseButton(0) && !disableSteering) + { + req_ObjxSpeed += (Input.GetAxis("Mouse X") * xObjSpeed * 0.02f - req_ObjxSpeed) * Time.deltaTime * 10f; + req_ObjySpeed += (Input.GetAxis("Mouse Y") * yObjSpeed * 0.02f - req_ObjySpeed) * Time.deltaTime * 10f; + } + else + { + req_ObjxSpeed += (0f - req_ObjxSpeed) * Time.deltaTime * 4f; + req_ObjySpeed += (0f - req_ObjySpeed) * Time.deltaTime * 4f; + } + req_xSpeed += (0f - req_xSpeed) * Time.deltaTime * 4f; + req_ySpeed += (0f - req_ySpeed) * Time.deltaTime * 4f; + } + else + { + if (Input.GetMouseButton(0) && !disableSteering) + { + req_xSpeed += (Input.GetAxis("Mouse X") * xSpeed * 0.02f - req_xSpeed) * Time.deltaTime * 10f; + req_ySpeed += (Input.GetAxis("Mouse Y") * ySpeed * 0.02f - req_ySpeed) * Time.deltaTime * 10f; + } + else + { + req_xSpeed += (0f - req_xSpeed) * Time.deltaTime * 4f; + req_ySpeed += (0f - req_ySpeed) * Time.deltaTime * 4f; + } + req_ObjxSpeed += (0f - req_ObjxSpeed) * Time.deltaTime * 4f; + req_ObjySpeed += (0f - req_ObjySpeed) * Time.deltaTime * 4f; + } + distance -= Input.GetAxis("Mouse ScrollWheel") * ZoomWheelSpeed; + distance = Mathf.Clamp(distance, minDistance, maxDistance); + cur_ObjxSpeed += (req_ObjxSpeed - cur_ObjxSpeed) * Time.deltaTime * 20f; + cur_ObjySpeed += (req_ObjySpeed - cur_ObjySpeed) * Time.deltaTime * 20f; + target.transform.RotateAround(targetFocus.position, Vector3.Cross(targetFocus.position - base.transform.position, base.transform.right), 0f - cur_ObjxSpeed); + target.transform.RotateAround(targetFocus.position, Vector3.Cross(targetFocus.position - base.transform.position, base.transform.up), 0f - cur_ObjySpeed); + cur_xSpeed += (req_xSpeed - cur_xSpeed) * Time.deltaTime * 20f; + cur_ySpeed += (req_ySpeed - cur_ySpeed) * Time.deltaTime * 20f; + x += cur_xSpeed; + y -= cur_ySpeed; + y = ClampAngle(y, yMinLimit + normal_angle, yMaxLimit + normal_angle); + if (surfaceColliders != null) + { + RaycastHit hitInfo2 = default(RaycastHit); + Vector3 vector = Vector3.Normalize(targetFocus.position - base.transform.position); + float num = 0.01f; + bool flag = false; + Collider[] array2 = surfaceColliders; + foreach (Collider collider2 in array2) + { + if (collider2.Raycast(new Ray(base.transform.position - vector * bounds_MaxSize, vector), out hitInfo2, float.PositiveInfinity)) + { + num = Mathf.Max(Vector3.Distance(hitInfo2.point, targetFocus.position) + distance, num); + flag = true; + } + } + if (flag) + { + cur_distance += (num - cur_distance) * Time.deltaTime * 4f; + } + } + Quaternion rotation = Quaternion.Euler(y, x, 0f); + base.transform.rotation = rotation; + } + } + + private static float ClampAngle(float angle, float min, float max) + { + if (angle < -360f) + { + angle += 360f; + } + if (angle > 360f) + { + angle -= 360f; + } + return Mathf.Clamp(angle, min, max); + } + + public void set_normal_angle(float a) + { + normal_angle = a; + } + } +} diff --git a/src/Fie.Title/FieTitleCameraRotator.cs b/src/Fie.Title/FieTitleCameraRotator.cs new file mode 100644 index 0000000..710d9d2 --- /dev/null +++ b/src/Fie.Title/FieTitleCameraRotator.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleCameraRotator : MonoBehaviour + { + public Transform lookTransform; + + public Vector3 tiltRange = Vector3.zero; + + public float tiltTime = 4f; + + private float tiltSin; + + private Vector3 initPos = Vector3.zero; + + private void Start() + { + initPos = base.transform.position; + } + + private void Update() + { + tiltSin += 90f / tiltTime * Time.deltaTime; + tiltSin = Mathf.Repeat(tiltSin, 360f); + base.transform.rotation = Quaternion.AngleAxis(tiltRange.x * Mathf.Sin(tiltSin), Vector3.right) * Quaternion.AngleAxis(tiltRange.y * Mathf.Sin(tiltSin), Vector3.up); + } + } +} diff --git a/src/Fie.Title/FieTitleCameraScaler.cs b/src/Fie.Title/FieTitleCameraScaler.cs new file mode 100644 index 0000000..6a0f950 --- /dev/null +++ b/src/Fie.Title/FieTitleCameraScaler.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleCameraScaler : MonoBehaviour + { + public Transform syncScaleTransform; + + private void Start() + { + } + + private void LateUpdate() + { + if (syncScaleTransform != null) + { + base.transform.localScale = syncScaleTransform.transform.localScale; + } + } + } +} diff --git a/src/Fie.Title/FieTitleElementsCicleScaleTilter.cs b/src/Fie.Title/FieTitleElementsCicleScaleTilter.cs new file mode 100644 index 0000000..14d445c --- /dev/null +++ b/src/Fie.Title/FieTitleElementsCicleScaleTilter.cs @@ -0,0 +1,52 @@ +using Fie.Utility; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleElementsCicleScaleTilter : MonoBehaviour + { + public List tweenScaleList = new List + { + 1f, + 1.5f, + 0.5f + }; + + public float tweenTime = 1f; + + public float tweenInterval = 10f; + + private float _currentTweenInterval; + + private Tweener scaleTweener = new Tweener(); + + private int tweenScaleIndex; + + private void Start() + { + _currentTweenInterval = tweenInterval; + scaleTweener.InitTweener(1f, tweenScaleList[0], tweenScaleList[0]); + } + + private void Update() + { + float num = scaleTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.localScale = new Vector3(num, num, num); + if (scaleTweener.IsEnd()) + { + _currentTweenInterval -= Time.deltaTime; + if (_currentTweenInterval <= 0f) + { + tweenScaleIndex++; + if (tweenScaleIndex >= tweenScaleList.Count) + { + tweenScaleIndex = 0; + } + scaleTweener.InitTweener(tweenTime, num, tweenScaleList[tweenScaleIndex]); + _currentTweenInterval = tweenInterval; + } + } + } + } +} diff --git a/src/Fie.Title/FieTitleElementsRotater.cs b/src/Fie.Title/FieTitleElementsRotater.cs new file mode 100644 index 0000000..20cc813 --- /dev/null +++ b/src/Fie.Title/FieTitleElementsRotater.cs @@ -0,0 +1,63 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleElementsRotater : MonoBehaviour + { + public enum AxisType + { + XYZ, + YXZ + } + + public AxisType axisType; + + public Vector3 clickRotForce = Vector3.zero; + + public float clickRotDuration; + + public Vector3 rotatePerSec = Vector3.zero; + + public Vector3 currentRotateion = Vector3.zero; + + private Tweener clickRotTweener = new Tweener(); + + private Vector3 currentClickForce = Vector3.zero; + + private void Start() + { + } + + private void Update() + { + if (Input.anyKeyDown) + { + currentClickForce += clickRotForce * 20f; + currentClickForce.x = Mathf.Min(currentClickForce.x, clickRotForce.x * 60f); + currentClickForce.y = Mathf.Min(currentClickForce.y, clickRotForce.y * 60f); + currentClickForce.z = Mathf.Min(currentClickForce.z, clickRotForce.z * 60f); + } + currentClickForce = Vector3.Lerp(currentClickForce, Vector3.zero, 0.95f * Time.deltaTime); + currentRotateion.x += rotatePerSec.x * Time.deltaTime; + currentRotateion.y += rotatePerSec.y * Time.deltaTime; + currentRotateion.z += rotatePerSec.z * Time.deltaTime; + currentRotateion += currentClickForce * Time.deltaTime; + currentRotateion.x = Mathf.Repeat(currentRotateion.x, 360f); + currentRotateion.y = Mathf.Repeat(currentRotateion.y, 360f); + currentRotateion.z = Mathf.Repeat(currentRotateion.z, 360f); + Quaternion quaternion = Quaternion.AngleAxis(currentRotateion.x, Vector3.right); + Quaternion quaternion2 = Quaternion.AngleAxis(currentRotateion.y, Vector3.up); + Quaternion rhs = Quaternion.AngleAxis(currentRotateion.z, Vector3.forward); + switch (axisType) + { + case AxisType.XYZ: + base.transform.rotation = quaternion * quaternion2 * rhs; + break; + case AxisType.YXZ: + base.transform.rotation = quaternion2 * quaternion * rhs; + break; + } + } + } +} diff --git a/src/Fie.Title/FieTitleElementsScaleNormalizer.cs b/src/Fie.Title/FieTitleElementsScaleNormalizer.cs new file mode 100644 index 0000000..d93a397 --- /dev/null +++ b/src/Fie.Title/FieTitleElementsScaleNormalizer.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleElementsScaleNormalizer : MonoBehaviour + { + private Vector3 defaultScale = Vector3.zero; + + private void Start() + { + defaultScale = base.transform.lossyScale; + } + + private void LateUpdate() + { + Vector3 lossyScale = base.transform.lossyScale; + Vector3 localScale = base.transform.localScale; + base.transform.localScale = new Vector3(localScale.x / lossyScale.x * defaultScale.x, localScale.y / lossyScale.y * defaultScale.y, localScale.z / lossyScale.z * defaultScale.z); + } + } +} diff --git a/src/Fie.Title/FieTitleElementsShooter.cs b/src/Fie.Title/FieTitleElementsShooter.cs new file mode 100644 index 0000000..648efc6 --- /dev/null +++ b/src/Fie.Title/FieTitleElementsShooter.cs @@ -0,0 +1,82 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleElementsShooter : MonoBehaviour + { + [SerializeField] + private float SummonArrowChildDuration = 1.5f; + + [SerializeField] + private float SummonArrowVelocityMax = 4f; + + [SerializeField] + private float SummonArrowVelocityAccelTime = 0.3f; + + [SerializeField] + private float SummonArrowTiltDuration = 0.5f; + + private const float RANDOM_TILT_DISTANCE = 15f; + + private const float HORMING_DISTANCE_MAX = 10f; + + public float transitionTime = 0.5f; + + public float shootTime = 4f; + + public Transform targetTransform; + + private Tweener _velocityTweener = new Tweener(); + + private Tweener _tiltForceTweener = new Tweener(); + + private float shootCounter; + + private bool isShoot; + + private Vector3 directionalVec = Vector3.zero; + + private Vector3 _randomTiltVec = Vector3.zero; + + private Vector3 fromPosition = Vector3.zero; + + private void Start() + { + _velocityTweener.InitTweener(SummonArrowVelocityAccelTime, 0f, SummonArrowVelocityMax); + } + + private void initRandomTilt() + { + Vector3 a = base.transform.position + directionalVec * 15f; + Vector3 a2 = Quaternion.AngleAxis(Random.Range(0f, 360f), directionalVec) * Vector3.up; + a2 *= 15f; + a += a2 * 15f; + _randomTiltVec = Quaternion.LookRotation(a - base.transform.position) * Vector3.forward; + _randomTiltVec.Normalize(); + } + + private void Update() + { + shootCounter += Time.deltaTime; + if (shootCounter >= shootTime) + { + if (!isShoot) + { + base.transform.parent = null; + isShoot = true; + directionalVec = targetTransform.position - base.transform.position; + directionalVec.Normalize(); + _velocityTweener.InitTweener(SummonArrowVelocityAccelTime, base.transform.position, targetTransform.position); + _tiltForceTweener.InitTweener(SummonArrowTiltDuration, 0f, 1f); + fromPosition = base.transform.position; + } + else + { + float t = _tiltForceTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position = Vector3.Slerp(fromPosition, targetTransform.position, t); + } + } + } + } +} diff --git a/src/Fie.Title/FieTitleElementsTargetChanger.cs b/src/Fie.Title/FieTitleElementsTargetChanger.cs new file mode 100644 index 0000000..cc8b869 --- /dev/null +++ b/src/Fie.Title/FieTitleElementsTargetChanger.cs @@ -0,0 +1,66 @@ +using Fie.Utility; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleElementsTargetChanger : MonoBehaviour + { + public List objectList = new List(); + + public float tweenTime = 1f; + + public float tweenInterval = 10f; + + public float firstInterval = 10f; + + private float _currentTweenInterval; + + private Tweener positionTweener = new Tweener(); + + private int objectIndex; + + private Transform currentTransform; + + private Transform nextTransform; + + private void Start() + { + _currentTweenInterval = tweenInterval; + positionTweener.InitTweener(tweenTime, 0f, 1f); + currentTransform = objectList[objectIndex].transform; + objectIndex = getNextPathPoint(objectIndex); + nextTransform = objectList[objectIndex].transform; + } + + private int getNextPathPoint(int currentIndex, int incrementCount = 1) + { + return Mathf.RoundToInt(Mathf.Repeat((float)(currentIndex + incrementCount), (float)objectList.Count)); + } + + private void Update() + { + if (firstInterval > 0f) + { + firstInterval -= Time.deltaTime; + } + else + { + float t = positionTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position = Vector3.Slerp(currentTransform.position, nextTransform.position, t); + if (positionTweener.IsEnd()) + { + _currentTweenInterval -= Time.deltaTime; + if (_currentTweenInterval <= 0f) + { + currentTransform = objectList[objectIndex].transform; + objectIndex = getNextPathPoint(objectIndex); + nextTransform = objectList[objectIndex].transform; + positionTweener.InitTweener(tweenTime, 0f, 1f); + _currentTweenInterval = tweenInterval; + } + } + } + } + } +} diff --git a/src/Fie.Title/FieTitleOrbitalParticle.cs b/src/Fie.Title/FieTitleOrbitalParticle.cs new file mode 100644 index 0000000..71d687e --- /dev/null +++ b/src/Fie.Title/FieTitleOrbitalParticle.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleOrbitalParticle : MonoBehaviour + { + [SerializeField] + private Transform _orbitCenterTransform; + + [SerializeField] + private Transform _orbitRadiucTransform; + + [SerializeField] + private PKFxFX _orbitalParticle; + + private PKFxManager.Attribute _orbitalAttribute; + + private bool _isEnable = true; + + private void Awake() + { + _orbitalAttribute = new PKFxManager.Attribute("OrbitalRadius", 1f); + int qualityLevel = QualitySettings.GetQualityLevel(); + if (qualityLevel == 0 || qualityLevel == 1) + { + if (_orbitalParticle.Alive()) + { + _orbitalParticle.KillEffect(); + } + _isEnable = false; + } + } + + private void LateUpdate() + { + if (_isEnable && _orbitalParticle.AttributeExists(_orbitalAttribute.m_Descriptor)) + { + _orbitalAttribute.ValueFloat = Vector3.Distance(_orbitCenterTransform.position, _orbitRadiucTransform.position); + _orbitalParticle.SetAttribute(_orbitalAttribute); + } + } + } +} diff --git a/src/Fie.Title/FieTitleVersionNumberDrawer.cs b/src/Fie.Title/FieTitleVersionNumberDrawer.cs new file mode 100644 index 0000000..58335c7 --- /dev/null +++ b/src/Fie.Title/FieTitleVersionNumberDrawer.cs @@ -0,0 +1,20 @@ +using Fie.Manager; +using TMPro; +using UnityEngine; + +namespace Fie.Title +{ + public class FieTitleVersionNumberDrawer : MonoBehaviour + { + [SerializeField] + private TextMeshProUGUI _textField; + + private void Start() + { + if (!(_textField == null)) + { + _textField.text = FieManagerBehaviour.I.getVersionString(); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconApplejack.cs b/src/Fie.UI/FieGameUIAbilitiesIconApplejack.cs new file mode 100644 index 0000000..174c8a8 --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconApplejack.cs @@ -0,0 +1,6 @@ +namespace Fie.UI +{ + public class FieGameUIAbilitiesIconApplejack : FieGameUIAbilitiesIconBase + { + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconBase.cs b/src/Fie.UI/FieGameUIAbilitiesIconBase.cs new file mode 100644 index 0000000..8e79629 --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconBase.cs @@ -0,0 +1,130 @@ +using Fie.Object; +using Fie.Object.Abilities; +using Spine.Unity; +using System; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUIAbilitiesIconBase : FieGameUIBase + { + public enum AbilitiesIconAnimationTrack + { + SET_ICON, + ACTIVATE, + ENABLE_OR_DISABLE + } + + private const string ABILITYES_ICON_SET_ANIMATION_PREFIX = "ability_"; + + private const string ABILITYES_ICON_ACTIVATE_ANIMATION = "activate"; + + private const string ABILITYES_ICON_DISABLE_ANIMATION = "disable"; + + private const string ABILITYES_ICON_ENABLE_ANIMATION = "enable"; + + [SerializeField] + private TextMesh _cooldownCounter; + + private FieAbilitiesSlot.SlotType _slotID; + + private FieAbilitiesCooldown _cooldownController; + + private SkeletonAnimation _skeletonAnimation; + + private FieStateMachineAbilityInterface _abilityInstance; + + private bool _isEnable = true; + + public FieStateMachineAbilityInterface abilityInstance + { + set + { + _abilityInstance = value; + SetAbilityIcon(_abilityInstance); + } + } + + protected void Awake() + { + _skeletonAnimation = GetComponent(); + if (_skeletonAnimation == null) + { + throw new Exception("this component require SkeletonAnimation. but didn't."); + } + } + + protected void Start() + { + Initialize(); + } + + private void LateUpdate() + { + if (!(base.ownerCharacter == null) && _cooldownController != null) + { + if (_cooldownController.cooldown > 0f) + { + if (_cooldownController.cooldown >= 10f) + { + _cooldownCounter.text = $"{_cooldownController.cooldown:f0}"; + } + else + { + _cooldownCounter.text = $"{_cooldownController.cooldown:f1}"; + } + if (_isEnable) + { + _skeletonAnimation.state.SetAnimation(2, "disable", loop: false); + _isEnable = false; + } + } + else if (!_isEnable) + { + _cooldownCounter.text = string.Empty; + _skeletonAnimation.state.SetAnimation(2, "enable", loop: false); + _isEnable = true; + } + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.abilityActivateEvent += ownerPony_abilityActivateEvent; + } + } + + private void OnDestroy() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.abilityActivateEvent -= ownerPony_abilityActivateEvent; + } + } + + internal void SetSlot(FieAbilitiesSlot.SlotType slotID) + { + _slotID = slotID; + _cooldownController = base.ownerCharacter.abilitiesContainer.GetCooldownController(slotID); + } + + private void SetAbilityIcon(FieStateMachineAbilityInterface abilityInstance) + { + if (abilityInstance != null) + { + _skeletonAnimation.state.SetAnimation(0, "ability_" + abilityInstance.getSignature(), loop: false); + } + } + + private void ownerPony_abilityActivateEvent(Type abilityType) + { + if (_abilityInstance.GetType() == abilityType) + { + _skeletonAnimation.state.SetAnimation(1, "activate", loop: false); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconManager.cs b/src/Fie.UI/FieGameUIAbilitiesIconManager.cs new file mode 100644 index 0000000..e3b4506 --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconManager.cs @@ -0,0 +1,89 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.Ponies; +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace Fie.UI +{ + public class FieGameUIAbilitiesIconManager : FieGameUIComponentManagerBase + { + private Dictionary _abilityIconList = new Dictionary(); + + public override void StartUp() + { + FiePonies fiePonies = base.componentManagerOwner as FiePonies; + if (!(fiePonies == null)) + { + KeyValuePair abilitiesIconInfo = fiePonies.getAbilitiesIconInfo(); + MethodInfo method = GetType().GetMethod("CreateAbilitiesIcons"); + if (method != null) + { + MethodInfo methodInfo = method.MakeGenericMethod(abilitiesIconInfo.Key); + if (methodInfo != null) + { + object[] parameters = new object[2] + { + fiePonies, + abilitiesIconInfo.Value + }; + methodInfo.Invoke(this, parameters); + Relocate(); + } + } + } + } + + public void CreateAbilitiesIcons(FiePonies ownerPony, string prefabPath) where T : FieGameUIAbilitiesIconBase + { + for (int i = 0; i < 3; i++) + { + FieManagerBehaviour.I.AssignGameUIObject(prefabPath); + FieStateMachineAbilityInterface abilityInstance = ownerPony.getAbilityInstance((FieAbilitiesSlot.SlotType)i); + if (abilityInstance != null) + { + FieGameUIAbilitiesIconBase fieGameUIAbilitiesIconBase = FieManagerBehaviour.I.CreateGui(ownerPony); + fieGameUIAbilitiesIconBase.SetSlot((FieAbilitiesSlot.SlotType)i); + fieGameUIAbilitiesIconBase.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUIAbilitiesIconBase.abilityInstance = abilityInstance; + _abilityIconList[i] = fieGameUIAbilitiesIconBase; + } + } + } + + public void Relocate() + { + for (int i = 0; i < 3; i++) + { + if (_abilityIconList.ContainsKey(i)) + { + FieGUIManager.FieUIPositionTag key = FieGUIManager.FieUIPositionTag.ABILITY_ICON_1; + switch (i) + { + case 0: + key = FieGUIManager.FieUIPositionTag.ABILITY_ICON_1; + break; + case 1: + key = FieGUIManager.FieUIPositionTag.ABILITY_ICON_2; + break; + case 2: + key = FieGUIManager.FieUIPositionTag.ABILITY_ICON_3; + break; + } + if (FieManagerBehaviour.I.uiPositionList[key] != null) + { + _abilityIconList[i].transform.position = FieManagerBehaviour.I.uiPositionList[key].position; + _abilityIconList[i].transform.parent = FieManagerBehaviour.I.uiPositionList[key]; + } + } + } + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + base.setComponentManagerOwner(owner); + } + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconRainbowDash.cs b/src/Fie.UI/FieGameUIAbilitiesIconRainbowDash.cs new file mode 100644 index 0000000..331ed6c --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconRainbowDash.cs @@ -0,0 +1,6 @@ +namespace Fie.UI +{ + public class FieGameUIAbilitiesIconRainbowDash : FieGameUIAbilitiesIconBase + { + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconRisingSun.cs b/src/Fie.UI/FieGameUIAbilitiesIconRisingSun.cs new file mode 100644 index 0000000..0113554 --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconRisingSun.cs @@ -0,0 +1,6 @@ +namespace Fie.UI +{ + public class FieGameUIAbilitiesIconRisingSun : FieGameUIAbilitiesIconBase + { + } +} diff --git a/src/Fie.UI/FieGameUIAbilitiesIconTwilight.cs b/src/Fie.UI/FieGameUIAbilitiesIconTwilight.cs new file mode 100644 index 0000000..e5aabf7 --- /dev/null +++ b/src/Fie.UI/FieGameUIAbilitiesIconTwilight.cs @@ -0,0 +1,6 @@ +namespace Fie.UI +{ + public class FieGameUIAbilitiesIconTwilight : FieGameUIAbilitiesIconBase + { + } +} diff --git a/src/Fie.UI/FieGameUIActivityWindow.cs b/src/Fie.UI/FieGameUIActivityWindow.cs new file mode 100644 index 0000000..5363ad3 --- /dev/null +++ b/src/Fie.UI/FieGameUIActivityWindow.cs @@ -0,0 +1,112 @@ +using Fie.Utility; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIActivityWindow : FieGameUIBase + { + public enum ActivityWindowState + { + IDLE, + SHOWING, + HIDING, + BUSY + } + + [SerializeField] + private RectTransform windowRectTransform; + + [SerializeField] + private float tweenTime = 0.3f; + + [SerializeField] + private float minWindowSizeWidth = 192f; + + [SerializeField] + private float minWindowSizeHeight = 192f; + + [SerializeField] + private float windowSizeMarginWidth = 64f; + + [SerializeField] + private float windowSizeMarginHeight = 64f; + + [SerializeField] + private FieGameUIActivityWindowText titleTextComponent; + + [SerializeField] + private FieGameUIActivityWindowText noteTextComponent; + + private Tweener _showingTweener = new Tweener(); + + private Tweener _hidingTweener = new Tweener(); + + private Vector2 _currentWindowTargetSize = Vector2.zero; + + private float _currentSizeRate; + + private ActivityWindowState _activityWindowState; + + public ActivityWindowState activityWindowState => _activityWindowState; + + private void Start() + { + titleTextComponent.SetText(string.Empty); + titleTextComponent.SetText(string.Empty); + _currentWindowTargetSize = Vector2.zero; + windowRectTransform.sizeDelta = _currentWindowTargetSize; + } + + public void HideText() + { + if (!_showingTweener.IsEnd()) + { + _showingTweener = new Tweener(); + } + titleTextComponent.HideText(); + noteTextComponent.HideText(); + _hidingTweener.InitTweener(tweenTime, _currentSizeRate, 0f); + _activityWindowState = ActivityWindowState.HIDING; + } + + public void ShowText(string titleText, string noteText) + { + if (!_hidingTweener.IsEnd()) + { + _hidingTweener = new Tweener(); + } + Vector2 vector = titleTextComponent.SetText(titleText); + Vector2 vector2 = noteTextComponent.SetText(noteText); + _currentWindowTargetSize.x = Mathf.Max(Mathf.Max(vector.x, vector2.x) + windowSizeMarginWidth, minWindowSizeWidth); + _currentWindowTargetSize.y = Mathf.Max(Mathf.Max(vector.y, vector2.y) + windowSizeMarginHeight, minWindowSizeHeight); + _showingTweener.InitTweener(tweenTime, _currentSizeRate, 1f); + _activityWindowState = ActivityWindowState.SHOWING; + } + + private void Update() + { + if (!(windowRectTransform == null)) + { + if (!_hidingTweener.IsEnd()) + { + _currentSizeRate = _hidingTweener.UpdateParameterFloat(Time.deltaTime); + if (_hidingTweener.IsEnd()) + { + _activityWindowState = ActivityWindowState.IDLE; + } + } + else if (!_showingTweener.IsEnd()) + { + _currentSizeRate = _showingTweener.UpdateParameterFloat(Time.deltaTime); + if (_showingTweener.IsEnd()) + { + titleTextComponent.ShowText(); + noteTextComponent.ShowText(); + _activityWindowState = ActivityWindowState.IDLE; + } + } + windowRectTransform.sizeDelta = _currentWindowTargetSize * _currentSizeRate; + } + } + } +} diff --git a/src/Fie.UI/FieGameUIActivityWindowManager.cs b/src/Fie.UI/FieGameUIActivityWindowManager.cs new file mode 100644 index 0000000..6d2d29c --- /dev/null +++ b/src/Fie.UI/FieGameUIActivityWindowManager.cs @@ -0,0 +1,60 @@ +using Fie.Manager; +using Fie.Scene; +using GameDataEditor; + +namespace Fie.UI +{ + public class FieGameUIActivityWindowManager : FieGameUIComponentManagerBase + { + private FieGameUIActivityWindow _activityWindow; + + public override void StartUp() + { + if (_activityWindow == null) + { + _activityWindow = FieManagerBehaviour.I.CreateGui(null); + _activityWindow.uiCamera = FieManagerBehaviour.I.uiCamera; + FieManagerBehaviour.I.activityStartEvent += ActivityStartEventCallback; + FieManagerBehaviour.I.activityEndEvent += ActivityEndEventCallback; + if (FieManagerFactory.I.currentSceneType == FieSceneType.INGAME) + { + FieManagerBehaviour.I.GameOverEvent += GameOverCallback; + } + } + } + + private void GameOverCallback() + { + FieManagerBehaviour.I.RequestToHideActivity(); + } + + private void ActivityStartEventCallback(GDEConstantTextListData titleTextData, GDEConstantTextListData noteTextData, string titleString = "", string noteString = "") + { + string titleText = (!(titleString == string.Empty)) ? titleString : FieLocalizeUtility.GetConstantText(titleTextData.Key); + string noteText = (!(noteString == string.Empty)) ? noteString : FieLocalizeUtility.GetConstantText(noteTextData.Key); + _activityWindow.ShowText(titleText, noteText); + } + + private void ActivityEndEventCallback(GDEConstantTextListData titleTextData, GDEConstantTextListData noteTextData, string titleString = "", string noteString = "") + { + _activityWindow.HideText(); + } + + public void Relocate() + { + } + + public FieGameUIActivityWindow.ActivityWindowState GetActivityWindowState() + { + if (_activityWindow == null) + { + return FieGameUIActivityWindow.ActivityWindowState.BUSY; + } + return _activityWindow.activityWindowState; + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + } + } +} diff --git a/src/Fie.UI/FieGameUIActivityWindowText.cs b/src/Fie.UI/FieGameUIActivityWindowText.cs new file mode 100644 index 0000000..9304b1d --- /dev/null +++ b/src/Fie.UI/FieGameUIActivityWindowText.cs @@ -0,0 +1,78 @@ +using Fie.Manager; +using Fie.Utility; +using TMPro; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIActivityWindowText : MonoBehaviour + { + private TextMeshProUGUI textComponent; + + private Tweener _colorTweener = new Tweener(); + + private float _nowRate; + + private float _delay; + + private void Awake() + { + textComponent = GetComponent(); + textComponent.font = FieManagerBehaviour.I.currentFont; + } + + public Vector2 SetText(string text) + { + textComponent.text = text; + textComponent.ForceMeshUpdate(); + return new Vector2(textComponent.renderedWidth, textComponent.renderedHeight); + } + + public void HideText(float showTime = 0.3f) + { + if (showTime > 0f) + { + _delay = showTime; + _colorTweener.InitTweener(showTime, _nowRate, 0f); + } + else + { + textComponent.color = Color.white * 0f; + _nowRate = 0f; + _colorTweener.Finish(); + } + } + + public void ShowText(float showTime = 0.3f) + { + if (showTime > 0f) + { + _delay = showTime; + _nowRate = 0f; + _colorTweener.InitTweener(showTime, _nowRate, 1f); + } + else + { + textComponent.color = Color.white; + _nowRate = 1f; + _colorTweener.Finish(); + } + } + + private void Update() + { + if (_delay > 0f) + { + _delay -= Time.deltaTime; + } + else + { + if (!_colorTweener.IsEnd()) + { + _nowRate = _colorTweener.UpdateParameterFloat(Time.deltaTime); + } + textComponent.color = Color.white * _nowRate; + } + } + } +} diff --git a/src/Fie.UI/FieGameUIBase.cs b/src/Fie.UI/FieGameUIBase.cs new file mode 100644 index 0000000..5a55b24 --- /dev/null +++ b/src/Fie.UI/FieGameUIBase.cs @@ -0,0 +1,69 @@ +using Fie.Camera; +using Fie.Manager; +using UnityEngine; + +namespace Fie.UI +{ + public abstract class FieGameUIBase : MonoBehaviour + { + private FieUICamera _uiCamera; + + private FieGameCharacter _ownerCharacter; + + private bool _active; + + public FieUICamera uiCamera + { + get + { + return _uiCamera; + } + set + { + _uiCamera = value; + } + } + + public FieGameCharacter ownerCharacter + { + get + { + return _ownerCharacter; + } + set + { + _ownerCharacter = value; + } + } + + public bool uiActive + { + get + { + return _active; + } + set + { + base.gameObject.SetActive(value); + _active = value; + } + } + + public virtual void Initialize() + { + } + + public virtual void Terminate() + { + } + + public void SetUILayer(FieGUIManager.FieUILayer layer) + { + Transform transform = base.transform; + Vector3 position = base.transform.position; + float x = position.x; + Vector3 position2 = base.transform.position; + transform.position = new Vector3(x, position2.y, (float)layer); + } + } +} diff --git a/src/Fie.UI/FieGameUIComponentManagerBase.cs b/src/Fie.UI/FieGameUIComponentManagerBase.cs new file mode 100644 index 0000000..571a9d7 --- /dev/null +++ b/src/Fie.UI/FieGameUIComponentManagerBase.cs @@ -0,0 +1,20 @@ +using UnityEngine; + +namespace Fie.UI +{ + public abstract class FieGameUIComponentManagerBase : MonoBehaviour + { + private FieGameCharacter _componentManagerOwner; + + public FieGameCharacter componentManagerOwner => _componentManagerOwner; + + public virtual void setComponentManagerOwner(FieGameCharacter owner) + { + _componentManagerOwner = owner; + } + + public virtual void StartUp() + { + } + } +} diff --git a/src/Fie.UI/FieGameUIDamageCounter.cs b/src/Fie.UI/FieGameUIDamageCounter.cs new file mode 100644 index 0000000..d4162d6 --- /dev/null +++ b/src/Fie.UI/FieGameUIDamageCounter.cs @@ -0,0 +1,195 @@ +using Fie.Object; +using Fie.Utility; +using System; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(PKFxFX))] + public class FieGameUIDamageCounter : FieGameUIBase + { + private const string FX_DAMAGE_VALUE_NAME = "Value"; + + private const string FX_SIZE_RATIO_NAME = "SizeRatio"; + + private const string FX_IS_EFFECTIVE_NAME = "IsEffective"; + + private const string FX_WIGGLE_VEC_NAME = "WiggleVec"; + + private const string FX_RGB_NAME = "RGB"; + + private const string FX_EFFECTIVE_RGB_NAME = "EffectiveRGB"; + + [SerializeField] + private Color defaultDamageColor; + + [SerializeField] + private Color earthDamageColor; + + [SerializeField] + private Color magicDamageColor; + + [SerializeField] + private Color wingDamageColor; + + [SerializeField] + private Color playerDamageColor; + + [Range(0f, 10f)] + [SerializeField] + private float defaultSizeRate = 1.25f; + + [Range(0f, 10f)] + [SerializeField] + private float effectiveSizeRate = 1.5f; + + [Range(0f, 1f)] + [SerializeField] + private float nonEffectiveColorRate = 0.1f; + + [Range(0f, 10f)] + [SerializeField] + private float nonEffectiveSizeRate = 1f; + + [SerializeField] + private float addDigitSizeRatio = 0.25f; + + [NonSerialized] + private PKFxFX damageCounterFx; + + private Tweener _wigglerTweener = new Tweener(); + + private Vector3 _wiggleRange = Vector3.zero; + + private PKFxManager.Attribute _damageValueAttr; + + private PKFxManager.Attribute _sizeRatioAttr; + + private PKFxManager.Attribute _isEffectiveAttr; + + private PKFxManager.Attribute _wiggleAttr; + + private PKFxManager.Attribute _colorAttr; + + private PKFxManager.Attribute _isEffectiveColorAttr; + + protected void Awake() + { + damageCounterFx = base.gameObject.GetComponent(); + _damageValueAttr = new PKFxManager.Attribute("Value", 0f); + _sizeRatioAttr = new PKFxManager.Attribute("SizeRatio", 0f); + _isEffectiveAttr = new PKFxManager.Attribute("IsEffective", 0f); + _wiggleAttr = new PKFxManager.Attribute("WiggleVec", Vector3.zero); + _colorAttr = new PKFxManager.Attribute("RGB", Vector3.zero); + _isEffectiveColorAttr = new PKFxManager.Attribute("EffectiveRGB", Vector3.zero); + } + + protected void LateUpdate() + { + if (base.ownerCharacter == null) + { + base.uiActive = false; + } + else + { + if (!_wigglerTweener.IsEnd()) + { + _wiggleRange = _wigglerTweener.UpdateParameterVec3(Time.deltaTime); + } + base.transform.position = base.ownerCharacter.guiPointTransform.position; + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damageEvent; + damageCounterFx = base.gameObject.GetComponent(); + damageCounterFx.BaseInitialize(); + } + } + + private void OnDestroy() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damageEvent; + damageCounterFx.KillEffect(); + damageCounterFx.StopEffect(); + } + } + + private void HealthSystem_damageEvent(FieGameCharacter attacker, FieDamage damage) + { + if (!(base.ownerCharacter == null) && damage != null) + { + int num = Mathf.RoundToInt(Mathf.Clamp(damage.finallyDamage, 0f, 99999f)); + if (num > 0) + { + Color a = defaultDamageColor; + float num2 = defaultSizeRate; + bool flag = false; + if (base.ownerCharacter.forces != 0) + { + switch (damage.attribute) + { + case FieAttribute.EARTH: + a = earthDamageColor; + break; + case FieAttribute.MAGIC: + a = magicDamageColor; + break; + case FieAttribute.WING: + a = wingDamageColor; + break; + } + } + else + { + a = playerDamageColor; + } + if (damage.attributeDamageState == FieDamage.FieAttributeDamageState.EFFECTIVE) + { + num2 = effectiveSizeRate; + flag = true; + } + else if (damage.attributeDamageState == FieDamage.FieAttributeDamageState.NONEFFECTIVE) + { + num2 = nonEffectiveSizeRate; + a *= nonEffectiveColorRate; + } + float num3 = 1f; + if (num >= 100) + { + num3 += addDigitSizeRatio; + } + if (num >= 1000) + { + num3 += addDigitSizeRatio; + } + num2 *= num3; + _damageValueAttr.ValueFloat = (float)num; + _sizeRatioAttr.ValueFloat = num2; + _isEffectiveAttr.ValueFloat = ((!flag) ? 0f : 1f); + _wiggleAttr.ValueFloat3 = _wiggleRange; + _colorAttr.m_Value0 = a.r; + _colorAttr.m_Value1 = a.g; + _colorAttr.m_Value2 = a.b; + _isEffectiveColorAttr.m_Value0 = a.r; + _isEffectiveColorAttr.m_Value1 = a.g; + _isEffectiveColorAttr.m_Value2 = a.b; + damageCounterFx.SetAttribute(_damageValueAttr); + damageCounterFx.SetAttribute(_sizeRatioAttr); + damageCounterFx.SetAttribute(_isEffectiveAttr); + damageCounterFx.SetAttribute(_wiggleAttr); + damageCounterFx.SetAttribute(_colorAttr); + damageCounterFx.SetAttribute(_isEffectiveColorAttr); + damageCounterFx.StopEffect(); + damageCounterFx.StartEffect(); + _wigglerTweener.InitTweener(0.5f, new Vector3(UnityEngine.Random.Range(-0.5f, 0.5f), UnityEngine.Random.Range(0f, 0.5f), UnityEngine.Random.Range(-0.5f, 0.5f)), Vector3.zero); + } + } + } + } +} diff --git a/src/Fie.UI/FieGameUIDamageCounterManager.cs b/src/Fie.UI/FieGameUIDamageCounterManager.cs new file mode 100644 index 0000000..1eaaf9d --- /dev/null +++ b/src/Fie.UI/FieGameUIDamageCounterManager.cs @@ -0,0 +1,72 @@ +using Fie.Manager; +using System.Collections.Generic; + +namespace Fie.UI +{ + public class FieGameUIDamageCounterManager : FieGameUIComponentManagerBase + { + private Dictionary _damageCounterList = new Dictionary(); + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + base.setComponentManagerOwner(owner); + owner.detector.locatedEvent += Detector_locatedEvent; + owner.detector.missedEvent += Detector_missedEvent; + } + + private void OnDestroy() + { + if (base.componentManagerOwner != null) + { + base.componentManagerOwner.detector.locatedEvent -= Detector_locatedEvent; + base.componentManagerOwner.detector.missedEvent -= Detector_missedEvent; + } + } + + private void Detector_missedEvent(FieGameCharacter targetCharacter) + { + cleanupListsData(); + } + + private void Detector_locatedEvent(FieGameCharacter targetCharacter) + { + if (!(targetCharacter == null)) + { + cleanupListsData(); + int instanceID = targetCharacter.gameObject.GetInstanceID(); + if (!_damageCounterList.ContainsKey(instanceID)) + { + FieGameUIDamageCounter fieGameUIDamageCounter = FieManagerBehaviour.I.CreateGui(targetCharacter); + if (fieGameUIDamageCounter == null) + { + return; + } + _damageCounterList[instanceID] = fieGameUIDamageCounter; + } + else + { + _damageCounterList[instanceID].uiActive = true; + } + _damageCounterList[instanceID].uiCamera = FieManagerBehaviour.I.uiCamera; + _damageCounterList[instanceID].ownerCharacter = targetCharacter; + _damageCounterList[instanceID].Initialize(); + } + } + + private void cleanupListsData() + { + List list = new List(); + foreach (KeyValuePair damageCounter in _damageCounterList) + { + if (damageCounter.Value.ownerCharacter == null) + { + list.Add(damageCounter.Key); + } + } + foreach (int item in list) + { + _damageCounterList.Remove(item); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIDialogCaption.cs b/src/Fie.UI/FieGameUIDialogCaption.cs new file mode 100644 index 0000000..3f4f52c --- /dev/null +++ b/src/Fie.UI/FieGameUIDialogCaption.cs @@ -0,0 +1,33 @@ +using Fie.Manager; +using TMPro; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIDialogCaption : FieGameUIBase + { + [SerializeField] + private TextMeshProUGUI _captionText; + + private void Awake() + { + _captionText.font = FieManagerBehaviour.I.currentFont; + } + + public void SetText(string text) + { + if (!(_captionText == null)) + { + _captionText.text = text; + } + } + + public void ClearText() + { + if (!(_captionText == null)) + { + _captionText.text = string.Empty; + } + } + } +} diff --git a/src/Fie.UI/FieGameUIDialogCaptionManager.cs b/src/Fie.UI/FieGameUIDialogCaptionManager.cs new file mode 100644 index 0000000..b62afb2 --- /dev/null +++ b/src/Fie.UI/FieGameUIDialogCaptionManager.cs @@ -0,0 +1,90 @@ +using Fie.Manager; +using GameDataEditor; +using System.Collections; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIDialogCaptionManager : FieGameUIComponentManagerBase + { + private const float DIALOG_CLEAR_DELAY = 1.25f; + + private const string DEFAULT_TEXT_USERNAME_SIGNATURE = "%USERNAME%"; + + private const string DEFAULT_TEXT_ENTITY_SIGNATURE = "%ENTITY%"; + + private const string DEFAULT_TEXT_FORMAT = "%USERNAME% : %ENTITY%"; + + private FieGameUIDialogCaption _dialogCaption; + + private Coroutine dialogClearTask; + + private IEnumerator DialogClaerTask(float delay) + { + if (!(_dialogCaption == null)) + { + yield return (object)new WaitForSeconds(delay); + /*Error: Unable to find new state assignment for yield return*/; + } + } + + public override void StartUp() + { + if (_dialogCaption == null) + { + _dialogCaption = FieManagerBehaviour.I.CreateGui(null); + _dialogCaption.uiCamera = FieManagerBehaviour.I.uiCamera; + FieManagerBehaviour.I.dialogStartEvent += DialogChangedCallback; + FieManagerBehaviour.I.dialogEndEvent += DialogEndCallback; + } + } + + private void DialogChangedCallback(FieGameCharacter actor, GDEWordScriptsListData dialogData) + { + if (!(_dialogCaption == null)) + { + if (dialogClearTask != null) + { + StopCoroutine(dialogClearTask); + } + string text = "%USERNAME% : %ENTITY%"; + if (!(actor == null)) + { + text = ((actor.ownerUser != null) ? text.Replace("%USERNAME%", actor.ownerUser.userName) : text.Replace("%USERNAME%", actor.getDefaultName())); + text = text.Replace("%ENTITY%", FieLocalizeUtility.GetWordScriptText(dialogData.Key)); + _dialogCaption.SetText(text); + } + } + } + + private void DialogEndCallback(FieGameCharacter actor, GDEWordScriptsListData dialogData) + { + if (this != null && base.gameObject != null) + { + if (dialogClearTask != null) + { + StopCoroutine(dialogClearTask); + } + dialogClearTask = StartCoroutine(DialogClaerTask(1.25f)); + } + } + + public void Relocate() + { + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + } + + public void SetText(string text) + { + _dialogCaption.SetText(text); + } + + public void ClearText() + { + _dialogCaption.ClearText(); + } + } +} diff --git a/src/Fie.UI/FieGameUIEnemyLifeGauge.cs b/src/Fie.UI/FieGameUIEnemyLifeGauge.cs new file mode 100644 index 0000000..dd20a08 --- /dev/null +++ b/src/Fie.UI/FieGameUIEnemyLifeGauge.cs @@ -0,0 +1,6 @@ +namespace Fie.UI +{ + public class FieGameUIEnemyLifeGauge : FieGameUILifeGaugeBase + { + } +} diff --git a/src/Fie.UI/FieGameUIEnemyLifeGaugeManager.cs b/src/Fie.UI/FieGameUIEnemyLifeGaugeManager.cs new file mode 100644 index 0000000..93ae077 --- /dev/null +++ b/src/Fie.UI/FieGameUIEnemyLifeGaugeManager.cs @@ -0,0 +1,73 @@ +using Fie.Manager; +using System.Collections.Generic; + +namespace Fie.UI +{ + public class FieGameUIEnemyLifeGaugeManager : FieGameUIComponentManagerBase + { + private Dictionary _lifeGaugeList = new Dictionary(); + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + base.setComponentManagerOwner(owner); + owner.detector.locatedEvent += Detector_locatedEvent; + owner.detector.missedEvent += Detector_missedEvent; + } + + private void OnDestroy() + { + if (base.componentManagerOwner != null) + { + base.componentManagerOwner.detector.locatedEvent -= Detector_locatedEvent; + base.componentManagerOwner.detector.missedEvent -= Detector_missedEvent; + } + } + + private void Detector_missedEvent(FieGameCharacter targetCharacter) + { + cleanupListsData(); + } + + private void Detector_locatedEvent(FieGameCharacter targetCharacter) + { + if (!(base.componentManagerOwner.detector.enemyTag != targetCharacter.tag) && !(targetCharacter == null)) + { + cleanupListsData(); + int instanceID = targetCharacter.gameObject.GetInstanceID(); + if (!_lifeGaugeList.ContainsKey(instanceID)) + { + FieGameUIEnemyLifeGauge fieGameUIEnemyLifeGauge = FieManagerBehaviour.I.CreateGui(targetCharacter); + if (fieGameUIEnemyLifeGauge == null) + { + return; + } + _lifeGaugeList[instanceID] = fieGameUIEnemyLifeGauge; + } + else + { + _lifeGaugeList[instanceID].uiActive = true; + } + _lifeGaugeList[instanceID].uiCamera = FieManagerBehaviour.I.uiCamera; + _lifeGaugeList[instanceID].ownerCharacter = targetCharacter; + _lifeGaugeList[instanceID].Initialize(); + _lifeGaugeList[instanceID].currentLayer = FieGUIManager.FieUILayer.BACKWORD_SECOND; + } + } + + private void cleanupListsData() + { + List list = new List(); + foreach (KeyValuePair lifeGauge in _lifeGaugeList) + { + if (lifeGauge.Value.ownerCharacter == null) + { + list.Add(lifeGauge.Key); + } + } + foreach (int item in list) + { + _lifeGaugeList.Remove(item); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIFriendshipGauge.cs b/src/Fie.UI/FieGameUIFriendshipGauge.cs new file mode 100644 index 0000000..9e67a3d --- /dev/null +++ b/src/Fie.UI/FieGameUIFriendshipGauge.cs @@ -0,0 +1,134 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using Spine.Unity; +using System; +using System.Collections; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUIFriendshipGauge : FieGameUIBase + { + public enum FriendshipGaugeAnimationTrack + { + COLOR_AND_ALPHA, + GAUGE + } + + public FieGUIManager.FieUILayer currentLayer = FieGUIManager.FieUILayer.DEFAULT; + + protected const float GAUGE_ANIMATION_DURATION = 0.2f; + + protected const string GAUGE_ANIMATION = "gauge_animation"; + + protected const string GAUGE_ANIMATION_OFF = "off"; + + protected const string GAUGE_ANIMATION_ON = "on"; + + protected SkeletonAnimation _skeletonAnimation; + + protected FieSkeletonAnimationController _animationManager; + + private float _currentFriendship; + + private float _maxFriendship; + + private float _animationFriendship; + + private bool _isEnd; + + private Tweener _gaugeTweener = new Tweener(); + + private TrackEntry _gaugeAnimationEntry; + + protected void Awake() + { + _skeletonAnimation = GetComponent(); + if (_skeletonAnimation == null) + { + throw new Exception("this component require SkeletonAnimation. but didn't."); + } + } + + protected void OnEnable() + { + Initialize(); + } + + private IEnumerator endAnimation() + { + yield return (object)new WaitForSeconds(0.2f); + /*Error: Unable to find new state assignment for yield return*/; + } + + protected void LateUpdate() + { + _animationFriendship = _gaugeTweener.UpdateParameterFloat(Time.deltaTime); + if (!_gaugeTweener.IsEnd()) + { + updateGaugeState(_gaugeAnimationEntry); + } + if (!(base.uiCamera == null)) + { + if (base.ownerCharacter == null) + { + if (!_isEnd) + { + Terminate(); + _isEnd = true; + } + } + else if (base.ownerCharacter.friendshipStats.friendship != _currentFriendship) + { + _currentFriendship = base.ownerCharacter.friendshipStats.friendship; + _gaugeTweener.InitTweener(0.2f, _animationFriendship, _currentFriendship); + } + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + TrackEntry trackEntry = _skeletonAnimation.state.SetAnimation(0, "on", loop: true); + if (trackEntry != null) + { + trackEntry.timeScale = 1f; + } + _maxFriendship = base.ownerCharacter.friendshipStats.getMaxFriendship(); + _animationFriendship = (_currentFriendship = base.ownerCharacter.friendshipStats.friendship); + _gaugeTweener.InitTweener(0.2f, _currentFriendship, _currentFriendship); + initGaugeAnimation(); + updateGaugeState(_gaugeAnimationEntry); + _isEnd = false; + } + } + + private void initGaugeAnimation() + { + _gaugeAnimationEntry = _skeletonAnimation.state.SetAnimation(1, "gauge_animation", loop: false); + } + + public override void Terminate() + { + if (base.gameObject.activeSelf) + { + StartCoroutine(endAnimation()); + } + } + + private void updateGaugeState(TrackEntry entry) + { + if (entry != null) + { + float num = _animationFriendship / _maxFriendship; + float num2 = entry.endTime - 0.024f; + entry.Time = Mathf.Max(Mathf.Min(num * num2, num2), 0f); + entry.TimeScale = 0f; + } + } + } +} diff --git a/src/Fie.UI/FieGameUIGainedScore.cs b/src/Fie.UI/FieGameUIGainedScore.cs new file mode 100644 index 0000000..83da3df --- /dev/null +++ b/src/Fie.UI/FieGameUIGainedScore.cs @@ -0,0 +1,53 @@ +using Fie.Object; +using Fie.Utility; +using GameDataEditor; +using TMPro; +using UnityEngine; + +namespace Fie.UI +{ + [FiePrefabInfo("Prefabs/UI/GainedScore/FieGainedScoreUI")] + public class FieGameUIGainedScore : FieEmittableObjectBase + { + [SerializeField] + private float MOVING_SPEED_PAR_SEC = 0.25f; + + [SerializeField] + private TextMeshPro _textMesh; + + private const float duration = 5f; + + private Tweener _alphaTweener = new Tweener(); + + public override void awakeEmitObject() + { + destoryEmitObject(5f); + _alphaTweener.InitTweener(5f, 1f, 0f); + } + + public void SetScore(int score, bool isDefeater) + { + string empty = string.Empty; + empty = ((!isDefeater) ? FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_GAINED_SCORE_ASSIST) : FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_GAINED_SCORE_DEFEAT)); + empty = empty.Replace("___Value1___", score.ToString()); + _textMesh.text = empty; + } + + private void Update() + { + Transform transform = base.transform; + Vector3 position = base.transform.position; + float x = position.x; + Vector3 position2 = base.transform.position; + float y = position2.y + MOVING_SPEED_PAR_SEC * Time.deltaTime; + Vector3 position3 = base.transform.position; + transform.position = new Vector3(x, y, position3.z); + if (!_alphaTweener.IsEnd()) + { + float num = _alphaTweener.UpdateParameterFloat(Time.deltaTime); + _textMesh.color = new Color(1f, 1f, 1f, 1f * num); + } + base.transform.rotation = Quaternion.identity; + } + } +} diff --git a/src/Fie.UI/FieGameUIGameOverWindow.cs b/src/Fie.UI/FieGameUIGameOverWindow.cs new file mode 100644 index 0000000..9d71cfd --- /dev/null +++ b/src/Fie.UI/FieGameUIGameOverWindow.cs @@ -0,0 +1,132 @@ +using Fie.Manager; +using Fie.Utility; +using UnityEngine; +using UnityEngine.UI; + +namespace Fie.UI +{ + public class FieGameUIGameOverWindow : FieGameUIBase + { + private delegate void tweenFinishedCallback(); + + [SerializeField] + private GameObject _rootPanelGameObject; + + [SerializeField] + private Button _retryButton; + + [SerializeField] + private Button _quitButton; + + [SerializeField] + private AudioSource _gameOverSoundEffect; + + [SerializeField] + private GameObject _objectsForHostPlayer; + + [SerializeField] + private GameObject _objectsForClientPlayer; + + private Tweener _scaleTweener = new Tweener(); + + private tweenFinishedCallback _tweenFinishedCallback; + + private bool _isEnable; + + private bool _isFinishedAnimation = true; + + public bool isEnable + { + get + { + return _isEnable; + } + set + { + if (value != _isEnable) + { + if (value) + { + _scaleTweener.InitTweener(0.5f, 0f, 1f); + if (PhotonNetwork.offlineMode || PhotonNetwork.isMasterClient) + { + _objectsForHostPlayer.SetActive(value: true); + _objectsForClientPlayer.SetActive(value: false); + } + else + { + _objectsForHostPlayer.SetActive(value: false); + _objectsForClientPlayer.SetActive(value: true); + } + _rootPanelGameObject.SetActive(value: true); + _gameOverSoundEffect.Play(); + } + else + { + _scaleTweener.InitTweener(0.5f, 1f, 0f); + } + _isEnable = value; + _isFinishedAnimation = false; + } + } + } + + public override void Initialize() + { + _isEnable = false; + _isFinishedAnimation = true; + _retryButton.interactable = true; + _quitButton.interactable = true; + _scaleTweener.InitTweener(0.5f, 0f, 0f); + _rootPanelGameObject.transform.localScale = new Vector3(1f, 0f, 1f); + } + + private void Update() + { + if (!_scaleTweener.IsEnd()) + { + float y = _scaleTweener.UpdateParameterFloat(Time.deltaTime); + _rootPanelGameObject.transform.localScale = new Vector3(1f, y, 1f); + } + else if (!_isFinishedAnimation) + { + if (_isEnable) + { + _retryButton.Select(); + } + else + { + _rootPanelGameObject.SetActive(value: false); + } + if (_tweenFinishedCallback != null) + { + _tweenFinishedCallback(); + } + _tweenFinishedCallback = null; + _isFinishedAnimation = true; + _retryButton.interactable = true; + _quitButton.interactable = true; + } + } + + public void OnClickRetry() + { + isEnable = false; + _tweenFinishedCallback = delegate + { + FieManagerBehaviour.I.SetGameState(FieInGameStateManager.FieInGameState.STATE_IS_RETRYING); + }; + _retryButton.interactable = false; + } + + public void OnClickQuit() + { + isEnable = false; + _tweenFinishedCallback = delegate + { + FieManagerBehaviour.I.SetGameState(FieInGameStateManager.FieInGameState.STATE_ON_QUIT); + }; + _quitButton.interactable = false; + } + } +} diff --git a/src/Fie.UI/FieGameUIGameOverWindowManager.cs b/src/Fie.UI/FieGameUIGameOverWindowManager.cs new file mode 100644 index 0000000..1b1cc3e --- /dev/null +++ b/src/Fie.UI/FieGameUIGameOverWindowManager.cs @@ -0,0 +1,51 @@ +using Fie.Manager; + +namespace Fie.UI +{ + public class FieGameUIGameOverWindowManager : FieGameUIComponentManagerBase + { + private FieGameUIGameOverWindow _gameoverWindow; + + public override void StartUp() + { + if (_gameoverWindow == null) + { + _gameoverWindow = FieManagerBehaviour.I.CreateGui(null); + _gameoverWindow.uiCamera = FieManagerBehaviour.I.uiCamera; + _gameoverWindow.Initialize(); + FieManagerBehaviour.I.GameOverEvent += GameOverCallback; + FieManagerBehaviour.I.RetryEvent += RetryCallback; + } + } + + private void RetryCallback() + { + FieManagerBehaviour.I.ChangeMixerVolume(0f, 0.5f, default(FieAudioManager.FieAudioMixerType)); + HideGameOverWindow(); + } + + private void GameOverCallback() + { + FieManagerBehaviour.I.ChangeMixerVolume(-255f, 0.3f, default(FieAudioManager.FieAudioMixerType)); + ShowGameOverWindow(); + } + + public void Relocate() + { + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + } + + public void ShowGameOverWindow() + { + _gameoverWindow.isEnable = true; + } + + public void HideGameOverWindow() + { + _gameoverWindow.isEnable = false; + } + } +} diff --git a/src/Fie.UI/FieGameUIHeaderFooter.cs b/src/Fie.UI/FieGameUIHeaderFooter.cs new file mode 100644 index 0000000..74ab72e --- /dev/null +++ b/src/Fie.UI/FieGameUIHeaderFooter.cs @@ -0,0 +1,50 @@ +using Spine.Unity; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUIHeaderFooter : FieGameUIBase + { + public const string HEADER_FOOTER_SHOW_ANIIMATION_NAME = "show"; + + public const string HEADER_FOOTER_HIDE_ANIIMATION_NAME = "hide"; + + public GameObject header; + + public GameObject footer; + + public Transform headerRootTransform; + + public Transform footerRootTransform; + + public Transform Ability1; + + public Transform Ability2; + + public Transform Ability3; + + public SkeletonAnimation _mySkeleton; + + public void Awake() + { + _mySkeleton = GetComponent(); + } + + public void Show() + { + if (!(_mySkeleton == null)) + { + _mySkeleton.state.SetAnimation(0, "show", loop: false); + } + } + + public void Hide() + { + if (!(_mySkeleton == null)) + { + _mySkeleton.state.SetAnimation(0, "hide", loop: false); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIHeaderFooterManager.cs b/src/Fie.UI/FieGameUIHeaderFooterManager.cs new file mode 100644 index 0000000..3cb71f5 --- /dev/null +++ b/src/Fie.UI/FieGameUIHeaderFooterManager.cs @@ -0,0 +1,72 @@ +using Fie.Manager; +using Fie.Scene; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIHeaderFooterManager : FieGameUIComponentManagerBase + { + private FieGameUIHeaderFooter _headerFooter; + + public override void StartUp() + { + if (_headerFooter == null) + { + _headerFooter = FieManagerBehaviour.I.CreateGui(null); + _headerFooter.uiCamera = FieManagerBehaviour.I.uiCamera; + FieManagerBehaviour.I.uiPositionList.Add(FieGUIManager.FieUIPositionTag.HEADER_ROOT, _headerFooter.headerRootTransform); + FieManagerBehaviour.I.uiPositionList.Add(FieGUIManager.FieUIPositionTag.FOOTER_ROOT, _headerFooter.footerRootTransform); + FieManagerBehaviour.I.uiPositionList.Add(FieGUIManager.FieUIPositionTag.ABILITY_ICON_1, _headerFooter.Ability1); + FieManagerBehaviour.I.uiPositionList.Add(FieGUIManager.FieUIPositionTag.ABILITY_ICON_2, _headerFooter.Ability2); + FieManagerBehaviour.I.uiPositionList.Add(FieGUIManager.FieUIPositionTag.ABILITY_ICON_3, _headerFooter.Ability3); + Relocate(); + _headerFooter.uiCamera.screenResizeEvent += Relocate; + } + FieManagerBehaviour.I.GameOverEvent += GameOverCallback; + if (FieManagerFactory.I.currentSceneType == FieSceneType.INGAME) + { + FieManagerBehaviour.I.RetryFinishedEvent += RetryFinishedEvent; + } + } + + private void RetryFinishedEvent() + { + _headerFooter.Show(); + } + + private void GameOverCallback() + { + _headerFooter.Hide(); + } + + public void Relocate() + { + if (_headerFooter != null) + { + _headerFooter.header.transform.position = _headerFooter.uiCamera.camera.ScreenToWorldPoint(new Vector3(0f, (float)Screen.height + 0.025f, 0f)); + _headerFooter.footer.transform.position = _headerFooter.uiCamera.camera.ScreenToWorldPoint(new Vector3((float)Screen.width * 0.5f, 0f, 0f)); + _headerFooter.SetUILayer(FieGUIManager.FieUILayer.BACKWORD_THIRD); + } + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + } + + public void Show() + { + if (!(_headerFooter == null)) + { + _headerFooter.Show(); + } + } + + public void Hide() + { + if (!(_headerFooter == null)) + { + _headerFooter.Hide(); + } + } + } +} diff --git a/src/Fie.UI/FieGameUIIndicator.cs b/src/Fie.UI/FieGameUIIndicator.cs new file mode 100644 index 0000000..8c05104 --- /dev/null +++ b/src/Fie.UI/FieGameUIIndicator.cs @@ -0,0 +1,150 @@ +using Fie.Manager; +using Fie.Object; +using Spine.Unity; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUIIndicator : FieGameUIBase + { + private enum IndicatorState + { + NONE = -1, + HIDDEN, + ENEMY, + INJURY, + INJURY_LOCATE + } + + private const string INDICATOR_ANIMATION_NAME_HIDDEN = "hide"; + + private const string INDICATOR_ANIMATION_NAME_ENEMY = "enemy"; + + private const string INDICATOR_ANIMATION_NAME_INJURY = "injury"; + + private const string INDICATOR_ANIMATION_NAME_INJURY_LOCATE = "injury_located"; + + public FieGUIManager.FieUILayer currentLayer = FieGUIManager.FieUILayer.DEFAULT; + + private SkeletonAnimation _skeleton; + + private MeshRenderer _rendere; + + private IndicatorState _state = IndicatorState.NONE; + + public override void Initialize() + { + _state = IndicatorState.NONE; + _skeleton = GetComponent(); + _rendere = GetComponent(); + if (_skeleton == null) + { + Debug.LogError("Skeleton Animation componet dose not found."); + } + else + { + UpdateIndicatorAnimation(IndicatorState.HIDDEN); + } + } + + public override void Terminate() + { + UpdateIndicatorAnimation(IndicatorState.HIDDEN); + } + + private void UpdateIndicatorAnimation(IndicatorState state) + { + if (state != _state) + { + switch (state) + { + case IndicatorState.HIDDEN: + _rendere.enabled = false; + break; + case IndicatorState.ENEMY: + _skeleton.AnimationState.SetAnimation(0, "enemy", loop: true); + _rendere.enabled = true; + break; + case IndicatorState.INJURY: + _skeleton.AnimationState.SetAnimation(0, "injury", loop: true); + _rendere.enabled = true; + break; + case IndicatorState.INJURY_LOCATE: + _skeleton.AnimationState.SetAnimation(0, "injury_located", loop: true); + _rendere.enabled = true; + break; + } + _state = state; + } + } + + private void Update() + { + CheckState(base.ownerCharacter); + } + + private void CheckState(FieGameCharacter ownerCharacter) + { + if (ownerCharacter == null) + { + Terminate(); + base.uiActive = false; + } + else + { + Vector3 screenPosition = Vector3.zero; + switch (ownerCharacter.forces) + { + case FieEmittableObjectBase.EmitObjectTag.PLAYER: + if (ownerCharacter.healthStats.hitPoint <= 0f) + { + if (base.uiCamera.isOnScreen(ownerCharacter.centerTransform.position, ref screenPosition)) + { + base.transform.position = base.uiCamera.getPositionInUICameraWorld(ownerCharacter.guiPointTransform.position); + base.transform.rotation = Quaternion.identity; + base.transform.localScale = Vector3.one; + UpdateIndicatorAnimation(IndicatorState.INJURY_LOCATE); + } + else + { + PlaceToScreenCircle(screenPosition); + UpdateIndicatorAnimation(IndicatorState.INJURY); + } + return; + } + break; + case FieEmittableObjectBase.EmitObjectTag.ENEMY: + if (!base.uiCamera.isOnScreen(ownerCharacter.centerTransform.position, ref screenPosition)) + { + PlaceToScreenCircle(screenPosition); + UpdateIndicatorAnimation(IndicatorState.ENEMY); + return; + } + break; + } + UpdateIndicatorAnimation(IndicatorState.HIDDEN); + } + } + + public float GetAim(Vector2 p1, Vector2 p2) + { + float x = p2.x - p1.x; + float y = p2.y - p1.y; + float num = Mathf.Atan2(y, x); + return num * 57.29578f; + } + + private void PlaceToScreenCircle(Vector3 outsidePosition) + { + Vector2 vector = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); + Vector2 normalized = new Vector2((float)Screen.width, (float)Screen.height).normalized; + Vector2 v = new Vector2(outsidePosition.x, outsidePosition.y) - vector; + Vector2 normalized2 = v.normalized; + Vector2 vector2 = vector + new Vector2(normalized2.x * ((float)Screen.width * 0.48f) * normalized.x, normalized2.y * ((float)Screen.height * 0.48f) * normalized.y); + base.transform.rotation = Quaternion.AngleAxis(GetAim(vector, vector2) + 90f, Vector3.forward); + base.transform.localScale = Vector3.one * Mathf.Max(0.75f, Mathf.Min(1.5f, (float)(Screen.width + Screen.height) * 0.5f / Mathf.Max(Vector3.Distance(v, normalized2), 1f))); + base.transform.position = base.uiCamera.camera.ScreenToWorldPoint(vector2); + } + } +} diff --git a/src/Fie.UI/FieGameUIIndicatorManager.cs b/src/Fie.UI/FieGameUIIndicatorManager.cs new file mode 100644 index 0000000..2546208 --- /dev/null +++ b/src/Fie.UI/FieGameUIIndicatorManager.cs @@ -0,0 +1,69 @@ +using Fie.Manager; +using System.Collections.Generic; + +namespace Fie.UI +{ + public class FieGameUIIndicatorManager : FieGameUIComponentManagerBase + { + private List _indicatorList = new List(); + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + base.setComponentManagerOwner(owner); + owner.detector.locatedEvent += Detector_locatedEvent; + owner.detector.missedEvent += Detector_missedEvent; + } + + private void OnDestroy() + { + if (base.componentManagerOwner != null) + { + base.componentManagerOwner.detector.locatedEvent -= Detector_locatedEvent; + base.componentManagerOwner.detector.missedEvent -= Detector_missedEvent; + } + } + + private void Detector_missedEvent(FieGameCharacter targetCharacter) + { + cleanupListsData(); + } + + private void Detector_locatedEvent(FieGameCharacter targetCharacter) + { + if (!(targetCharacter == null)) + { + cleanupListsData(); + FieGameUIIndicator fieGameUIIndicator = null; + foreach (FieGameUIIndicator indicator in _indicatorList) + { + if (!indicator.uiActive) + { + fieGameUIIndicator = indicator; + break; + } + } + if (fieGameUIIndicator == null) + { + fieGameUIIndicator = FieManagerBehaviour.I.CreateGui(targetCharacter); + _indicatorList.Add(fieGameUIIndicator); + } + fieGameUIIndicator.uiActive = true; + fieGameUIIndicator.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUIIndicator.ownerCharacter = targetCharacter; + fieGameUIIndicator.Initialize(); + } + } + + private void cleanupListsData() + { + foreach (FieGameUIIndicator indicator in _indicatorList) + { + if (indicator.ownerCharacter == null) + { + indicator.Terminate(); + indicator.uiActive = false; + } + } + } + } +} diff --git a/src/Fie.UI/FieGameUILifeGaugeBase.cs b/src/Fie.UI/FieGameUILifeGaugeBase.cs new file mode 100644 index 0000000..736a88c --- /dev/null +++ b/src/Fie.UI/FieGameUILifeGaugeBase.cs @@ -0,0 +1,227 @@ +using Fie.Manager; +using Fie.Object; +using Fie.Utility; +using Spine; +using Spine.Unity; +using System; +using System.Collections; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUILifeGaugeBase : FieGameUIBase + { + public enum LifeGaugeAnimationTrack + { + COLOR_AND_ALPHA, + DAMAGE, + HEALTH, + SHIELD + } + + public FieGUIManager.FieUILayer currentLayer = FieGUIManager.FieUILayer.DEFAULT; + + public bool isTrackingCharacterPosition = true; + + public bool isEnableAutoDamageAnimation = true; + + protected const float GAUGE_ANIMATION_DURATION = 0.2f; + + protected const string GAUGE_ANIMATION_DAMAGE_HEALTH = "damage"; + + protected const string GAUGE_ANIMATION_DAMAGE_SHIELD = "damage"; + + protected const string GAUGE_ANIMATION_EARTH = "earth"; + + protected const string GAUGE_ANIMATION_WING = "wing"; + + protected const string GAUGE_ANIMATION_MAGIC = "magic"; + + protected const string GAUGE_ANIMATION_HEALTH = "health"; + + protected const string GAUGE_ANIMATION_OFF = "off"; + + protected const string GAUGE_ANIMATION_ON = "on"; + + protected SkeletonAnimation _skeletonAnimation; + + protected FieSkeletonAnimationController _animationManager; + + private float _currentHealth; + + private float _currentShield; + + private float _maxHealth; + + private float _maxShield; + + private float _animationHealth; + + private float _animationShield; + + private bool _isEnd; + + private FieAttribute _shieldType; + + private Tweener _healthTweener = new Tweener(); + + private Tweener _shieldTweener = new Tweener(); + + private TrackEntry _shieldAnimationEntry; + + private TrackEntry _healthAnimationEntry; + + protected void Awake() + { + _skeletonAnimation = GetComponent(); + if (_skeletonAnimation == null) + { + throw new Exception("this component require SkeletonAnimation. but didn't."); + } + } + + protected void OnEnable() + { + Initialize(); + } + + private IEnumerator endAnimation() + { + yield return (object)new WaitForSeconds(0.2f); + /*Error: Unable to find new state assignment for yield return*/; + } + + protected void LateUpdate() + { + _animationHealth = _healthTweener.UpdateParameterFloat(Time.deltaTime); + _animationShield = _shieldTweener.UpdateParameterFloat(Time.deltaTime); + if (!_healthTweener.IsEnd() || !_shieldTweener.IsEnd()) + { + updateGaugeState(); + } + if (!(base.uiCamera == null)) + { + if (base.ownerCharacter == null) + { + if (!_isEnd) + { + Terminate(); + _isEnd = true; + } + } + else + { + if (isTrackingCharacterPosition) + { + base.transform.position = base.uiCamera.getPositionInUICameraWorld(base.ownerCharacter.guiPointTransform.position); + SetUILayer(currentLayer); + } + if (base.ownerCharacter.healthStats.hitPoint != _currentHealth || base.ownerCharacter.healthStats.shield != _currentShield) + { + if (isEnableAutoDamageAnimation) + { + if (!(base.ownerCharacter.healthStats.shield > _currentShield) && base.ownerCharacter.healthStats.shield < _currentShield) + { + _skeletonAnimation.state.SetAnimation(1, "damage", loop: false); + } + if (!(base.ownerCharacter.healthStats.hitPoint > _currentHealth) && base.ownerCharacter.healthStats.hitPoint < _currentHealth) + { + _skeletonAnimation.state.SetAnimation(1, "damage", loop: false); + } + } + _currentHealth = base.ownerCharacter.healthStats.hitPoint; + _currentShield = base.ownerCharacter.healthStats.shield; + _healthTweener.InitTweener(0.2f, _animationHealth, _currentHealth); + _shieldTweener.InitTweener(0.2f, _animationShield, _currentShield); + } + } + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + TrackEntry trackEntry = _skeletonAnimation.state.SetAnimation(0, "on", loop: false); + if (trackEntry != null) + { + trackEntry.timeScale = 1f; + } + _maxHealth = base.ownerCharacter.healthStats.maxHitPoint; + _maxShield = base.ownerCharacter.healthStats.maxShield; + _animationHealth = (_currentHealth = base.ownerCharacter.healthStats.hitPoint); + _animationShield = (_currentShield = base.ownerCharacter.healthStats.shield); + _healthTweener.InitTweener(0.2f, _currentHealth, _currentHealth); + _shieldTweener.InitTweener(0.2f, _currentShield, _currentShield); + _shieldType = base.ownerCharacter.healthStats.shieldType; + initGaugeAnimation(); + updateGaugeState(); + _isEnd = false; + } + } + + private void initGaugeAnimation() + { + string animationName = null; + switch (_shieldType) + { + case FieAttribute.EARTH: + animationName = "earth"; + break; + case FieAttribute.WING: + animationName = "wing"; + break; + case FieAttribute.MAGIC: + animationName = "magic"; + break; + } + _shieldAnimationEntry = _skeletonAnimation.state.SetAnimation(3, animationName, loop: false); + _healthAnimationEntry = _skeletonAnimation.state.SetAnimation(2, "health", loop: false); + } + + public override void Terminate() + { + _healthTweener.InitTweener(0.2f, _animationHealth, 0f); + _shieldTweener.InitTweener(0.2f, _animationShield, 0f); + if (base.gameObject.activeSelf) + { + StartCoroutine(endAnimation()); + } + } + + private void updateGaugeState() + { + if (_shieldAnimationEntry != null) + { + setGaugeAnimationFrame(_shieldAnimationEntry, LifeGaugeAnimationTrack.SHIELD); + } + if (_healthAnimationEntry != null) + { + setGaugeAnimationFrame(_healthAnimationEntry, LifeGaugeAnimationTrack.HEALTH); + } + } + + private void setGaugeAnimationFrame(TrackEntry entry, LifeGaugeAnimationTrack trackType) + { + if (trackType == LifeGaugeAnimationTrack.HEALTH || trackType == LifeGaugeAnimationTrack.SHIELD) + { + float num = 1f; + if (trackType == LifeGaugeAnimationTrack.HEALTH) + { + if (_maxHealth > 0f) + { + num = _animationHealth / _maxHealth; + } + } + else if (_maxShield > 0f) + { + num = _animationShield / _maxShield; + } + float num2 = entry.endTime - 0.0333f; + entry.Time = Mathf.Max(Mathf.Min(num2 - num * num2, num2), 0f); + entry.TimeScale = 0f; + } + } + } +} diff --git a/src/Fie.UI/FieGameUIPlayerLifeGauge.cs b/src/Fie.UI/FieGameUIPlayerLifeGauge.cs new file mode 100644 index 0000000..0c49972 --- /dev/null +++ b/src/Fie.UI/FieGameUIPlayerLifeGauge.cs @@ -0,0 +1,30 @@ +using Fie.Object; + +namespace Fie.UI +{ + public class FieGameUIPlayerLifeGauge : FieGameUILifeGaugeBase + { + public new void OnEnable() + { + base.OnEnable(); + if (base.ownerCharacter != null) + { + base.ownerCharacter.damageSystem.damagedEvent += lifeSystem_damageEvent; + } + isEnableAutoDamageAnimation = false; + } + + private void OnDisable() + { + if (base.ownerCharacter != null) + { + base.ownerCharacter.damageSystem.damagedEvent -= lifeSystem_damageEvent; + } + } + + private void lifeSystem_damageEvent(FieGameCharacter attacker, FieDamage damage) + { + _skeletonAnimation.state.SetAnimation(1, "damage", loop: false); + } + } +} diff --git a/src/Fie.UI/FieGameUIPlayerWindow.cs b/src/Fie.UI/FieGameUIPlayerWindow.cs new file mode 100644 index 0000000..fcbf17a --- /dev/null +++ b/src/Fie.UI/FieGameUIPlayerWindow.cs @@ -0,0 +1,97 @@ +using Fie.Object; +using Fie.Ponies; +using Spine.Unity; +using System; +using TMPro; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUIPlayerWindow : FieGameUIBase + { + public enum PlayerWindowAnimationTrack + { + CHARACTER_CHANGE, + DAMAGE + } + + private const string PLAYER_WINDOW_ANIMATION_DAMAGE = "damage"; + + [SerializeField] + private Transform _lifeGaugePositionTransform; + + [SerializeField] + private Transform _frinedshipGaugePositionTransform; + + [SerializeField] + private Transform _namePositionTransform; + + [SerializeField] + private TextMeshPro _nameTextMesh; + + [SerializeField] + private FieUIConstant2DText _levelText; + + private SkeletonAnimation _skeletonAnimation; + + public Transform lifeGaugePositionTransform => _lifeGaugePositionTransform; + + public Transform friendshipGaugePositionTransform => _frinedshipGaugePositionTransform; + + public Transform namePositionTransform => _namePositionTransform; + + public TextMeshPro nameTextMesh => _nameTextMesh; + + public FieUIConstant2DText levelText => _levelText; + + protected void Awake() + { + _skeletonAnimation = GetComponent(); + if (_skeletonAnimation == null) + { + throw new Exception("this component require SkeletonAnimation. but didn't."); + } + } + + private void OnEnable() + { + Initialize(); + } + + private void OnDisable() + { + if (!(base.ownerCharacter == null)) + { + FiePonies fiePonies = base.ownerCharacter as FiePonies; + fiePonies.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + FiePonies fiePonies = base.ownerCharacter as FiePonies; + if (!(fiePonies == null)) + { + _skeletonAnimation.state.SetAnimation(0, fiePonies.getGameCharacterTypeData().Signature, loop: false); + fiePonies.damageSystem.damagedEvent += HealthSystem_damagedEvent; + } + } + } + + private void OnDestroy() + { + if (base.ownerCharacter != null) + { + base.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent; + } + } + + private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) + { + _skeletonAnimation.state.SetAnimation(1, "damage", loop: false); + } + } +} diff --git a/src/Fie.UI/FieGameUIPlayerWindowManager.cs b/src/Fie.UI/FieGameUIPlayerWindowManager.cs new file mode 100644 index 0000000..05520c3 --- /dev/null +++ b/src/Fie.UI/FieGameUIPlayerWindowManager.cs @@ -0,0 +1,169 @@ +using Fie.Manager; +using Fie.Ponies; +using Fie.User; +using GameDataEditor; +using System.Collections.Generic; +using UnityEngine; + +namespace Fie.UI +{ + public class FieGameUIPlayerWindowManager : FieGameUIComponentManagerBase + { + private const float SCREEN_SPLIT_NUM = 3f; + + private Dictionary _playerWindowList = new Dictionary(); + + private Dictionary _splitLineList = new Dictionary(); + + private Dictionary _playerLifeGaugeList = new Dictionary(); + + private Dictionary _playerFriendshipGaugeList = new Dictionary(); + + private FieGameUITargetIcon _targetIcon; + + private int gameCharacterCount; + + public override void StartUp() + { + ReloadPlayerWindows(); + Relocate(); + } + + public void ReloadPlayerWindows() + { + foreach (KeyValuePair playerWindow in _playerWindowList) + { + if (playerWindow.Value != null) + { + playerWindow.Value.uiActive = false; + } + } + foreach (KeyValuePair playerLifeGauge in _playerLifeGaugeList) + { + if (playerLifeGauge.Value != null) + { + playerLifeGauge.Value.uiActive = false; + } + } + foreach (KeyValuePair playerFriendshipGauge in _playerFriendshipGaugeList) + { + if (playerFriendshipGauge.Value != null) + { + playerFriendshipGauge.Value.uiActive = false; + } + } + foreach (KeyValuePair splitLine in _splitLineList) + { + if (splitLine.Value != null) + { + splitLine.Value.uiActive = false; + } + } + List allPlayerCharacters = FieManagerBehaviour.I.GetAllPlayerCharacters(); + if (allPlayerCharacters.Count > 0) + { + for (int i = 0; i < allPlayerCharacters.Count; i++) + { + FieGameUIPlayerWindow fieGameUIPlayerWindow = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); + FieGameUIPlayerLifeGauge fieGameUIPlayerLifeGauge = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); + FieGameUIFriendshipGauge fieGameUIFriendshipGauge = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); + FieGameUISplitLine fieGameUISplitLine = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); + fieGameUIPlayerLifeGauge.isTrackingCharacterPosition = false; + fieGameUIPlayerWindow.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUIPlayerLifeGauge.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUIFriendshipGauge.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUISplitLine.uiCamera = FieManagerBehaviour.I.uiCamera; + fieGameUIPlayerWindow.transform.position = new Vector3(0f, 512f, 0f); + fieGameUIPlayerLifeGauge.transform.position = new Vector3(0f, 512f, 0f); + fieGameUIFriendshipGauge.transform.position = new Vector3(0f, 512f, 0f); + fieGameUISplitLine.transform.position = new Vector3(0f, 512f, 0f); + fieGameUIPlayerWindow.nameTextMesh.text = FieManagerBehaviour.I.GetUserName(i); + FieUser data = FieManagerBehaviour.I.GetUserData(i); + fieGameUIPlayerWindow.levelText.replaceMethod = delegate(ref string targetString) + { + string constantText = FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_PLAYER_WINDOW_LV_TEXT); + if (data == null || data.playerInfo == null || data.playerInfo.IsLocal) + { + FieLevelInfo levelInfoByTotalExp = FieManagerBehaviour.I.GetLevelInfoByTotalExp(data.usersCharacter.totalExp); + constantText = constantText.Replace("___Value1___", FieManagerBehaviour.I.onMemorySaveData.PlayerLevel.ToString()); + constantText = constantText.Replace("___Value2___", levelInfoByTotalExp.level.ToString()); + } + else + { + constantText = constantText.Replace("___Value1___", ((int)data.playerInfo.CustomProperties["player_level"]).ToString()); + constantText = constantText.Replace("___Value2___", ((int)data.playerInfo.CustomProperties["character_level"]).ToString()); + } + targetString = constantText; + }; + _playerWindowList[i] = fieGameUIPlayerWindow; + _playerLifeGaugeList[i] = fieGameUIPlayerLifeGauge; + _playerFriendshipGaugeList[i] = fieGameUIFriendshipGauge; + _splitLineList[i] = fieGameUISplitLine; + gameCharacterCount++; + } + } + _targetIcon = FieManagerBehaviour.I.CreateGui(base.componentManagerOwner); + _targetIcon.uiCamera = FieManagerBehaviour.I.uiCamera; + Relocate(); + } + + public void Relocate() + { + float num = (float)Screen.width; + float num2 = num / 3f; + float num3 = num / 6f; + float num4 = num2 * 0.5f; + float num5 = num3 * 2f; + Dictionary dictionary = new Dictionary(); + Dictionary dictionary2 = new Dictionary(); + foreach (KeyValuePair playerWindow in _playerWindowList) + { + if (FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT] != null) + { + playerWindow.Value.transform.parent = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT]; + } + playerWindow.Value.transform.position = playerWindow.Value.uiCamera.camera.ScreenToWorldPoint(new Vector3(num4, (float)Screen.height, 0f)); + num4 += num2; + dictionary[playerWindow.Key] = playerWindow.Value.lifeGaugePositionTransform; + dictionary2[playerWindow.Key] = playerWindow.Value.friendshipGaugePositionTransform; + } + foreach (KeyValuePair splitLine in _splitLineList) + { + if (FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT] != null) + { + splitLine.Value.transform.parent = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT]; + } + if (splitLine.Key >= 2) + { + splitLine.Value.gameObject.SetActive(value: false); + } + else + { + splitLine.Value.transform.position = splitLine.Value.uiCamera.camera.ScreenToWorldPoint(new Vector3(num5, (float)Screen.height, 0f)); + num5 += num3 * 2f; + } + } + foreach (KeyValuePair playerLifeGauge in _playerLifeGaugeList) + { + if (dictionary.ContainsKey(playerLifeGauge.Key)) + { + playerLifeGauge.Value.transform.position = dictionary[playerLifeGauge.Key].position; + playerLifeGauge.Value.gameObject.transform.SetParent(dictionary[playerLifeGauge.Key]); + } + } + foreach (KeyValuePair playerFriendshipGauge in _playerFriendshipGaugeList) + { + if (dictionary2.ContainsKey(playerFriendshipGauge.Key)) + { + playerFriendshipGauge.Value.transform.position = dictionary2[playerFriendshipGauge.Key].position; + playerFriendshipGauge.Value.gameObject.transform.SetParent(dictionary2[playerFriendshipGauge.Key]); + } + } + } + + public override void setComponentManagerOwner(FieGameCharacter owner) + { + base.setComponentManagerOwner(owner); + } + } +} diff --git a/src/Fie.UI/FieGameUISplitLine.cs b/src/Fie.UI/FieGameUISplitLine.cs new file mode 100644 index 0000000..c56dd98 --- /dev/null +++ b/src/Fie.UI/FieGameUISplitLine.cs @@ -0,0 +1,10 @@ +using Spine.Unity; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUISplitLine : FieGameUIBase + { + } +} diff --git a/src/Fie.UI/FieGameUITargetIcon.cs b/src/Fie.UI/FieGameUITargetIcon.cs new file mode 100644 index 0000000..87e3634 --- /dev/null +++ b/src/Fie.UI/FieGameUITargetIcon.cs @@ -0,0 +1,372 @@ +using Fie.Camera; +using Fie.Enemies; +using Fie.Manager; +using Fie.Object; +using Fie.Object.Abilities; +using Fie.Utility; +using ParticlePlayground; +using Spine; +using Spine.Unity; +using System; +using System.Collections; +using UnityEngine; + +namespace Fie.UI +{ + [RequireComponent(typeof(SkeletonAnimation))] + public class FieGameUITargetIcon : FieGameUIBase + { + public enum CooldownGaugeAnimationTrack + { + TARGET, + COOLDOWN_1, + COOLDOWN_2, + COOLDOWN_3 + } + + private struct CooldownParamters + { + public float currentCooldown; + + public float latestCooldown; + + public float maximumCoolown; + + public TrackEntry animationEntry; + } + + public FieGUIManager.FieUILayer currentLayer; + + protected const string TARGET_ICON_ANIMATION_NOT_LOCATED = "idle"; + + protected const string TARGET_ICON_ANIMATION_LOCATED = "located"; + + protected const string TARGET_ICON_ANIMATION_LOCATED_FREELOCK = "located_freelock"; + + protected const string TARGET_ICON_COOLDOWN_META_TAG = "[SLOT_NUM]"; + + protected const string TARGET_ICON_ANIMATION_COOLDOWN = "cooldown_[SLOT_NUM]"; + + protected const string TARGET_ICON_ANIMATION_COOLDOWN_IDLE = "cooldown_[SLOT_NUM]_idle"; + + protected const string TARGET_ICON_ANIMATION_COOLDOWN_COMPLETE = "cooldown_[SLOT_NUM]_end"; + + private const float TARGET_CHANGE_LEAP_TIME = 0.3f; + + protected SkeletonAnimation _skeletonAnimation; + + protected FieSkeletonAnimationController _animationManager; + + [SerializeField] + public PlaygroundParticlesC targetChangeEffect; + + private FieObjectEnemies _currentMarkingTarget; + + private Transform _currentTransform; + + private Transform _currentMarkingTransform; + + private Transform _latestTransform; + + private Vector3 _latestPosition = Vector3.zero; + + private bool _isInitializePosition = true; + + private Tweener _targetPositionTweener = new Tweener(); + + private CooldownParamters[] _cooldownParams = new CooldownParamters[3]; + + private bool _isEnd; + + private bool _isLocated; + + private bool _isFreeCam; + + protected void Awake() + { + _skeletonAnimation = GetComponent(); + if (_skeletonAnimation == null) + { + throw new Exception("this component require SkeletonAnimation. but didn't."); + } + } + + protected void Start() + { + Initialize(); + } + + private IEnumerator endAnimation(FieAbilitiesSlot.SlotType slot) + { + TrackEntry entry = null; + switch (slot) + { + case FieAbilitiesSlot.SlotType.SLOT_1: + entry = _skeletonAnimation.state.SetAnimation(1, "cooldown_[SLOT_NUM]_end".Replace("[SLOT_NUM]", "1"), loop: false); + break; + case FieAbilitiesSlot.SlotType.SLOT_2: + entry = _skeletonAnimation.state.SetAnimation(2, "cooldown_[SLOT_NUM]_end".Replace("[SLOT_NUM]", "2"), loop: false); + break; + case FieAbilitiesSlot.SlotType.SLOT_3: + entry = _skeletonAnimation.state.SetAnimation(3, "cooldown_[SLOT_NUM]_end".Replace("[SLOT_NUM]", "3"), loop: false); + break; + } + if (entry == null) + { + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + yield return (object)new WaitForSeconds(entry.endTime); + /*Error: Unable to find new state assignment for yield return*/; + } + + protected void LateUpdate() + { + if (!(base.ownerCharacter == null)) + { + bool flag = false; + if (FieManagerBehaviour.I.gameCamera != null) + { + FieGameCameraTaskLockOn fieGameCameraTaskLockOn = FieManagerBehaviour.I.gameCamera.GetCameraTask() as FieGameCameraTaskLockOn; + if (fieGameCameraTaskLockOn != null) + { + flag = !fieGameCameraTaskLockOn.isCameraHorming; + } + if (_isFreeCam != flag) + { + _targetPositionTweener.InitTweener(0.3f, 0f, 1f); + _latestPosition = base.transform.position; + _isLocated = false; + } + _isFreeCam = flag; + } + Vector3 vector = Vector3.zero; + if (_currentMarkingTransform != null) + { + if (!_isInitializePosition) + { + vector = ((!_isFreeCam) ? base.uiCamera.getPositionInUICameraWorld(_currentMarkingTransform.position) : base.uiCamera.camera.ScreenToWorldPoint(FieManagerBehaviour.I.gameCamera.tagetMakerScreenPos)); + if (!_isLocated) + { + if (!_isFreeCam) + { + _skeletonAnimation.state.SetAnimation(0, "located", loop: true); + } + else + { + _skeletonAnimation.state.SetAnimation(0, "located_freelock", loop: true); + } + _isLocated = true; + } + } + else + { + vector = _currentMarkingTransform.position; + if (_isLocated) + { + _skeletonAnimation.state.SetAnimation(0, "idle", loop: false); + _isLocated = false; + } + } + } + if (_currentMarkingTarget != null) + { + _currentMarkingTarget.setHighLightColorByTargetStatus(base.ownerCharacter); + } + if (_isFreeCam) + { + if (Vector3.Distance(vector, base.transform.position) > 0.01f) + { + targetChangeEffect.emit = true; + } + else + { + targetChangeEffect.emit = false; + } + } + else if (!_targetPositionTweener.IsEnd()) + { + targetChangeEffect.emit = true; + } + else + { + targetChangeEffect.emit = false; + } + if (_currentMarkingTransform != null) + { + float t = _targetPositionTweener.UpdateParameterFloat(Time.deltaTime); + base.transform.position = Vector3.Lerp(_latestPosition, vector, t); + } + for (int i = 0; i < 3; i++) + { + _cooldownParams[i].currentCooldown = base.ownerCharacter.abilitiesContainer.GetCooltime((FieAbilitiesSlot.SlotType)i); + if (_cooldownParams[i].currentCooldown != _cooldownParams[i].latestCooldown) + { + updateGaugeState((FieAbilitiesSlot.SlotType)i); + } + else if (_cooldownParams[i].latestCooldown <= 0f) + { + continue; + } + if (_cooldownParams[i].currentCooldown <= 0f) + { + _cooldownParams[i].maximumCoolown = 0.1f; + StartCoroutine(endAnimation((FieAbilitiesSlot.SlotType)i)); + } + _cooldownParams[i].latestCooldown = _cooldownParams[i].currentCooldown; + } + } + } + + public override void Initialize() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.detector.targetChangedEvent += detector_targetChangeEvent; + _skeletonAnimation.state.SetAnimation(0, "idle", loop: false); + _cooldownParams[0].animationEntry = _skeletonAnimation.state.SetAnimation(1, "cooldown_[SLOT_NUM]_idle".Replace("[SLOT_NUM]", "1"), loop: false); + _cooldownParams[1].animationEntry = _skeletonAnimation.state.SetAnimation(2, "cooldown_[SLOT_NUM]_idle".Replace("[SLOT_NUM]", "2"), loop: false); + _cooldownParams[2].animationEntry = _skeletonAnimation.state.SetAnimation(3, "cooldown_[SLOT_NUM]_idle".Replace("[SLOT_NUM]", "3"), loop: false); + _isInitializePosition = true; + _currentTransform = (_currentMarkingTransform = (_latestTransform = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.ABILITY_ICON_3])); + _latestPosition = _currentTransform.position; + _targetPositionTweener.InitTweener(0.3f, 1f, 1f); + FieAbilitiesCooldown cooldownController = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_1); + FieAbilitiesCooldown cooldownController2 = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_2); + FieAbilitiesCooldown cooldownController3 = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_3); + if (cooldownController != null) + { + cooldownController.cooldownChangeEvent += cooldownController_Ability1CooldownChangeEvent; + } + if (cooldownController2 != null) + { + cooldownController2.cooldownChangeEvent += cooldownController_Ability2CooldownChangeEvent; + } + if (cooldownController3 != null) + { + cooldownController3.cooldownChangeEvent += cooldownController_Ability3CooldownChangeEvent; + } + for (int i = 0; i < 3; i++) + { + _cooldownParams[i].currentCooldown = 0f; + _cooldownParams[i].latestCooldown = 0f; + _cooldownParams[i].maximumCoolown = 0f; + updateGaugeState((FieAbilitiesSlot.SlotType)i); + } + if (targetChangeEffect != null) + { + targetChangeEffect.emit = false; + } + _isEnd = false; + } + } + + private void changeTarget(FieGameCharacter target) + { + _latestPosition = base.transform.position; + if (target == null) + { + _currentTransform = (_currentMarkingTransform = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.ABILITY_ICON_3]); + _isInitializePosition = true; + } + else + { + _currentMarkingTransform = target.centerTransform; + _currentMarkingTarget = (target as FieObjectEnemies); + _currentTransform = target.transform; + _isInitializePosition = false; + } + _targetPositionTweener.InitTweener(0.3f, 0f, 1f); + _latestTransform = _currentTransform; + } + + private void cooldownController_Ability1CooldownChangeEvent(float before, float after) + { + _cooldownParams[0].currentCooldown = after; + _cooldownParams[0].latestCooldown = after; + _cooldownParams[0].maximumCoolown = Mathf.Max(_cooldownParams[0].maximumCoolown, after); + _cooldownParams[0].animationEntry = _skeletonAnimation.state.SetAnimation(1, "cooldown_[SLOT_NUM]".Replace("[SLOT_NUM]", "1"), loop: false); + } + + private void cooldownController_Ability2CooldownChangeEvent(float before, float after) + { + _cooldownParams[1].currentCooldown = after; + _cooldownParams[1].latestCooldown = after; + _cooldownParams[1].maximumCoolown = Mathf.Max(_cooldownParams[1].maximumCoolown, after); + _cooldownParams[1].animationEntry = _skeletonAnimation.state.SetAnimation(2, "cooldown_[SLOT_NUM]".Replace("[SLOT_NUM]", "2"), loop: false); + } + + private void cooldownController_Ability3CooldownChangeEvent(float before, float after) + { + _cooldownParams[2].currentCooldown = after; + _cooldownParams[2].latestCooldown = after; + _cooldownParams[2].maximumCoolown = Mathf.Max(_cooldownParams[2].maximumCoolown, after); + _cooldownParams[2].animationEntry = _skeletonAnimation.state.SetAnimation(3, "cooldown_[SLOT_NUM]".Replace("[SLOT_NUM]", "3"), loop: false); + } + + private void OnDestroy() + { + if (!(base.ownerCharacter == null)) + { + base.ownerCharacter.detector.targetChangedEvent -= detector_targetChangeEvent; + FieAbilitiesCooldown cooldownController = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_1); + FieAbilitiesCooldown cooldownController2 = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_2); + FieAbilitiesCooldown cooldownController3 = base.ownerCharacter.abilitiesContainer.GetCooldownController(FieAbilitiesSlot.SlotType.SLOT_3); + if (cooldownController != null) + { + cooldownController.cooldownChangeEvent -= cooldownController_Ability1CooldownChangeEvent; + } + if (cooldownController2 != null) + { + cooldownController2.cooldownChangeEvent -= cooldownController_Ability2CooldownChangeEvent; + } + if (cooldownController3 != null) + { + cooldownController3.cooldownChangeEvent -= cooldownController_Ability3CooldownChangeEvent; + } + } + } + + private void updateGaugeState(FieAbilitiesSlot.SlotType slot) + { + if (_cooldownParams[(int)slot].animationEntry != null) + { + setGaugeAnimationFrame(_cooldownParams[(int)slot].animationEntry, _cooldownParams[(int)slot].latestCooldown, _cooldownParams[(int)slot].maximumCoolown); + } + } + + private void setGaugeAnimationFrame(TrackEntry entry, float latestCooldown, float maxCooldown) + { + float num = 1f; + if (maxCooldown > 0f) + { + num = latestCooldown / maxCooldown; + } + entry.Time = Mathf.Max(Mathf.Min(entry.endTime - num * entry.endTime, entry.endTime), 0f); + entry.TimeScale = 0f; + } + + private void detector_targetChangeEvent(FieGameCharacter fromTargetCharacter, FieGameCharacter toTargetCharacter) + { + if (toTargetCharacter != null && !toTargetCharacter.damageSystem.isDead) + { + changeTarget(toTargetCharacter); + } + else + { + changeTarget(null); + } + FieObjectEnemies fieObjectEnemies = fromTargetCharacter as FieObjectEnemies; + FieObjectEnemies fieObjectEnemies2 = toTargetCharacter as FieObjectEnemies; + if (fieObjectEnemies != null) + { + fieObjectEnemies.isEnableHighLight = false; + } + if (fieObjectEnemies2 != null) + { + fieObjectEnemies2.isEnableHighLight = true; + fieObjectEnemies2.setHighLightColorByTargetStatus(base.ownerCharacter); + } + } + } +} diff --git a/src/Fie.UI/FieLobbyCanvasGUICameraCapture.cs b/src/Fie.UI/FieLobbyCanvasGUICameraCapture.cs new file mode 100644 index 0000000..c022982 --- /dev/null +++ b/src/Fie.UI/FieLobbyCanvasGUICameraCapture.cs @@ -0,0 +1,23 @@ +using Fie.Manager; +using UnityEngine; + +namespace Fie.UI +{ + public class FieLobbyCanvasGUICameraCapture : MonoBehaviour + { + private Canvas selfCanvas; + + private void Start() + { + selfCanvas = base.gameObject.GetComponent(); + } + + private void Update() + { + if (!(selfCanvas == null) && !(FieManagerBehaviour.I.uiCamera == null)) + { + selfCanvas.worldCamera = FieManagerBehaviour.I.uiCamera.camera; + } + } + } +} diff --git a/src/Fie.UI/FieLobbyCharacterSelectUIController.cs b/src/Fie.UI/FieLobbyCharacterSelectUIController.cs new file mode 100644 index 0000000..8daf771 --- /dev/null +++ b/src/Fie.UI/FieLobbyCharacterSelectUIController.cs @@ -0,0 +1,268 @@ +using Fie.Camera; +using Fie.Manager; +using Fie.Ponies.Applejack; +using Fie.Ponies.RainbowDash; +using Fie.Ponies.RisingSun; +using Fie.Ponies.Twilight; +using Fie.User; +using Fie.Utility; +using GameDataEditor; +using System; +using System.Collections; +using TMPro; +using UnityEngine; + +namespace Fie.UI +{ + public class FieLobbyCharacterSelectUIController : MonoBehaviour + { + public enum SelectableElementType + { + Magic, + Kindness, + Laghter, + Loyalty, + Generosity, + Honestly, + Maximum_Element, + PrincessRisingSun + } + + private delegate void ResouceLoadedCallback(T gameCharacter) where T : FieGameCharacter; + + public bool isEnable; + + public float lookingEaseTime = 0.5f; + + public float enableGemLightIntensity = 3f; + + public float enableGemLightBlinkInterval = 1f; + + private bool _gemLightAnimationInverseFlag; + + private bool _initializedFirstTime; + + [SerializeField] + private bool[] existFlagList = new bool[6]; + + [SerializeField] + private Transform[] gemTransformList = new Transform[6]; + + [SerializeField] + private Light[] gemLightList = new Light[6]; + + [SerializeField] + private TextMeshPro elementNameUITextMesh; + + private SelectableElementType _beforeElement; + + private SelectableElementType _currentElement; + + private Tweener _lookAtElementTweener = new Tweener(); + + private Tweener _lightIntesityTweener = new Tweener(); + + private Vector3 _beforeLookAtPosition = Vector3.zero; + + private Vector3 _nowLookAtPosition = Vector3.zero; + + private IEnumerator AsyncLoadCharacterResouce(ResouceLoadedCallback callback) where T : FieGameCharacter + { + FiePrefabInfo existsAttribute = (FiePrefabInfo)Attribute.GetCustomAttribute(typeof(T), typeof(FiePrefabInfo)); + if (existsAttribute == null) + { + callback((T)null); + } + else + { + ResourceRequest loadRequest = Resources.LoadAsync(existsAttribute.path); + float time = 0f; + if (time < 3f && !loadRequest.isDone) + { + float num = time + Time.deltaTime; + yield return (object)null; + /*Error: Unable to find new state assignment for yield return*/; + } + GameObject loadObject = loadRequest.asset as GameObject; + if (loadObject == null) + { + callback((T)null); + } + else + { + T gameCharacter = loadObject.GetComponent(); + if ((UnityEngine.Object)gameCharacter == (UnityEngine.Object)null) + { + callback((T)null); + } + else + { + callback(gameCharacter); + } + } + } + } + + private void Start() + { + UpdateTextMesh(); + } + + private void Update() + { + } + + private void UpdateElementActivity() + { + switch (_currentElement) + { + case SelectableElementType.Maximum_Element: + break; + case SelectableElementType.Magic: + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_MAGIC_DESCRIPTION), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_MAGIC_DESCRIPTION), 30f); + break; + case SelectableElementType.Kindness: + FieManagerBehaviour.I.RequestToHideActivity(); + break; + case SelectableElementType.Laghter: + FieManagerBehaviour.I.RequestToHideActivity(); + break; + case SelectableElementType.Loyalty: + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_LOYALTY_DESCRIPTION), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_LOYALTY_DESCRIPTION), 30f); + break; + case SelectableElementType.Generosity: + FieManagerBehaviour.I.RequestToHideActivity(); + break; + case SelectableElementType.Honestly: + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_ELE_HONESTY_DESCRIPTION), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_ELE_HONESTY_DESCRIPTION), 30f); + break; + case SelectableElementType.PrincessRisingSun: + FieManagerBehaviour.I.RequestActivity(FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_TITLE_RISING_SIUN_DESCRIPTION), FieMasterData.I.GetMasterData(GDEItemKeys.ConstantTextList_ACTIVITY_NOTE_RISING_SUN_DESCRIPTION), 30f); + break; + } + } + + private void UpdateTextMesh() + { + if (!(elementNameUITextMesh == null)) + { + string key = null; + switch (_currentElement) + { + case SelectableElementType.Magic: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_MAGIC; + break; + case SelectableElementType.Kindness: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_KINDNESS; + break; + case SelectableElementType.Laghter: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_LAUGHTER; + break; + case SelectableElementType.Loyalty: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_LOYALTY; + break; + case SelectableElementType.Generosity: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_GENEROSITY; + break; + case SelectableElementType.Honestly: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_HONESTY; + break; + case SelectableElementType.PrincessRisingSun: + key = GDEItemKeys.ConstantTextList_ELEMENT_NAME_PONICO; + break; + } + GDEConstantTextListData constantTextData; + string constantText = FieLocalizeUtility.GetConstantText(key, out constantTextData); + elementNameUITextMesh.font = ((!constantTextData.ForceEnableToUseEnglishFont) ? FieManagerBehaviour.I.currentFont : FieManagerBehaviour.I.englishFont); + elementNameUITextMesh.text = constantText; + elementNameUITextMesh.ForceMeshUpdate(); + } + } + + public void IncreaseElementIndex() + { + int num = (int)(_currentElement + 1); + if (num >= 6) + { + num = 0; + } + _currentElement = (SelectableElementType)num; + } + + public void DecreaseElementIndex() + { + int num = (int)(_currentElement - 1); + if (num < 0) + { + num = 5; + } + _currentElement = (SelectableElementType)num; + } + + public bool isDecidable() + { + return existFlagList[(int)_currentElement]; + } + + public void Decide() + { + FieLobbyGameCharacterGenerateManager.LobbyGameCharacterCreatedCallback lobbyCallback = delegate + { + isEnable = false; + FieManagerBehaviour.I.setDefaultCameraOffset(new Vector3(0f, 0.75f, -5f)); + FieManagerBehaviour.I.setDefaultCameraRotation(new Vector3(354f, 0f, 0f)); + FieManagerBehaviour.I.gameCamera.SetCameraTask(1f); + }; + int userNumberByHash = FieManagerBehaviour.I.getUserNumberByHash(FieManagerBehaviour.I.myHash); + FieUser userData = FieManagerBehaviour.I.GetUserData(userNumberByHash); + FieManagerBehaviour.I.RequestToHideActivity(); + switch (_currentElement) + { + case SelectableElementType.Kindness: + break; + case SelectableElementType.Laghter: + break; + case SelectableElementType.Generosity: + break; + case SelectableElementType.Maximum_Element: + break; + case SelectableElementType.Magic: + { + ResouceLoadedCallback callback4 = delegate + { + FieManagerBehaviour.I.RequestToCreateGameCharacter(userData, lobbyCallback); + }; + StartCoroutine(AsyncLoadCharacterResouce(callback4)); + break; + } + case SelectableElementType.Loyalty: + { + ResouceLoadedCallback callback3 = delegate + { + FieManagerBehaviour.I.RequestToCreateGameCharacter(userData, lobbyCallback); + }; + StartCoroutine(AsyncLoadCharacterResouce(callback3)); + break; + } + case SelectableElementType.Honestly: + { + ResouceLoadedCallback callback2 = delegate + { + FieManagerBehaviour.I.RequestToCreateGameCharacter(userData, lobbyCallback); + }; + StartCoroutine(AsyncLoadCharacterResouce(callback2)); + break; + } + case SelectableElementType.PrincessRisingSun: + { + ResouceLoadedCallback callback = delegate + { + FieManagerBehaviour.I.RequestToCreateGameCharacter(userData, lobbyCallback); + }; + StartCoroutine(AsyncLoadCharacterResouce(callback)); + break; + } + } + } + } +} diff --git a/src/Fie.UI/FieLobbyNameEntryUIController.cs b/src/Fie.UI/FieLobbyNameEntryUIController.cs new file mode 100644 index 0000000..562d249 --- /dev/null +++ b/src/Fie.UI/FieLobbyNameEntryUIController.cs @@ -0,0 +1,22 @@ +using Fie.Manager; +using UnityEngine; +using UnityEngine.UI; + +namespace Fie.UI +{ + public class FieLobbyNameEntryUIController : MonoBehaviour + { + [SerializeField] + private Text _nameEntryField; + + public void Decide() + { + string myName = string.Empty; + if (_nameEntryField != null && _nameEntryField.text != string.Empty) + { + myName = _nameEntryField.text; + } + FieManagerBehaviour.I.SetMyName(myName); + } + } +} diff --git a/src/Fie.UI/FieLobbySelectableUICharacterSelect.cs b/src/Fie.UI/FieLobbySelectableUICharacterSelect.cs new file mode 100644 index 0000000..0c97548 --- /dev/null +++ b/src/Fie.UI/FieLobbySelectableUICharacterSelect.cs @@ -0,0 +1,321 @@ +using Fie.Manager; +using Fie.Utility; +using GameDataEditor; +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace Fie.UI +{ + public class FieLobbySelectableUICharacterSelect : MonoBehaviour + { + public enum CharacterSelectMode + { + SELECTING_PLAYER_CHARACTER, + CONFIRMING_REBIRTH + } + + [SerializeField] + private List _buttons; + + [SerializeField] + private FieLobbySelectableUIController _parent; + + [SerializeField] + private FieUIConstant2DText _CharacterNameText; + + [SerializeField] + private Image _CharacterNameBG; + + [SerializeField] + private FieUIConstant2DText _CharacterLevelText; + + [SerializeField] + private TextMeshProUGUI _CharacterDescText; + + [SerializeField] + private FieLobbySelectableUICharacterSelectButton _firstSelectButton; + + [SerializeField] + private RectTransform _characterWindowRectTransform; + + [SerializeField] + private RectTransform _cursor; + + [SerializeField] + private Image _characterWindowImageCenter; + + [SerializeField] + private RectTransform rebirthingWindowTransform; + + [SerializeField] + private List