├── .gitignore ├── AICrawler └── AICrawler.cs ├── ActionsAndDecisions ├── AIActFollowPlayer.cs ├── AIActionFlickering.cs ├── AIActionModifySpeed.cs └── AIDecTargetHealth.cs ├── Art Transform Savers ├── ArtTransformSaver.cs ├── ArtTransformShortcut.cs ├── Editor │ ├── ArtTransformSaverEditor.cs │ └── ArtTransformShortcutEditor.cs └── Read me.txt ├── BGMToggler └── BGMToggler.cs ├── BlockAbilities ├── BlockAbilitiesWhileAttacking.cs ├── BlockAbilitiesWhileAttacking.cs.meta ├── BlockAbilitiesWhileGrabbing.cs ├── BlockAbilitiesWhileGrabbing.cs.meta ├── CharacterAbilities.cs ├── CharacterAbilities.cs.meta ├── CharacterAbilitiesUtils.cs └── CharacterAbilitiesUtils.cs.meta ├── CharacterDamageMultiplier ├── DamageMultiplierCharacterHandleWeapon.cs ├── DamageMultiplierMeleeWeapon.cs ├── DamageMultiplierProjectileWeapon.cs └── PickableDamageMultiplier.cs ├── CharacterDoubleDashSeperateCooldowns └── DoubleDash.cs ├── CharacterLadderExtended └── CharacterLadderExtended.cs ├── CharacterMultiButtonActivation └── CharacterMultiButtonActivation.cs ├── CharacterPersistence_CustomScene └── CharacterPersistence_CustomScene.cs ├── CharacterPushCorgiControllerExtended └── CharacterPushCorgiControllerExtended.cs ├── CharacterTimeToJumpApex └── CharacterTimeToJumpApex.cs ├── CharacterWallclingOverride └── CharacterWallclingOverride.cs ├── ControlFreak2Integration ├── CF2-Corgi-Players1-4.unitypackage └── Corgi-v5-rig-with-Action-button.unitypackage ├── CustomAutoRespawn └── CustomAutoRespawn.cs ├── DialogueZoneExtended ├── AIWalkExtended.cs └── DialogueZoneExtended.cs ├── DialogueZoneItems └── DialogueZoneItems.cs ├── FlyingCharacterDash └── FlyingCharacterDash.cs ├── FreezingDamageOnTouch ├── FreezingDamageOnTouch.cs └── FreezingMeleeWeapon.cs ├── HealthGUI └── HealthGUI.cs ├── InControlIntegration ├── InControl_Integration_Readme.txt ├── InputManager.cs └── MMInControl.cs ├── ItemDrop └── ItemDrop.cs ├── JumpToJetpack └── JumpToJetpack.cs ├── KeyAmountOperatedZone ├── CorgiEngine4.2 │ └── KeyAmountOperatedZone.cs └── KeyAmountOperatedZone.cs ├── LICENSE ├── LevelManagerCinemachineBased └── LevelManagerCinemachineBased.cs ├── MoveAwayPlatform └── MoveAwayPlatform.cs ├── MovingPlatformExtended └── MovingPlatformExtended.cs ├── MultiInventoryDetails ├── ItemDetails.cs └── README.md ├── MultipleCharactersPointsOfEntry └── MultipleCharactersPointsOfEntryLevelManager.cs ├── MultipleWeapons ├── CharacterMultipleHandleWeapon.cs ├── InputManager.asset └── MultipleWeaponsInputManager.cs ├── NoClip └── NoClip.cs ├── ObjectActivatedZones ├── ObjectActivated.cs └── ObjectActivatedZone.cs ├── ParallaxFactorCalculator ├── Editor │ └── ParallaxFacCalcEditor.cs ├── FactorCalcExample.unity ├── ParallaxFacCalc.cs └── ParallaxO.cs ├── PlayerInvisibility ├── EnemiesTargetLayerMask.asset ├── EnemiesTargetLayerMask.asset.meta ├── PlayerInvisibility.unity ├── PlayerInvisibility.unity.meta ├── PlayerInvisibility.unitypackage ├── Scripts.meta ├── Scripts │ ├── LayerMaskVariable.cs │ ├── LayerMaskVariable.cs.meta │ ├── TargetLayerMaskUpdater.cs │ └── TargetLayerMaskUpdater.cs.meta ├── StaticData.meta └── StaticData │ ├── NothingLayerMask.asset │ ├── NothingLayerMask.asset.meta │ ├── PlayerLayerMask.asset │ └── PlayerLayerMask.asset.meta ├── PogoWeapon ├── PogoWeapon.cs ├── PogoWeapon.cs.meta ├── PogoWeapon.unitypackage ├── PogoWeaponDemo.unity ├── PogoWeaponDemo.unity.meta ├── Prefabs.meta └── Prefabs │ ├── Pogo.prefab │ ├── Pogo.prefab.meta │ ├── PogoWeapon.prefab │ └── PogoWeapon.prefab.meta ├── ProgressionSystem ├── Editor.meta ├── Editor │ ├── LevelValueCurveVariableEditor.cs │ └── LevelValueCurveVariableEditor.cs.meta ├── Prefabs.meta ├── Prefabs │ ├── DamageMultipliedCorgiMachineGun.prefab │ ├── DamageMultipliedCorgiMachineGun.prefab.meta │ ├── DamageMultipliedCorgiMachineGunProjectile.prefab │ ├── DamageMultipliedCorgiMachineGunProjectile.prefab.meta │ ├── ProgressionBar.prefab │ └── ProgressionBar.prefab.meta ├── ProgressionSystem.unitypackage ├── ProgressionSystemDemo.unity ├── ProgressionSystemDemo.unity.meta ├── ScriptableObjects.meta ├── ScriptableObjects │ ├── Progression.meta │ ├── Progression │ │ ├── PlayerExperience.asset │ │ ├── PlayerExperience.asset.meta │ │ ├── PlayerLevel.asset │ │ ├── PlayerLevel.asset.meta │ │ ├── PlayerLevelExperienceCurve.asset │ │ ├── PlayerLevelExperienceCurve.asset.meta │ │ ├── PlayerProgression.asset │ │ └── PlayerProgression.asset.meta │ ├── Stats.meta │ └── Stats │ │ ├── DamageMultiplier.meta │ │ ├── DamageMultiplier │ │ ├── PlayerDamageMultiplier.asset │ │ ├── PlayerDamageMultiplier.asset.meta │ │ ├── PlayerDamageMultiplierUpdater.asset │ │ ├── PlayerDamageMultiplierUpdater.asset.meta │ │ ├── PlayerLevelDamageMultiplierCurve.asset │ │ └── PlayerLevelDamageMultiplierCurve.asset.meta │ │ ├── MaxHealth.meta │ │ ├── MaxHealth │ │ ├── PlayerLevelMaxHealthCurve.asset │ │ ├── PlayerLevelMaxHealthCurve.asset.meta │ │ ├── PlayerMaxHealth.asset │ │ ├── PlayerMaxHealth.asset.meta │ │ ├── PlayerMaxHealthUpdater.asset │ │ └── PlayerMaxHealthUpdater.asset.meta │ │ ├── WalkSpeed.meta │ │ └── WalkSpeed │ │ ├── PlayerLevelWalkSpeedCurve.asset │ │ ├── PlayerLevelWalkSpeedCurve.asset.meta │ │ ├── PlayerWalkSpeed.asset │ │ ├── PlayerWalkSpeed.asset.meta │ │ ├── PlayerWalkSpeedUpdater.asset │ │ └── PlayerWalkSpeedUpdater.asset.meta ├── Scripts.meta └── Scripts │ ├── Core.meta │ ├── Core │ ├── Progression.cs │ └── Progression.cs.meta │ ├── Events.meta │ ├── Events │ ├── OnDeath.cs │ ├── OnDeath.cs.meta │ ├── OnIntVariableChange.cs │ └── OnIntVariableChange.cs.meta │ ├── Extensions.meta │ ├── Extensions │ ├── MultipliedDamageOnTouch.cs │ └── MultipliedDamageOnTouch.cs.meta │ ├── Links.meta │ ├── Links │ ├── MaxHealthLink.cs │ ├── MaxHealthLink.cs.meta │ ├── WalkSpeedLink.cs │ └── WalkSpeedLink.cs.meta │ ├── UI.meta │ ├── UI │ ├── ExperienceProgressBar.cs │ ├── ExperienceProgressBar.cs.meta │ ├── FloatVariableText.cs │ ├── FloatVariableText.cs.meta │ ├── IntVariableText.cs │ └── IntVariableText.cs.meta │ ├── Updaters.meta │ ├── Updaters │ ├── LevelBasedFloatVariableUpdater.cs │ ├── LevelBasedFloatVariableUpdater.cs.meta │ ├── LevelBasedIntVariableUpdater.cs │ ├── LevelBasedIntVariableUpdater.cs.meta │ ├── LevelBasedVariableUpdater.cs │ └── LevelBasedVariableUpdater.cs.meta │ ├── Variables.meta │ └── Variables │ ├── FloatVariable.cs │ ├── FloatVariable.cs.meta │ ├── IntVariable.cs │ ├── IntVariable.cs.meta │ ├── LevelValueCurveVariable.cs │ ├── LevelValueCurveVariable.cs.meta │ ├── NumericVariable.cs │ └── NumericVariable.cs.meta ├── ProjectileHoming └── ProjectileHoming.cs ├── README.md ├── RespawnWhenPlayerEntersRoom └── RespawnWhenPlayerEntersRoom.cs ├── Retroid └── Retroid.unitypackage ├── RotationalActivation ├── CharacterRotationalActivation.cs ├── InputActionsWithRotation.inputactions ├── InputSystemManagerWithRotation.cs └── RotationActivated.cs ├── SceneNavigationInformation └── SceneNavigationInformation.cs ├── SimpleConditionalActions └── SimpleConditionalActions.cs ├── SplitScreen ├── SplitScreen.cs └── SplitScreenManager.cs ├── StackablePushable ├── Prefabs │ ├── StackablePushableBox.prefab │ ├── StackablePushableBox.prefab.meta │ ├── Tileset.prefab │ └── Tileset.prefab.meta ├── Scenes │ ├── StackablePushable.unity │ └── StackablePushable.unity.meta ├── Scripts │ ├── StackableCorgiController.cs │ ├── StackableCorgiController.cs.meta │ ├── StackablePushable.cs │ └── StackablePushable.cs.meta └── Sprites │ ├── Block.asset │ ├── Block.asset.meta │ ├── Block.png │ └── Block.png.meta ├── StaminaExtension ├── Scripts.meta ├── Scripts │ ├── PickableStamina.cs │ ├── PickableStamina.cs.meta │ ├── Stamina.cs │ ├── Stamina.cs.meta │ ├── StaminaBarUpdater.cs │ └── StaminaBarUpdater.cs.meta ├── StaminaDemo.unity ├── StaminaDemo.unity.meta ├── StaminaExtension.unitypackage ├── StaminaRectangle.prefab └── StaminaRectangle.prefab.meta ├── StatusEffectSystem ├── Demo.meta ├── Demo │ ├── MinimalStatusEffectDemo.unity │ ├── MinimalStatusEffectDemo.unity.meta │ ├── Resources.meta │ ├── Resources │ │ ├── Items.meta │ │ ├── Items │ │ │ ├── HealingPotion.asset │ │ │ ├── HealingPotion.asset.meta │ │ │ ├── SharpSword.asset │ │ │ └── SharpSword.asset.meta │ │ ├── RuntimeSets.meta │ │ └── RuntimeSets │ │ │ ├── CharacterDamageMultipliers.asset │ │ │ └── CharacterDamageMultipliers.asset.meta │ ├── StatusEffects.meta │ ├── StatusEffects │ │ ├── DamageOverTime.asset │ │ ├── DamageOverTime.asset.meta │ │ ├── DoubleDamage.asset │ │ ├── DoubleDamage.asset.meta │ │ ├── Freeze.asset │ │ ├── Freeze.asset.meta │ │ ├── HealOverTime.asset │ │ ├── HealOverTime.asset.meta │ │ ├── SpeedBoost.asset │ │ ├── SpeedBoost.asset.meta │ │ ├── TemporarySlow.asset │ │ └── TemporarySlow.asset.meta │ ├── StatusEffectsRectangle.prefab │ └── StatusEffectsRectangle.prefab.meta ├── Scripts.meta ├── Scripts │ ├── Character.meta │ ├── Character │ │ ├── CharacterStatusEffectListener.cs │ │ └── CharacterStatusEffectListener.cs.meta │ ├── Items.meta │ ├── Items │ │ ├── InventoryStatusEffect.cs │ │ └── InventoryStatusEffect.cs.meta │ ├── Others.meta │ ├── Others │ │ ├── ApplyStatusAndDamageOnTouch.cs │ │ ├── ApplyStatusAndDamageOnTouch.cs.meta │ │ ├── CharacterDamageMultipliers.cs │ │ ├── CharacterDamageMultipliers.cs.meta │ │ ├── MultipliedDamageOnTouch.cs │ │ ├── MultipliedDamageOnTouch.cs.meta │ │ ├── StatusEffectMeleeWeapon.cs │ │ ├── StatusEffectMeleeWeapon.cs.meta │ │ ├── StatusEffectTester.cs │ │ └── StatusEffectTester.cs.meta │ ├── StatusEffects.meta │ └── StatusEffects │ │ ├── Abstract.meta │ │ ├── Abstract │ │ ├── StatusEffect.cs │ │ ├── StatusEffect.cs.meta │ │ ├── TemporaryStatusEffect.cs │ │ └── TemporaryStatusEffect.cs.meta │ │ ├── Concrete.meta │ │ └── Concrete │ │ ├── DamageMultiplier.cs │ │ ├── DamageMultiplier.cs.meta │ │ ├── DamageOverTime.cs │ │ ├── DamageOverTime.cs.meta │ │ ├── Freeze.cs │ │ ├── Freeze.cs.meta │ │ ├── TemporarySpeed.cs │ │ └── TemporarySpeed.cs.meta └── StatusEffectSystem.unitypackage ├── TeleporterWithZoom └── TeleporterWithZoom.cs ├── TriggerEventOnAreaClear ├── AreaClearTarget.cs └── TriggerEventOnAreaClear.cs ├── TypedDamage ├── DamageType.cs ├── TypedDamageOnTouch.cs ├── TypedHealth.cs └── TypedMeleeWeapon.cs └── WeaponDisable └── WeaponDisable.cs /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | -------------------------------------------------------------------------------- /ActionsAndDecisions/AIActionFlickering.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.Tools; 5 | 6 | namespace MoreMountains.CorgiEngine 7 | { 8 | 9 | public class AIActionFlickering : AIAction 10 | { 11 | // Add this component to an AI Brain and agent speed will flicker the same way when damage is taken but enless. 12 | // Muppo (2018) 13 | 14 | public Color _flickerColor; 15 | 16 | protected float _flickerSpeed = 0.05f; // Using higher values will work as a delay more than a real flicker 17 | protected Renderer _renderer; 18 | protected Character _character; 19 | protected Color _initialColor = new Color32(255, 255, 255, 255); 20 | protected float flickerDuration = 999999999f; 21 | 22 | /// 23 | protected override void Initialization() 24 | { 25 | _renderer = GetComponent(); 26 | 27 | 28 | _character = GetComponent(); 29 | if (gameObject.MMGetComponentNoAlloc() != null) 30 | { 31 | _renderer = GetComponent(); 32 | _initialColor = GetComponent().color; 33 | } 34 | if (_character != null) 35 | { 36 | if (_character.CharacterModel != null) 37 | { 38 | if (_character.CharacterModel.GetComponentInChildren() != null) 39 | { 40 | _renderer = _character.CharacterModel.GetComponentInChildren(); 41 | } 42 | } 43 | } 44 | } 45 | 46 | /// 47 | public override void PerformAction() 48 | { 49 | if (_renderer != null) 50 | { 51 | StartCoroutine(MMImage.Flicker(_renderer,_initialColor,_flickerColor,_flickerSpeed,flickerDuration)); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ActionsAndDecisions/AIActionModifySpeed.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.Tools; 5 | 6 | namespace MoreMountains.CorgiEngine 7 | { 8 | // Add this component to an AI Brain and agent speed will be override with this value. 9 | // Muppo (2018) 10 | 11 | public class AIActionModifySpeed : AIAction 12 | { 13 | public float newSpeed; 14 | 15 | protected CharacterHorizontalMovement _horizontalMovement; 16 | protected float originalSpeed; 17 | 18 | 19 | protected override void Initialization() 20 | { 21 | _horizontalMovement = this.gameObject.GetComponent(); 22 | originalSpeed = _horizontalMovement.WalkSpeed; 23 | } 24 | 25 | public override void PerformAction() 26 | { 27 | _horizontalMovement.MovementSpeed = newSpeed; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ActionsAndDecisions/AIDecTargetHealth.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using UnityEngine; 3 | 4 | namespace MoreMountains.CorgiEngine 5 | { 6 | /// 7 | /// This checks Brain target health, if it's below the set value, decision will be receive True or False return. 8 | /// Muppo (2021) 9 | /// 10 | 11 | public class AIDecTargetHealth : AIDecision 12 | { 13 | public float healthAmmountToCheck = 0f; 14 | public bool returnValue = true; 15 | [SerializeField] protected Health targetHealth; 16 | 17 | 18 | public override bool Decide() 19 | { 20 | return CheckHealth(); 21 | } 22 | 23 | protected virtual bool CheckHealth() 24 | { 25 | if (_brain.Target == null) 26 | { 27 | return true; 28 | } 29 | 30 | targetHealth = _brain.Target.GetComponent(); 31 | if (targetHealth.CurrentHealth <= healthAmmountToCheck) 32 | { 33 | targetHealth = null; 34 | return returnValue; 35 | } 36 | 37 | return !returnValue; 38 | // return false; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Art Transform Savers/ArtTransformSaver.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | 7 | public class ArtTransformSaver : MonoBehaviour 8 | { 9 | //Simple script to keep the sprites from moving around during editing from the parallax effect. 10 | 11 | //It is added to a gameobject and its button is then pressed to save any of its transform parameters. 12 | 13 | //On awake, it will reset the object's transform to the saved one. 14 | 15 | //Say goodbye to messy sprite positions. 16 | 17 | public Transform thisTransform; 18 | public Vector3 ConstantPos; 19 | public Quaternion ConstantRot; 20 | public Vector3 ConstantScale; 21 | 22 | public void SaveTransformDetails() 23 | { 24 | thisTransform = GetComponent(); 25 | ConstantPos = thisTransform.localPosition; 26 | ConstantRot = thisTransform.localRotation; 27 | ConstantScale = thisTransform.localScale; 28 | } 29 | 30 | public void ApplyTransformDetails() 31 | { 32 | if (thisTransform == null) 33 | { 34 | Debug.LogError("No transform component was set."); 35 | } 36 | 37 | thisTransform.localRotation = ConstantRot; 38 | thisTransform.localScale = ConstantScale; 39 | thisTransform.localPosition = ConstantPos; 40 | } 41 | 42 | private void OnApplicationQuit() 43 | { 44 | ApplyTransformDetails(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Art Transform Savers/ArtTransformShortcut.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.CorgiEngine; 5 | 6 | public class ArtTransformShortcut : MonoBehaviour 7 | { 8 | //This script is a script placed at the big locations game object which contains all frames. 9 | //If any gameobject (art) has a transform saver, it will use its functions. 10 | 11 | //This is a global button and will affect all sprites. Only to be used in editor. 12 | 13 | public ArtTransformSaver[] AllArtSavers; 14 | public ParallaxElement[] AllParallaxElements; 15 | public bool EnableAllParallaxElementsOnStart = true; 16 | 17 | private void Awake() 18 | { 19 | if (EnableAllParallaxElementsOnStart) 20 | { 21 | EnableAllParallax(); 22 | } 23 | } 24 | 25 | public void RetrieveAllTransformSavers() 26 | { 27 | AllArtSavers = GetComponentsInChildren(); 28 | AllParallaxElements = GetComponentsInChildren(); 29 | 30 | if(AllArtSavers == null || AllParallaxElements == null) 31 | { 32 | Debug.LogError("No artsavers were found in children. Make sure this script is placed at the top most gameobject."); 33 | } 34 | if (AllArtSavers != null || AllParallaxElements != null) 35 | { 36 | Debug.Log("Artsavers found or updated, and assigned successfully."); 37 | } 38 | 39 | } 40 | 41 | public void DisableAllParallax() 42 | { 43 | for (int i = 0; i < AllParallaxElements.Length; i++) 44 | { 45 | AllParallaxElements[i].enabled = false; 46 | } 47 | Debug.Log("All Parallax Elements Disabled."); 48 | } 49 | 50 | public void EnableAllParallax() 51 | { 52 | for (int i = 0; i < AllParallaxElements.Length; i++) 53 | { 54 | AllParallaxElements[i].enabled = true; 55 | } 56 | Debug.Log("All Parallax Elements Enabled."); 57 | } 58 | 59 | 60 | 61 | public void SaveAll() 62 | { 63 | for (int i = 0; i < AllArtSavers.Length; i++) 64 | { 65 | AllArtSavers[i].SaveTransformDetails(); 66 | } 67 | Debug.Log("Transforms Saved Successfully"); 68 | } 69 | 70 | public void ResetAllToSaved() 71 | { 72 | for (int i = 0; i < AllArtSavers.Length; i++) 73 | { 74 | AllArtSavers[i].ApplyTransformDetails(); 75 | } 76 | Debug.Log("Transforms Reset Successfully"); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Art Transform Savers/Editor/ArtTransformSaverEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(ArtTransformSaver))] 7 | 8 | public class ArtTransformSaverEditor : Editor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | DrawDefaultInspector(); 13 | 14 | ArtTransformSaver transformSaverScript = (ArtTransformSaver)target; 15 | 16 | if (GUILayout.Button("Save Selected Details")) 17 | { 18 | transformSaverScript.SaveTransformDetails(); 19 | } 20 | 21 | if (GUILayout.Button("Apply Selected Details")) 22 | { 23 | transformSaverScript.ApplyTransformDetails(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Art Transform Savers/Editor/ArtTransformShortcutEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(ArtTransformShortcut))] 7 | public class ArtTransformShortcutEditor : Editor 8 | { 9 | //This script is a script placed at the big locations game object which contains all frames. 10 | //If any gameobject (art) has a transform saver, it will use its functions. 11 | 12 | //This is a global button and will affect all sprites. Only used in editor. 13 | 14 | public override void OnInspectorGUI() 15 | { 16 | DrawDefaultInspector(); 17 | 18 | ArtTransformShortcut transformSaverScript = (ArtTransformShortcut)target; 19 | 20 | if (GUILayout.Button("Retrieve All Artsaver and Parallax Objects From Children")) 21 | { 22 | transformSaverScript.RetrieveAllTransformSavers(); 23 | } 24 | 25 | EditorGUILayout.Space(25); 26 | 27 | EditorGUILayout.HelpBox("Before modifying the scene's arts, please disable all parallax objects with the button below. This is to prevent any accidental movement of the sprites during editing.", MessageType.Warning); 28 | 29 | if (GUILayout.Button("Enable All Parallax Objects")) 30 | { 31 | transformSaverScript.EnableAllParallax(); 32 | } 33 | 34 | if (GUILayout.Button("Disable All Parallax Objects")) 35 | { 36 | transformSaverScript.DisableAllParallax(); 37 | } 38 | 39 | 40 | EditorGUILayout.Space(25); 41 | 42 | 43 | 44 | EditorGUILayout.Space(25); 45 | 46 | EditorGUILayout.HelpBox("This will save all positions. Make sure everything is where it needs to be!", MessageType.Warning); 47 | 48 | if (GUILayout.Button("Save All Art Positions")) 49 | { 50 | transformSaverScript.SaveAll(); 51 | } 52 | 53 | EditorGUILayout.Space(25); 54 | 55 | 56 | 57 | EditorGUILayout.HelpBox("This will reset all positions to their saved place. Make sure everything is saved correctly!", MessageType.Warning); 58 | 59 | 60 | if (GUILayout.Button("Reset All Art Positions To Saved")) 61 | { 62 | transformSaverScript.ResetAllToSaved(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Art Transform Savers/Read me.txt: -------------------------------------------------------------------------------- 1 | This is a script which helps with the parallax scripts of corgi engine or any other. It's for saving the current sprite positions in the scene. 2 | 3 | Place ArtTransformShortcut on the main gameobject which contains all of your art. For metroidvanias, if you have multiple rooms set up under one gameobject, place the script at that gameobject. 4 | 5 | Then, for each art game object whose transform details you want to save, add an ArtTransformSaver 6 | 7 | Then, from the ArtTransformShortcut, you can get all ArtTransformSavers, and from there, you can save all transforms of all objects that have the ArtTransformSaver script. 8 | 9 | -------------------------------------------------------------------------------- /BGMToggler/BGMToggler.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using MoreMountains.Tools; 5 | 6 | namespace MoreMountains.CorgiEngine 7 | { 8 | [RequireComponent(typeof(BoxCollider2D))] 9 | 10 | /// Add this component to an empty object and it will add a collider which will change/mute background music when a player stay on collider or exit it. 11 | /// v1.0 / Muppo (2018) 12 | 13 | public class BGMToggler : BackgroundMusic 14 | { 15 | public enum SoundModes { ChangeMusic, ChangeVolume, Mute, MuteAndRestart } 16 | 17 | // Set music for this area defined by the collider 18 | public AudioClip thisAreaBGM; 19 | // Set volume on this area 20 | [Range(0,1)] 21 | public float newVolume; 22 | // And the type of modifier 23 | public SoundModes MuteType = SoundModes.ChangeVolume; 24 | 25 | protected float defaultVolume; 26 | protected AudioClip defaultBGM; 27 | 28 | /// 29 | protected override void Start() 30 | { 31 | _source = gameObject.AddComponent() as AudioSource; 32 | _source.playOnAwake = true; // need it this way in order to play the swapped music 33 | _source.spatialBlend = 0; 34 | _source.rolloffMode = AudioRolloffMode.Logarithmic; 35 | _source.loop = true; 36 | 37 | _source.clip = SoundClip; 38 | SoundManager.Instance.PlayBackgroundMusic(_source); 39 | 40 | defaultVolume = _source.volume; 41 | defaultBGM = SoundClip; 42 | } 43 | 44 | /// Actions when player enters the zone 45 | public virtual void OnTriggerEnter2D(Collider2D other) 46 | { 47 | if(other.CompareTag("Player")) 48 | { 49 | if (MuteType == SoundModes.ChangeMusic) 50 | { 51 | if(thisAreaBGM != null) 52 | { 53 | _source.clip = thisAreaBGM; 54 | SoundManager.Instance.PlayBackgroundMusic(_source); 55 | } 56 | } 57 | 58 | if (MuteType == SoundModes.ChangeVolume) 59 | { _source.volume = newVolume; } 60 | 61 | if (MuteType == SoundModes.Mute) 62 | { _source.mute = true; } 63 | 64 | if (MuteType == SoundModes.MuteAndRestart) 65 | { _source.enabled = false; } 66 | } 67 | } 68 | 69 | /// Actions when player leaves the zone 70 | public virtual void OnTriggerExit2D(Collider2D other) 71 | { 72 | if(other.CompareTag("Player")) 73 | { 74 | if (MuteType == SoundModes.ChangeMusic) 75 | { 76 | if(defaultBGM != null) 77 | { 78 | _source.clip = defaultBGM; 79 | SoundManager.Instance.PlayBackgroundMusic(_source); 80 | } 81 | } 82 | 83 | if (MuteType == SoundModes.ChangeVolume) 84 | { _source.volume = defaultVolume; } 85 | 86 | if (MuteType == SoundModes.Mute) 87 | { _source.mute = false; } 88 | 89 | if (MuteType == SoundModes.MuteAndRestart) 90 | { _source.enabled = true; } 91 | } 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /BlockAbilities/BlockAbilitiesWhileAttacking.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | 6 | public class BlockAbilitiesWhileAttacking : MonoBehaviour, MMEventListener> 7 | { 8 | public CharacterAbilities[] AbilitiesToBlock; 9 | private Character _character; 10 | private CharacterHandleWeapon[] _characterHandleWeapons; 11 | private int _weaponsInUse; 12 | 13 | private int WeaponsInUse 14 | { 15 | get => _weaponsInUse; 16 | set 17 | { 18 | var newValue = Math.Max(value, 0); 19 | if (newValue == _weaponsInUse) return; 20 | var oldValue = _weaponsInUse; 21 | _weaponsInUse = newValue; 22 | if (oldValue == 0) CharacterAbilitiesUtils.PermitAbilities(_character, AbilitiesToBlock, false); 23 | else if (newValue == 0) CharacterAbilitiesUtils.PermitAbilities(_character, AbilitiesToBlock); 24 | } 25 | } 26 | 27 | private void Awake() 28 | { 29 | _character = GetComponentInParent(); 30 | _characterHandleWeapons = _character.GetComponentsInChildren(); 31 | } 32 | 33 | private void OnEnable() 34 | { 35 | this.MMEventStartListening(); 36 | } 37 | 38 | private void OnDisable() 39 | { 40 | this.MMEventStopListening(); 41 | } 42 | 43 | public void OnMMEvent(MMStateChangeEvent weaponStateChangeEvent) 44 | { 45 | foreach (var characterHandleWeapon in _characterHandleWeapons) 46 | { 47 | if (!characterHandleWeapon.CurrentWeapon || weaponStateChangeEvent.Target != characterHandleWeapon.CurrentWeapon.gameObject) continue; 48 | switch (weaponStateChangeEvent.NewState) 49 | { 50 | case Weapon.WeaponStates.WeaponStart: 51 | WeaponsInUse++; 52 | break; 53 | case Weapon.WeaponStates.WeaponStop: 54 | WeaponsInUse--; 55 | break; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /BlockAbilities/BlockAbilitiesWhileAttacking.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e53d756590577834e8c9c8f614dcd344 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BlockAbilities/BlockAbilitiesWhileGrabbing.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | public class BlockAbilitiesWhileGrabbing : MonoBehaviour, MMEventListener 6 | { 7 | public CharacterAbilities[] AbilitiesToBlock; 8 | private Character _character; 9 | 10 | private void Awake() 11 | { 12 | _character = GetComponentInParent(); 13 | } 14 | 15 | private void OnEnable() 16 | { 17 | this.MMEventStartListening(); 18 | } 19 | 20 | private void OnDisable() 21 | { 22 | this.MMEventStopListening(); 23 | } 24 | 25 | public void OnMMEvent(MMCharacterEvent characterEvent) 26 | { 27 | if (characterEvent.TargetCharacter != _character || characterEvent.EventType != MMCharacterEventTypes.Grab) return; 28 | CharacterAbilitiesUtils.PermitAbilities(_character, AbilitiesToBlock, characterEvent.Moment == MMCharacterEvent.Moments.End); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BlockAbilities/BlockAbilitiesWhileGrabbing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe3ccf1ecc5fa23499366fcf82dfd30e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BlockAbilities/CharacterAbilities.cs: -------------------------------------------------------------------------------- 1 | public enum CharacterAbilities 2 | { 3 | CharacterRun, 4 | CharacterDash, 5 | CharacterJump, 6 | CharacterMovement, 7 | CharacterSlopeOrientation, 8 | CharacterCrouch, 9 | CharacterSwap, 10 | CharacterSwitchModel, 11 | CharacterButtonActivation, 12 | CharacterTimeControl, 13 | CharacterInventory 14 | } 15 | -------------------------------------------------------------------------------- /BlockAbilities/CharacterAbilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e8bd50db4e53ac4383d257a14ed3c6a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /BlockAbilities/CharacterAbilitiesUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MoreMountains.CorgiEngine; 3 | 4 | public static class CharacterAbilitiesUtils 5 | { 6 | public static void PermitAbilities(Character character, CharacterAbilities[] abilities, bool permit = true) 7 | { 8 | foreach (var ability in abilities) 9 | switch (ability) 10 | { 11 | case CharacterAbilities.CharacterRun: 12 | character.FindAbility()?.PermitAbility(permit); 13 | break; 14 | case CharacterAbilities.CharacterDash: 15 | character.FindAbility()?.PermitAbility(permit); 16 | break; 17 | case CharacterAbilities.CharacterJump: 18 | character.FindAbility()?.PermitAbility(permit); 19 | break; 20 | case CharacterAbilities.CharacterMovement: 21 | character.FindAbility()?.PermitAbility(permit); 22 | break; 23 | case CharacterAbilities.CharacterSlopeOrientation: 24 | character.FindAbility()?.PermitAbility(permit); 25 | break; 26 | case CharacterAbilities.CharacterCrouch: 27 | character.FindAbility()?.PermitAbility(permit); 28 | break; 29 | case CharacterAbilities.CharacterSwap: 30 | character.FindAbility()?.PermitAbility(permit); 31 | break; 32 | case CharacterAbilities.CharacterSwitchModel: 33 | character.FindAbility()?.PermitAbility(permit); 34 | break; 35 | case CharacterAbilities.CharacterButtonActivation: 36 | character.FindAbility()?.PermitAbility(permit); 37 | break; 38 | case CharacterAbilities.CharacterTimeControl: 39 | character.FindAbility()?.PermitAbility(permit); 40 | break; 41 | case CharacterAbilities.CharacterInventory: 42 | character.FindAbility()?.PermitAbility(permit); 43 | break; 44 | default: 45 | throw new ArgumentOutOfRangeException(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /BlockAbilities/CharacterAbilitiesUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0fa64f494b5170408a9552188e95c09 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterDamageMultiplier/DamageMultiplierCharacterHandleWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | 4 | namespace CharacterDamageMultiplier 5 | { 6 | public class DamageMultiplierCharacterHandleWeapon : CharacterHandleWeapon 7 | { 8 | private float _damageMultiplier = 1f; 9 | 10 | public float DamageMultiplier 11 | { 12 | get => _damageMultiplier; 13 | set 14 | { 15 | _damageMultiplier = value; 16 | ApplyDamageMultiplier(); 17 | } 18 | } 19 | 20 | public override void ChangeWeapon(Weapon newWeapon, string weaponID, bool combo = false) 21 | { 22 | base.ChangeWeapon(newWeapon, weaponID, combo); 23 | ApplyDamageMultiplier(); 24 | if (combo || CurrentWeapon == null) return; 25 | var comboWeapon = CurrentWeapon.gameObject.MMGetComponentNoAlloc(); 26 | if (!comboWeapon) return; 27 | var weapons = comboWeapon.GetComponents(); 28 | foreach(var weapon in weapons) weapon.ApplyDamageMultiplier(_damageMultiplier); 29 | } 30 | 31 | private void ApplyDamageMultiplier() 32 | { 33 | if (CurrentWeapon == null) return; 34 | CurrentWeapon.ApplyDamageMultiplier(_damageMultiplier); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CharacterDamageMultiplier/DamageMultiplierMeleeWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | 3 | namespace CharacterDamageMultiplier 4 | { 5 | public class DamageMultiplierMeleeWeapon : MeleeWeapon 6 | { 7 | public override void ApplyDamageMultiplier(float multiplier) { _damageOnTouch.DamageCaused = (int)(DamageCaused * multiplier); } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CharacterDamageMultiplier/DamageMultiplierProjectileWeapon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | 6 | namespace CharacterDamageMultiplier 7 | { 8 | public class DamageMultiplierProjectileWeapon : ProjectileWeapon 9 | { 10 | [MMInspectorGroup("Damage", true, 66)] 11 | public float DamageCaused = 10; 12 | [MMReadOnly] private float _damageMultiplier = 1; 13 | 14 | public override void ApplyDamageMultiplier(float multiplier) { _damageMultiplier = multiplier; } 15 | 16 | public override GameObject SpawnProjectile(Vector3 spawnPosition, int projectileIndex, int totalProjectiles, 17 | bool triggerObjectActivation = true) 18 | { 19 | /// we get the next object in the pool and make sure it's not null 20 | GameObject nextGameObject = ObjectPooler.GetPooledGameObject(); 21 | 22 | // mandatory checks 23 | if (nextGameObject==null) { return null; } 24 | if (nextGameObject.GetComponent()==null) 25 | { 26 | throw new Exception(gameObject.name+" is trying to spawn objects that don't have a PoolableObject component."); 27 | } 28 | // we position the object 29 | nextGameObject.transform.position = spawnPosition; 30 | // we set its direction 31 | 32 | Projectile projectile = nextGameObject.GetComponent(); 33 | if (projectile != null) 34 | { 35 | projectile.SetDamage((int)(DamageCaused * _damageMultiplier)); 36 | projectile.SetWeapon(this); 37 | if (Owner != null) 38 | { 39 | projectile.SetOwner(Owner.gameObject); 40 | } 41 | } 42 | // we activate the object 43 | nextGameObject.gameObject.SetActive(true); 44 | 45 | 46 | if (projectile != null) 47 | { 48 | if (RandomSpread) 49 | { 50 | _randomSpreadDirection.x = UnityEngine.Random.Range(-Spread.x, Spread.x); 51 | _randomSpreadDirection.y = UnityEngine.Random.Range(-Spread.y, Spread.y); 52 | _randomSpreadDirection.z = UnityEngine.Random.Range(-Spread.z, Spread.z); 53 | } 54 | else 55 | { 56 | if (totalProjectiles > 1) 57 | { 58 | _randomSpreadDirection.x = MMMaths.Remap(projectileIndex, 0, totalProjectiles - 1, -Spread.x, Spread.x); 59 | _randomSpreadDirection.y = MMMaths.Remap(projectileIndex, 0, totalProjectiles - 1, -Spread.y, Spread.y); 60 | _randomSpreadDirection.z = MMMaths.Remap(projectileIndex, 0, totalProjectiles - 1, -Spread.z, Spread.z); 61 | } 62 | else 63 | { 64 | _randomSpreadDirection = Vector3.zero; 65 | } 66 | } 67 | 68 | Quaternion spread = Quaternion.Euler(_randomSpreadDirection); 69 | projectile.SetDirection(spread * transform.right * (Flipped ? -1 : 1), transform.rotation, Owner.IsFacingRight); 70 | if (RotateWeaponOnSpread) 71 | { 72 | this.transform.rotation = this.transform.rotation * spread; 73 | } 74 | } 75 | 76 | if (triggerObjectActivation) 77 | { 78 | if (nextGameObject.GetComponent()!=null) 79 | { 80 | nextGameObject.GetComponent().TriggerOnSpawnComplete(); 81 | } 82 | } 83 | 84 | return (nextGameObject); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CharacterDamageMultiplier/PickableDamageMultiplier.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | 4 | namespace CharacterDamageMultiplier 5 | { 6 | public class PickableDamageMultiplier : PickableItem 7 | { 8 | public float DamageMultiplier = 2f; 9 | private DamageMultiplierCharacterHandleWeapon _handleWeapon; 10 | 11 | protected override void Pick() 12 | { 13 | _handleWeapon.DamageMultiplier = DamageMultiplier; 14 | } 15 | 16 | protected override bool CheckIfPickable() 17 | { 18 | _handleWeapon = _collidingObject.MMGetComponentNoAlloc()?.FindAbility(); 19 | return _handleWeapon != null; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CharacterMultiButtonActivation/CharacterMultiButtonActivation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MoreMountains.Tools; 3 | using MoreMountains.CorgiEngine; 4 | using UnityEngine; 5 | 6 | public class CharacterMultiButtonActivation : CharacterButtonActivation 7 | { 8 | private readonly List _buttonActivated = new(); 9 | private void OnTriggerEnter2D(Collider2D other) => _buttonActivated.AddRange(other.GetComponents()); 10 | private void OnTriggerExit2D(Collider2D other) 11 | { 12 | foreach (var buttonActivated in other.GetComponents()) 13 | _buttonActivated.Remove(buttonActivated); 14 | } 15 | 16 | protected override void HandleInput() 17 | { 18 | if (!AbilityAuthorized) return; 19 | for (var i=_buttonActivated.Count-1; i >= 0; i--) 20 | { 21 | InButtonActivatedZone = true; 22 | ButtonActivatedZone = _buttonActivated[i]; 23 | var buttonPressed = false; 24 | switch (ButtonActivatedZone.InputType) 25 | { 26 | case ButtonActivated.InputTypes.Default: 27 | buttonPressed = _inputManager.InteractButton.State.CurrentState == MMInput.ButtonStates.ButtonDown; 28 | break; 29 | #if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER 30 | case ButtonActivated.InputTypes.Button: 31 | case ButtonActivated.InputTypes.Key: 32 | buttonPressed = ButtonActivatedZone.InputActionPerformed; 33 | break; 34 | #else 35 | case ButtonActivated.InputTypes.Button: 36 | buttonPressed = Input.GetButtonDown(_character.PlayerID + "_" + ButtonActivatedZone.InputButton); 37 | break; 38 | case ButtonActivated.InputTypes.Key: 39 | buttonPressed = Input.GetKeyDown(ButtonActivatedZone.InputKey); 40 | break; 41 | #endif 42 | } 43 | 44 | if (buttonPressed) ButtonActivation(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CharacterPersistence_CustomScene/CharacterPersistence_CustomScene.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using UnityEngine; 3 | using UnityEngine.SceneManagement; 4 | 5 | namespace MoreMountains.CorgiEngine.Custom 6 | { 7 | [MMHiddenProperties("AbilityStartFeedbacks", "AbilityStopFeedbacks")] 8 | [AddComponentMenu("Corgi Engine/Character/Abilities/Character Persistence_CustomScene")] 9 | public class CharacterPersistence_CustomScene : CharacterPersistence 10 | { 11 | public string persistentSceneName; 12 | 13 | protected override void Initialization() 14 | { 15 | base.Initialization(); 16 | 17 | if (AbilityAuthorized) 18 | { 19 | SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetSceneByName(persistentSceneName)); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CharacterTimeToJumpApex/CharacterTimeToJumpApex.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | public class CharacterTimeToJumpApex : MonoBehaviour, MMEventListener 6 | { 7 | [SerializeField] private float TimeToJumpApex = .1f; 8 | 9 | private Character _character; 10 | private CharacterJump _characterJump; 11 | private CorgiController _controller; 12 | private float _reachApexTime = float.PositiveInfinity; 13 | private float _initialGravity; 14 | 15 | private void Awake() 16 | { 17 | _character = GetComponentInParent(); 18 | _characterJump = _character.FindAbility(); 19 | _controller = _character.GetComponent(); 20 | } 21 | 22 | private void Update() 23 | { 24 | if (Time.time < _reachApexTime) return; 25 | _controller.SetVerticalForce(0); 26 | _controller.Parameters.Gravity = _initialGravity; 27 | _reachApexTime = float.PositiveInfinity; 28 | } 29 | 30 | public void OnMMEvent(MMCharacterEvent characterEvent) 31 | { 32 | if (characterEvent.TargetCharacter != _character || 33 | characterEvent.EventType != MMCharacterEventTypes.Jump) return; 34 | _initialGravity = _controller.Parameters.Gravity; 35 | _controller.Parameters.Gravity = -2 * _characterJump.JumpHeight / (TimeToJumpApex * TimeToJumpApex); 36 | _reachApexTime = Time.time + TimeToJumpApex; 37 | } 38 | 39 | private void OnEnable() 40 | { 41 | this.MMEventStartListening(); 42 | } 43 | 44 | private void OnDisable() 45 | { 46 | this.MMEventStopListening(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CharacterWallclingOverride/CharacterWallclingOverride.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine 6 | { 7 | /// Wallclinging ability override to allow player wallcling on every wall or just overriden ones 8 | /// Classic: Player can wallcling on every wall unless it have an override set on False. Reverse: Player can wallcling only on walls with an override set as True 9 | /// Also allows player to preserve their slow factor or get the override one. 10 | /// Intended for Corgi v7.0+ 11 | /// v1.0 / muppo - 2021 12 | 13 | public class CharacterWallclingOverride : CharacterWallClinging 14 | { 15 | public override string HelpBoxText() { return "Classic: Player can wallcling on every wall unless it have an override set on False. " + 16 | "Reverse: Player can wallcling only on walls with an override set as True. Also allows player to preserve their slow factor or get the override one."; } 17 | 18 | public enum WallclingType { Reverse, Classic } 19 | public WallclingType wallClingType = WallclingType.Reverse; 20 | public bool preserveSlowFallFactor; 21 | 22 | protected override void EnterWallClinging() 23 | { 24 | // we check for an override 25 | if (_controller.CurrentWallCollider != null) 26 | { 27 | _wallClingingOverride = _controller.CurrentWallCollider.gameObject.MMGetComponentNoAlloc(); 28 | } 29 | else if (_raycast.collider != null) 30 | { 31 | _wallClingingOverride = _raycast.collider.gameObject.MMGetComponentNoAlloc(); 32 | } 33 | 34 | 35 | switch(wallClingType) 36 | { 37 | case WallclingType.Reverse: 38 | 39 | if (_wallClingingOverride != null) 40 | { 41 | CheckOverride(); 42 | 43 | if ((_movement.CurrentState != CharacterStates.MovementStates.WallClinging) && !_startFeedbackIsPlaying) 44 | { PlayAbilityStartFeedbacks(); } 45 | 46 | _movement.ChangeState(CharacterStates.MovementStates.WallClinging); 47 | } 48 | 49 | break; 50 | 51 | 52 | case WallclingType.Classic: 53 | if (_wallClingingOverride != null) 54 | { 55 | CheckOverride(); 56 | } 57 | else 58 | { 59 | _controller.SlowFall(WallClingingSlowFactor); 60 | } 61 | 62 | if ((_movement.CurrentState != CharacterStates.MovementStates.WallClinging) && !_startFeedbackIsPlaying) 63 | { PlayAbilityStartFeedbacks(); } 64 | 65 | _movement.ChangeState(CharacterStates.MovementStates.WallClinging); 66 | 67 | break; 68 | } 69 | } 70 | 71 | protected virtual void CheckOverride() 72 | { 73 | // if we can't wallcling to this wall, we do nothing and exit 74 | if (!_wallClingingOverride.CanWallClingToThis) 75 | { return; } 76 | 77 | if (!preserveSlowFallFactor) 78 | { 79 | _controller.SlowFall(_wallClingingOverride.WallClingingSlowFactor); 80 | } 81 | else 82 | { 83 | _controller.SlowFall(WallClingingSlowFactor); 84 | } 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /ControlFreak2Integration/CF2-Corgi-Players1-4.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/ControlFreak2Integration/CF2-Corgi-Players1-4.unitypackage -------------------------------------------------------------------------------- /ControlFreak2Integration/Corgi-v5-rig-with-Action-button.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/ControlFreak2Integration/Corgi-v5-rig-with-Action-button.unitypackage -------------------------------------------------------------------------------- /DialogueZoneExtended/AIWalkExtended.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine 6 | { 7 | 8 | public class AIWalkExtended : AIWalk { 9 | 10 | /// 11 | ///***This script free to use and no credit is required. 12 | ///***This is intended to be used with More Mountain's Corgi Engine 4.2+ 13 | ///***Extension Written by: Keith Henderson. Any questions can be sent to keith.donaldh@gmail.com 14 | ///***This script is to be used in conjunction with DialogueZoneExtended.cs 15 | /// All this script does is make the Reset() method public so it can be accessed from DialogueZoneExtended.cs 16 | /// 17 | 18 | public virtual void Reset() 19 | { 20 | // we get the CorgiController2D component 21 | _controller = GetComponent(); 22 | _character = GetComponent(); 23 | _characterHorizontalMovement = GetComponent(); 24 | _health = GetComponent (); 25 | // initialize the start position 26 | _startPosition = transform.position; 27 | // initialize the direction 28 | _direction = _character.IsFacingRight ? Vector2.right : Vector2.left; 29 | 30 | _initialDirection = _direction; 31 | _initialScale = transform.localScale; 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /FlyingCharacterDash/FlyingCharacterDash.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | 3 | public class FlyingCharacterDash : CharacterDash 4 | { 5 | private CharacterFly _fly; 6 | private bool _flying; 7 | protected override void Initialization() 8 | { 9 | base.Initialization(); 10 | _fly = _character.FindAbility(); 11 | } 12 | 13 | public override void InitiateDash() 14 | { 15 | _fly.enabled = false; 16 | _flying = _movement.CurrentState == CharacterStates.MovementStates.Flying; 17 | if (_flying) _fly.StopFlight(); 18 | base.InitiateDash(); 19 | } 20 | 21 | public override void StopDash() 22 | { 23 | base.StopDash(); 24 | if (_flying) _fly.StartFlight(); 25 | _fly.enabled = true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /FreezingDamageOnTouch/FreezingDamageOnTouch.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | 6 | namespace CorgiEngineExtensions 7 | { 8 | public class FreezingDamageOnTouch : DamageOnTouch 9 | { 10 | [Header("Freezing")] 11 | [Tooltip("Whether or not to freeze on touch")] 12 | public bool FreezeOnTouch = true; 13 | [Tooltip("How long to freeze on touch")] 14 | public float FreezeTime = 1; 15 | protected override void Colliding(Collider2D collider) 16 | { 17 | base.Colliding(collider); 18 | if (!isActiveAndEnabled 19 | || _ignoredGameObjects.Contains(collider.gameObject) 20 | || !MMLayers.LayerInLayerMask(collider.gameObject.layer,TargetLayerMask) 21 | || !FreezeOnTouch) return; 22 | var collidingCharacter = collider.gameObject.MMGetComponentNoAlloc(); 23 | if (collidingCharacter == null) return; 24 | collidingCharacter.StartCoroutine(FreezeCharacter(collidingCharacter)); 25 | } 26 | 27 | private IEnumerator FreezeCharacter(Character character) 28 | { 29 | character.Freeze(); 30 | yield return new WaitForSeconds(FreezeTime); 31 | character.UnFreeze(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FreezingDamageOnTouch/FreezingMeleeWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | namespace CorgiEngineExtensions 6 | { 7 | public class FreezingMeleeWeapon : MeleeWeapon 8 | { 9 | [MMInspectorGroup("Freezing", true, 72)] 10 | [Tooltip("The time (in seconds) that the hit character should be frozen")] 11 | public float FreezeTime = 1; 12 | protected override void CreateDamageArea() 13 | { 14 | _damageArea = new GameObject(); 15 | _damageArea.name = name+"DamageArea"; 16 | _damageArea.transform.position = transform.position; 17 | _damageArea.transform.rotation = transform.rotation; 18 | _damageArea.transform.SetParent(transform); 19 | 20 | switch (DamageAreaShape) 21 | { 22 | case MeleeDamageAreaShapes.Rectangle: 23 | _boxCollider2D = _damageArea.AddComponent(); 24 | _boxCollider2D.offset = AreaOffset; 25 | _boxCollider2D.size = AreaSize; 26 | _damageAreaCollider = _boxCollider2D; 27 | break; 28 | case MeleeDamageAreaShapes.Circle: 29 | _circleCollider2D = _damageArea.AddComponent(); 30 | _circleCollider2D.transform.position = transform.position + transform.rotation * AreaOffset; 31 | _circleCollider2D.radius = AreaSize.x/2; 32 | _damageAreaCollider = _circleCollider2D; 33 | break; 34 | } 35 | 36 | _damageAreaCollider.isTrigger = true; 37 | 38 | var rigidBody = _damageArea.AddComponent (); 39 | rigidBody.isKinematic = true; 40 | 41 | _damageOnTouch = _damageArea.AddComponent(); 42 | _damageOnTouch.TargetLayerMask = TargetLayerMask; 43 | _damageOnTouch.DamageCaused = DamageCaused; 44 | _damageOnTouch.DamageCausedKnockbackType = Knockback; 45 | _damageOnTouch.DamageCausedKnockbackForce = KnockbackForce; 46 | _damageOnTouch.InvincibilityDuration = InvincibilityDuration; 47 | var freezingDamageOnTouch = _damageOnTouch as FreezingDamageOnTouch; 48 | freezingDamageOnTouch.FreezeOnTouch = true; 49 | freezingDamageOnTouch.FreezeTime = FreezeTime; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /InControlIntegration/InControl_Integration_Readme.txt: -------------------------------------------------------------------------------- 1 | I was able to add InControl support to the Corgi Engine by way of the following: 2 | 3 | These steps should be OK for stock Input setups if you haven't deviated from Corgi's default inputs. 4 | 5 | - First, I had to add InControl's Assembly Reference to the MoreMountains.CorgiEngine Assembly Reference so that the InputManager could access InControl's functions. 6 | - Then I added MMInControl.cs -- this is a component I made based off of MMSingleton. 7 | - InControl users can then drag one instance of MMInControl onto a GameObject within their scene. I recommend sticking it on the InControl Manager for organizational purposes. 8 | - The MM Player Prefs Key value is the name of the PlayerPrefs registry key that it will attempt to save/restore from. 9 | I had to make a few edits to InputManager.cs. My edits are all encapuslated within #if USE_INCONTROL preprocs 10 | 11 | Check the initial post (with images) at https://forum.unity.com/threads/released-corgi-engine-complete-2d-2-5d-platformer-new-v6-6-ability-split-recoil-hitscan.286289/page-152#post-7187170 -------------------------------------------------------------------------------- /ItemDrop/ItemDrop.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ItemDrop : MonoBehaviour 6 | 7 | { 8 | public GameObject[] itemDrops; 9 | public int dropSucessRate = 15; 10 | public Vector3 SpawnDestination; 11 | 12 | // Start is called before the first frame update 13 | void Start() 14 | { 15 | int randomChance = Random.Range(0, 100); 16 | 17 | if(randomChance < dropSucessRate) 18 | { 19 | int randomPick = Random.Range(0, itemDrops.Length); 20 | Instantiate(itemDrops[randomPick], transform.position + SpawnDestination, transform.rotation); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /JumpToJetpack/JumpToJetpack.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine // you might want to use your own namespace here 6 | { 7 | /// 8 | /// Add this to seamlessly transition from jump to jetpack at the top of a jump 9 | /// 10 | [AddComponentMenu("Corgi Engine/Character/Abilities/JumpToJetpack")] 11 | [RequireComponent(typeof(CharacterJetpack))] 12 | public class JumpToJetpack : CharacterAbility 13 | { 14 | /// This method is only used to display a helpbox text 15 | /// at the beginning of the ability's inspector 16 | public override string HelpBoxText() { return "This component implements a transition from jump to jetpack using the jump button. Requires the CharacterJetpack component and uses the jump state. Sounds trigger at the apex of the jump [Start] and will continue [In Progress] until you hit the ground [Stop]."; } 17 | 18 | protected CharacterJetpack _characterJetpack; 19 | protected bool _hitApex = false; 20 | protected bool _abilityStart = false; 21 | 22 | /// 23 | /// Here you should initialize our parameters 24 | /// 25 | protected override void Initialization() 26 | { 27 | base.Initialization(); 28 | _characterJetpack = transform.GetComponent(); 29 | } 30 | 31 | /// 32 | /// Every frame, we check if we've hit the high point or are grounded 33 | /// 34 | public override void ProcessAbility() 35 | { 36 | base.ProcessAbility(); 37 | 38 | if (_controller.State.IsJumping && _controller.Speed.y < 0) 39 | { 40 | _hitApex = true; 41 | } 42 | 43 | if (_controller.State.IsGrounded && _hitApex) 44 | { 45 | _hitApex = false; 46 | PlayAbilityStopFeedbacks(); 47 | } 48 | } 49 | 50 | /// 51 | /// Called at the start of the ability's cycle, this is where you'll check for input 52 | /// 53 | protected override void HandleInput() 54 | { 55 | if (_hitApex) 56 | { 57 | if (_inputManager.JumpButton.State.CurrentState == MMInput.ButtonStates.ButtonPressed) 58 | { 59 | _characterJetpack.JetpackStart(); 60 | 61 | if (!_abilityStart) 62 | { 63 | _abilityStart = true; 64 | PlayAbilityStartFeedbacks(); 65 | } 66 | } 67 | if (_inputManager.JumpButton.State.CurrentState == MMInput.ButtonStates.ButtonUp) 68 | { 69 | _characterJetpack.JetpackStop(); 70 | _abilityStart = false; 71 | } 72 | } 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /KeyAmountOperatedZone/CorgiEngine4.2/KeyAmountOperatedZone.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.Tools; 5 | using UnityEngine.Events; 6 | 7 | namespace MoreMountains.CorgiEngine 8 | { 9 | /// This script extends Key Operated Zone, you can now set any amount of item to be used, no matter if stackable or not, only condition is they have to be the same ID 10 | /// intended to use with Corgi Engine 4.2+ 11 | /// V2.0 / Muppo (2018) 12 | 13 | public enum inventoryToLook { Main, Weapon, Hotbar } 14 | 15 | public class KeyAmountOperatedZone : KeyOperatedZone 16 | { 17 | [Information("Does this need more than one key? Set the ammount here.\n" + 18 | "Only keys of same ID will work with this.",MoreMountains.Tools.InformationAttribute.InformationType.Info,false)] 19 | 20 | /// How many keys are needed to open 21 | public int NumberOfKeys = 1; 22 | /// In which inventory should we look for 23 | public inventoryToLook _inventoryToLook = inventoryToLook.Main; 24 | 25 | 26 | public override void TriggerButtonAction() 27 | { 28 | if (!CheckNumberOfUses()) { return; } 29 | 30 | if (_collidingObject == null) { return; } 31 | 32 | if (RequiresKey) 33 | { 34 | CharacterInventory characterInventory = _collidingObject.gameObject.GetComponentNoAlloc (); 35 | if (characterInventory == null) 36 | { return; } 37 | 38 | _keyList.Clear (); 39 | 40 | /// Search in the selected inventory 41 | if(_inventoryToLook == inventoryToLook.Main) 42 | _keyList = characterInventory.MainInventory.InventoryContains(KeyID); 43 | 44 | if(_inventoryToLook == inventoryToLook.Weapon) 45 | _keyList = characterInventory.WeaponInventory.InventoryContains(KeyID); 46 | 47 | if(_inventoryToLook == inventoryToLook.Hotbar) 48 | _keyList = characterInventory.HotbarInventory.InventoryContains(KeyID); 49 | 50 | if (_keyList.Count == 0) 51 | { 52 | return; 53 | } 54 | else 55 | { 56 | base.TriggerButtonAction (); 57 | UseRequiredKeys(); 58 | } 59 | } 60 | TriggerKeyAction (); 61 | ZoneActivated (); 62 | } 63 | 64 | /// Uses the required keys. 65 | protected virtual void UseRequiredKeys() 66 | { 67 | CharacterInventory characterInventory = _collidingObject.gameObject.GetComponentNoAlloc (); 68 | 69 | if(_inventoryToLook == inventoryToLook.Main) 70 | { 71 | for (int k = 1; k < NumberOfKeys; k++) 72 | { characterInventory.MainInventory.UseItem(KeyID); } 73 | } 74 | 75 | if(_inventoryToLook == inventoryToLook.Weapon) 76 | { 77 | for (int k = 1; k < NumberOfKeys; k++) 78 | { characterInventory.WeaponInventory.UseItem(KeyID); } 79 | } 80 | 81 | if(_inventoryToLook == inventoryToLook.Hotbar) 82 | { 83 | for (int k = 1; k < NumberOfKeys; k++) 84 | { characterInventory.HotbarInventory.UseItem(KeyID); } 85 | } 86 | } 87 | 88 | /// Disables the key required 89 | public virtual void DisableKeyRequired() 90 | { 91 | if(RequiresKey) 92 | RequiresKey = false; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Renaud Forestié 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MoveAwayPlatform/MoveAwayPlatform.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine 6 | { 7 | /// Moving platform extension with Moving Away feature. 8 | /// Intended for Corgi Engine v6.2.1+ 9 | /// v 1.0 - Muppo (2020) 10 | 11 | public class MoveAwayPlatform : MovingPlatform 12 | { 13 | protected override void Start() 14 | { 15 | base.Start(); 16 | CycleOption = CycleOptions.StopAtBounds; 17 | StartMovingWhenPlayerIsColliding = true; 18 | } 19 | protected override void ExecuteUpdate () 20 | { 21 | if(PathElements == null || PathElements.Count < 1 || _endReached || !CanMove) 22 | { return; } 23 | 24 | // Check if platform should hide or unhide 25 | if(_collidingWithPlayer == true) 26 | { 27 | MoveAway(); 28 | } 29 | else if(_currentIndex <= 0) 30 | { 31 | RestorePosition(); 32 | } 33 | 34 | Move (); 35 | } 36 | 37 | public override void OnTriggerEnter2D(Collider2D collider) 38 | { 39 | base.OnTriggerEnter2D(collider); 40 | ResetEndReached(); 41 | } 42 | 43 | public virtual void MoveAway() 44 | { 45 | if (CycleOption == CycleOptions.StopAtBounds) 46 | CycleOption = CycleOptions.BackAndForth; 47 | } 48 | public virtual void RestorePosition() 49 | { 50 | if (CycleOption == CycleOptions.BackAndForth) 51 | CycleOption = CycleOptions.StopAtBounds; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /MovingPlatformExtended/MovingPlatformExtended.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine 6 | { 7 | public class MovingPlatformExtended : MovingPlatform 8 | { 9 | [Header("Repeat Loop")] 10 | [MMInformation("Select 'Only Once' then check this and the platform will respawn at the first point when last one is reached.", MoreMountains.Tools.MMInformationAttribute.InformationType.Info, false)] 11 | public bool Repeat = false; 12 | 13 | 14 | protected override void Update() 15 | { 16 | if (PathElements == null 17 | || PathElements.Count < 1 18 | || _endReached 19 | || !CanMove) 20 | { 21 | if (_endReached && Repeat) 22 | { 23 | Initialization(); 24 | } 25 | else 26 | { 27 | return; 28 | } 29 | } 30 | Move(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /MultiInventoryDetails/README.md: -------------------------------------------------------------------------------- 1 | # MultiInventoryDetails 2 | MoreMountains Inventory Engine Add-on to handle all active inventories on scene. 3 | You can use it as default InventoryDetails, switch to multi inventory to handle all active inventories on scene and disable only few of them. Feel free to modify it to your needs. 4 | 5 | ### Add-on setup guide: 6 | 1. Clone or download ItemDetails.cs to your project 7 | 2. Create Inventory Details object on your canvas the same way as from [that page](http://inventory-engine-docs.moremountains.com/item-details.html) except don't use InventoryDetails.cs and use ItemDetails.cs instead 8 | 9 | ### I will not add special features to this only fix bugs if you find something. Happy using :) 10 | ### Discord nick: mlankoff#4236 11 | -------------------------------------------------------------------------------- /MultipleCharactersPointsOfEntry/MultipleCharactersPointsOfEntryLevelManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MoreMountains.CorgiEngine; 4 | using MoreMountains.Tools; 5 | using UnityEngine; 6 | using UnityEngine.SceneManagement; 7 | 8 | namespace Manager { 9 | public class MultipleCharactersPointsOfEntryLevelManager : MoreMountains.CorgiEngine.LevelManager { 10 | 11 | /// 12 | /// Spawns multiple playable characters into the scene 13 | /// 14 | protected override void SpawnMultipleCharacters () { 15 | PointsOfEntryStorage point = GameManager.Instance.GetPointsOfEntry (SceneManager.GetActiveScene ().name); 16 | int checkpointCounter = 0; 17 | int characterCounter = 1; 18 | bool spawned = false; 19 | 20 | foreach (Character player in Players) { 21 | 22 | if (AutoAttributePlayerIDs) { 23 | player.SetPlayerID ("Player" + characterCounter); 24 | } 25 | 26 | player.name += " - " + player.PlayerID; 27 | 28 | // entry point spawn 29 | if (point != null) { 30 | Players[characterCounter - 1].RespawnAt (PointsOfEntry[point.PointOfEntryIndex].Position, Character.FacingDirections.Right); 31 | spawned = true; 32 | characterCounter++; 33 | } 34 | 35 | if (!spawned && Checkpoints.Count > checkpointCounter + 1) { 36 | if (Checkpoints[checkpointCounter] != null) { 37 | Checkpoints[checkpointCounter].SpawnPlayer (player); 38 | characterCounter++; 39 | spawned = true; 40 | checkpointCounter++; 41 | } 42 | } 43 | 44 | if (!spawned) { 45 | Checkpoints[checkpointCounter].SpawnPlayer (player); 46 | characterCounter++; 47 | } 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /MultipleWeapons/CharacterMultipleHandleWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | namespace CorgiEngineExtensions 6 | { 7 | [AddComponentMenu("Corgi Engine/Character/Abilities/Character Multiple Handle Weapon")] 8 | public class CharacterMultipleHandleWeapon : CharacterHandleWeapon 9 | { 10 | [Tooltip("this number determines which shoot and reload input this ability takes. make sure it is unique across all CharacterMultipleHandleWeapon abilities on the current character")] 11 | public int MultipleHandleWeaponID = 1; 12 | public override int HandleWeaponID => MultipleHandleWeaponID; 13 | protected MultipleWeaponsInputManager _multipleWeaponsInputManager; 14 | protected int _inputIndex; 15 | 16 | protected override void Initialization() 17 | { 18 | base.Initialization(); 19 | _multipleWeaponsInputManager = _inputManager as MultipleWeaponsInputManager; 20 | _inputIndex = MultipleHandleWeaponID - 1; 21 | } 22 | 23 | public override void SetInputManager(InputManager inputManager) 24 | { 25 | base.SetInputManager(inputManager); 26 | _multipleWeaponsInputManager = _inputManager as MultipleWeaponsInputManager; 27 | } 28 | 29 | protected override void HandleInput() 30 | { 31 | if (_multipleWeaponsInputManager.ShootButtons[_inputIndex].State.CurrentState == MMInput.ButtonStates.ButtonDown || _multipleWeaponsInputManager.ShootAxes[_inputIndex] == MMInput.ButtonStates.ButtonDown) 32 | { 33 | ShootStart(); 34 | } 35 | 36 | if (!(CurrentWeapon is null)) 37 | { 38 | if (ContinuousPress && CurrentWeapon.TriggerMode == Weapon.TriggerModes.Auto && _multipleWeaponsInputManager.ShootButtons[_inputIndex].State.CurrentState == MMInput.ButtonStates.ButtonPressed) 39 | { 40 | ShootStart(); 41 | } 42 | if (ContinuousPress && CurrentWeapon.TriggerMode == Weapon.TriggerModes.Auto && _multipleWeaponsInputManager.ShootAxes[_inputIndex] == MMInput.ButtonStates.ButtonPressed) 43 | { 44 | ShootStart(); 45 | } 46 | } 47 | 48 | if (_multipleWeaponsInputManager.ReloadButtons[_inputIndex].State.CurrentState == MMInput.ButtonStates.ButtonDown) 49 | { 50 | Reload(); 51 | } 52 | 53 | if (_multipleWeaponsInputManager.ShootButtons[_inputIndex].State.CurrentState == MMInput.ButtonStates.ButtonUp || _multipleWeaponsInputManager.ShootAxes[_inputIndex] == MMInput.ButtonStates.ButtonUp) 54 | { 55 | ShootStop(); 56 | } 57 | 58 | if (CurrentWeapon is null) return; 59 | if (CurrentWeapon.WeaponState.CurrentState == Weapon.WeaponStates.WeaponDelayBetweenUses && _multipleWeaponsInputManager.ShootAxes[_inputIndex] == MMInput.ButtonStates.Off && _multipleWeaponsInputManager.ShootButtons[_inputIndex].State.CurrentState == MMInput.ButtonStates.Off) 60 | { 61 | CurrentWeapon.WeaponInputStop(); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /MultipleWeapons/MultipleWeaponsInputManager.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | namespace CorgiEngineExtensions 6 | { 7 | [AddComponentMenu("Corgi Engine/Managers/Multiple Weapons Input Manager")] 8 | public class MultipleWeaponsInputManager : InputManager 9 | { 10 | // how many weapons a single character can handle at once 11 | public int MaximumNumberOfWeapons = 3; 12 | public MMInput.IMButton[] ShootButtons; 13 | public MMInput.IMButton[] ReloadButtons; 14 | public MMInput.ButtonStates[] ShootAxes { get; protected set; } 15 | protected string[] _axesShoot; 16 | 17 | protected override void Awake() 18 | { 19 | ShootButtons = new MMInput.IMButton[MaximumNumberOfWeapons]; 20 | ReloadButtons = new MMInput.IMButton[MaximumNumberOfWeapons]; 21 | ShootAxes = new MMInput.ButtonStates[MaximumNumberOfWeapons]; 22 | _axesShoot = new string[MaximumNumberOfWeapons]; 23 | base.Awake(); 24 | } 25 | 26 | protected override void InitializeButtons() 27 | { 28 | base.InitializeButtons(); 29 | ShootButtons[0] = ShootButton; 30 | ReloadButtons[0] = ReloadButton; 31 | ShootButtons[1] = SecondaryShootButton; 32 | ButtonList.Add(ReloadButtons[1] = new MMInput.IMButton (PlayerID, "Reload2")); 33 | for (var i = 2; i < MaximumNumberOfWeapons; i++) 34 | { 35 | ButtonList.Add(ShootButtons[i] = new MMInput.IMButton(PlayerID, "Shoot" + (i + 1))); 36 | ButtonList.Add(ReloadButtons[i] = new MMInput.IMButton (PlayerID, "Reload" + (i + 1))); 37 | } 38 | } 39 | 40 | protected override void InitializeAxis() 41 | { 42 | base.InitializeAxis(); 43 | _axesShoot[0] = _axisShoot; 44 | _axesShoot[1] = _axisShootSecondary; 45 | for (var i = 2; i < MaximumNumberOfWeapons; i++) 46 | _axesShoot[i] = PlayerID + "_ShootAxis" + (i + 1); 47 | } 48 | 49 | protected override void SetShootAxis() 50 | { 51 | base.SetShootAxis(); 52 | if (IsMobile || !InputDetectionActive) return; 53 | ShootAxes[0] = ShootAxis; 54 | ShootAxes[1] = SecondaryShootAxis; 55 | for (var i = 2; i < MaximumNumberOfWeapons; i++) 56 | ShootAxes[i] = MMInput.ProcessAxisAsButton(_axesShoot[i], Threshold.y, ShootAxes[i]); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /NoClip/NoClip.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using MoreMountains.Tools; 4 | 5 | namespace MoreMountains.CorgiEngine 6 | { 7 | // Add this to your player prefab and it will have the classic NoClip ability. 8 | public class NoClip : MonoBehaviour 9 | { 10 | [MMInformation("Toogle NoClip with F4",MoreMountains.Tools.MMInformationAttribute.InformationType.Info,false)] 11 | [MMReadOnly] public bool noClip; 12 | 13 | 14 | public virtual void Update() 15 | { 16 | if (Input.GetKeyDown(KeyCode.F4)) 17 | { 18 | noClip = !noClip; 19 | } 20 | 21 | if(Input.GetKeyDown(KeyCode.F4) && !noClip) 22 | { 23 | Debug.Log("NOCLIP OFF"); 24 | GetComponent().CollisionsOn(); 25 | GetComponent().GravityActive(true); 26 | GetComponent().Invulnerable = false; 27 | } 28 | else if (Input.GetKeyDown(KeyCode.F4) && noClip) 29 | { 30 | Debug.Log("NOCLIP ON"); 31 | GetComponent().CollisionsOff(); 32 | GetComponent().GravityActive(false); 33 | GetComponent().Invulnerable = true; 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ObjectActivatedZones/ObjectActivated.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | using MoreMountains.Tools; 6 | 7 | namespace MoreMountains.CorgiEngine 8 | { 9 | 10 | /// 11 | ///***This script free to use and no credit is required. 12 | ///***This is intended to be used with More Mountain's Corgi Engine 4.2+ 13 | ///***Written by: Keith Henderson. Any questions can be sent to keith.donaldh@gmail.com 14 | ///***This script is to be used in conjunction with ObjectActivatedZone.cs 15 | /// Add this script to a GameObject and you can call specific methods when all Object Activated Zones are activated. (Ex: Moving Platforms). 16 | /// 17 | 18 | public class ObjectActivated : MonoBehaviour { 19 | 20 | [Header("Number of Zones Required to Activate")] 21 | /// This is the number ObjectActivatedZones that are required to activate this object. 22 | [Tooltip("Declare how many ObjectActivatedZones are required to activate this object.")] 23 | public int RequiredZones = 1; 24 | 25 | [Header("Method to Activate")] 26 | /// The method that is called when all conditions are met 27 | public UnityEvent EnableAction; 28 | 29 | [Header("Method to Deactivate")] 30 | /// The method that is called when all conditions are not met 31 | public UnityEvent DisableAction; 32 | 33 | //We use this to keep track of how many zones have been activated 34 | [HideInInspector] 35 | public int Counter; 36 | 37 | public void ConditionCheck() 38 | { 39 | //We check to see if the counter matches the number of required zones. If not, we disable and exit 40 | if(Counter == RequiredZones) 41 | Enable(); 42 | 43 | else 44 | Disable(); 45 | return; 46 | } 47 | 48 | /// Here we execute the method when all condtions are met 49 | protected virtual void Enable() 50 | { 51 | if (EnableAction != null) 52 | { 53 | EnableAction.Invoke (); 54 | } 55 | } 56 | 57 | /// Here we execute the method when all conditions are not met 58 | protected virtual void Disable() 59 | { 60 | if (DisableAction != null) 61 | { 62 | DisableAction.Invoke (); 63 | } 64 | } 65 | 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ParallaxFactorCalculator/Editor/ParallaxFacCalcEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(ParallaxFacCalc))] 7 | 8 | public class ParallaxFacCalcEditor : Editor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | EditorGUILayout.HelpBox("It is recommended to only use factor calculation if your sprite number is more than 4. If you have less than that, then it's better to set them up manually", MessageType.Warning); 13 | 14 | DrawDefaultInspector(); 15 | 16 | ParallaxFacCalc factorCalculation = (ParallaxFacCalc)target; 17 | 18 | if (GUILayout.Button("Perform Calculations")) 19 | { 20 | factorCalculation.PerformFactorCalculations(); 21 | } 22 | 23 | EditorGUILayout.Space(10); 24 | EditorGUILayout.HelpBox("Hint: Background elements should not be moving in the opposite direction. Foreground elements should be instead. If you set this button for background sorting group, it will falsify moving in the opposite direction for you.", MessageType.Info); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /ParallaxFactorCalculator/ParallaxFacCalc.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ParallaxFacCalc : MonoBehaviour 6 | { 7 | //This script is placed at the father game object which contains the sorting group. Which would either be the background or foreground gameobject. 8 | 9 | //It aims to set up parallax factors automatically based on the distance of each image in the hierarchy using the calculation method present in ParallaxO.cs. 10 | 11 | ParallaxO[] ParallaxElements; 12 | [Header("Experimental:")] 13 | public bool Foreground; 14 | public void PerformFactorCalculations() 15 | 16 | { 17 | ParallaxElements = GetComponentsInChildren(); 18 | if (ParallaxElements.Length == 0) 19 | { 20 | Debug.LogError("No parallax elements under this gameobject! Are you sure you placed the calculator in the correct place?"); 21 | return; 22 | } 23 | for (int i = 0; i < ParallaxElements.Length; i++) 24 | { 25 | if (Foreground) 26 | { 27 | ParallaxElements[i].CalculateAndSetParallaxFactors(ParallaxElements.Length, true); 28 | } 29 | else 30 | { 31 | ParallaxElements[i].CalculateAndSetParallaxFactors(ParallaxElements.Length, false); 32 | } 33 | } 34 | Debug.Log("Calculations of factors have been made and set to each parallax object!"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ParallaxFactorCalculator/ParallaxO.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.CorgiEngine; 5 | 6 | public class ParallaxO : ParallaxElement 7 | { 8 | //Functions for the parallax element calculations. 9 | int Index; 10 | float MultFactor; 11 | 12 | public void CalculateAndSetParallaxFactors(int NumberOfSiblings, bool ForeGround) //A calculation method which will take into account different factors and give this object its appropriate parallax factors. It is called by a factor calculation script which fills its number of siblings. 13 | { 14 | //We first calculate the probable speed factor based on distance. Foreground calculation is still experimental and not always correct. 15 | float SpeedFactor; 16 | if (ForeGround) 17 | { 18 | Index = transform.GetSiblingIndex(); 19 | MultFactor = 1f / NumberOfSiblings; 20 | SpeedFactor = Mathf.Abs(MultFactor * Index); 21 | // Then we set the speed factor for the horizontal speed as is, but reduce it by the multfactor for vertical speed. 22 | HorizontalSpeed = SpeedFactor; 23 | VerticalSpeed = SpeedFactor - MultFactor; 24 | 25 | //For the closest gameobject in foreground terms, the vertical factor needs to be zero as it might break and become a large number on calculation 26 | 27 | if (Index == 0) // 28 | { 29 | VerticalSpeed = 0f; 30 | } 31 | } 32 | else 33 | { 34 | MoveInOppositeDirection = false; //Since we are making calculations for background elements, they need to be moving with the camera. 35 | Index = transform.GetSiblingIndex(); 36 | MultFactor = 1f / NumberOfSiblings; 37 | SpeedFactor = Mathf.Abs(MultFactor * Index - 1); 38 | // Then we set the speed factor for the horizontal speed as is, but reduce it by the multfactor for vertical speed. 39 | HorizontalSpeed = Mathf.Abs(SpeedFactor); 40 | VerticalSpeed = Mathf.Abs(SpeedFactor - MultFactor); 41 | //For the closest gameobject, the vertical factor needs to be zero as it might break and become a large number on calculation. 42 | if (Index == NumberOfSiblings - 1) 43 | { 44 | VerticalSpeed = 0f; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /PlayerInvisibility/EnemiesTargetLayerMask.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 2203ced1bc5c1404d814a9c346208cac, type: 3} 13 | m_Name: EnemiesTargetLayerMask 14 | m_EditorClassIdentifier: 15 | Value: 16 | serializedVersion: 2 17 | m_Bits: 512 18 | -------------------------------------------------------------------------------- /PlayerInvisibility/EnemiesTargetLayerMask.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12c12ba7a00742b4fbd30effba01df87 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PlayerInvisibility/PlayerInvisibility.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83f8490371e2b344a9b3a2948399f766 3 | timeCreated: 1459863179 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PlayerInvisibility/PlayerInvisibility.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/PlayerInvisibility/PlayerInvisibility.unitypackage -------------------------------------------------------------------------------- /PlayerInvisibility/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ed077cb38e92c348afbe1c7bc5e710c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PlayerInvisibility/Scripts/LayerMaskVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace PlayerInvisibility.Scripts 5 | { 6 | public class LayerMaskVariable : ScriptableObject 7 | { 8 | public LayerMask Value; 9 | public event Action OnChange; 10 | 11 | public void Set(LayerMaskVariable value) 12 | { 13 | Value = value.Value; 14 | OnChange?.Invoke(); 15 | } 16 | 17 | private void OnValidate() 18 | { 19 | OnChange?.Invoke(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /PlayerInvisibility/Scripts/LayerMaskVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2203ced1bc5c1404d814a9c346208cac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /PlayerInvisibility/Scripts/TargetLayerMaskUpdater.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | namespace PlayerInvisibility.Scripts 6 | { 7 | public class TargetLayerMaskUpdater : MonoBehaviour 8 | { 9 | public LayerMaskVariable TargetLayerMask; 10 | public string DetectTargetState = "Patrol"; 11 | private AIDecisionDetectTargetLine[] _detectTargetLines; 12 | private AIDecisionDetectTargetRadius[] _detectTargetRadii; 13 | private DamageOnTouch[] _damageOnTouches; 14 | private AIBrain[] _brains; 15 | 16 | private void Awake() 17 | { 18 | _detectTargetLines = GetComponentsInChildren(true); 19 | _detectTargetRadii = GetComponentsInChildren(true); 20 | _damageOnTouches = GetComponentsInChildren(true); 21 | _brains = GetComponentsInChildren(true); 22 | } 23 | 24 | private void OnEnable() 25 | { 26 | UpdateTargetLayerMask(); 27 | TargetLayerMask.OnChange += UpdateTargetLayerMask; 28 | } 29 | 30 | private void OnDisable() 31 | { 32 | TargetLayerMask.OnChange -= UpdateTargetLayerMask; 33 | } 34 | 35 | private void UpdateTargetLayerMask() 36 | { 37 | foreach (var detectTargetLine in _detectTargetLines) 38 | detectTargetLine.TargetLayer = TargetLayerMask.Value; 39 | foreach (var detectTargetRadius in _detectTargetRadii) 40 | detectTargetRadius.TargetLayer = TargetLayerMask.Value; 41 | foreach (var damageOnTouch in _damageOnTouches) 42 | damageOnTouch.TargetLayerMask = TargetLayerMask.Value; 43 | if (string.IsNullOrWhiteSpace(DetectTargetState)) return; 44 | foreach (var brain in _brains) 45 | brain.TransitionToState(DetectTargetState); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /PlayerInvisibility/Scripts/TargetLayerMaskUpdater.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48536dc21987b9745bf67d614e702a45 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - TargetLayerMask: {fileID: 11400000, guid: 12c12ba7a00742b4fbd30effba01df87, type: 2} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /PlayerInvisibility/StaticData.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f616ab4267058f3498e6874637eb1934 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PlayerInvisibility/StaticData/NothingLayerMask.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 2203ced1bc5c1404d814a9c346208cac, type: 3} 13 | m_Name: NothingLayerMask 14 | m_EditorClassIdentifier: 15 | Value: 16 | serializedVersion: 2 17 | m_Bits: 0 18 | -------------------------------------------------------------------------------- /PlayerInvisibility/StaticData/NothingLayerMask.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 030793387e5cee645912e1435c606fc3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PlayerInvisibility/StaticData/PlayerLayerMask.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 2203ced1bc5c1404d814a9c346208cac, type: 3} 13 | m_Name: PlayerLayerMask 14 | m_EditorClassIdentifier: 15 | Value: 16 | serializedVersion: 2 17 | m_Bits: 512 18 | -------------------------------------------------------------------------------- /PlayerInvisibility/StaticData/PlayerLayerMask.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e29a93a40a24c6449837ecc8b11b1aa 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PogoWeapon/PogoWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | 4 | public class PogoWeapon : Weapon 5 | { 6 | [MMInspectorGroup("Weapons", true, 36)] 7 | public Weapon Pogo; 8 | public Weapon Weapon; 9 | private Weapon _weapon; 10 | private Weapon _last; 11 | protected override void LateUpdate(){} 12 | private void Awake() 13 | { 14 | Pogo.enabled = false; 15 | Weapon.enabled = false; 16 | _weapon = Weapon; 17 | } 18 | public override void SetOwner(Character newOwner, CharacterHandleWeapon handleWeapon) 19 | { 20 | base.SetOwner(newOwner, handleWeapon); 21 | Pogo.SetOwner(newOwner, handleWeapon); 22 | Weapon.SetOwner(newOwner, handleWeapon); 23 | _controller = Owner.GetComponent(); 24 | } 25 | public override void Initialization() 26 | { 27 | base.Initialization(); 28 | Pogo.Initialization(); 29 | Weapon.Initialization(); 30 | } 31 | public override void TurnWeaponOn() 32 | { 33 | if (_last && _last.enabled) return; 34 | _last = !_controller.State.IsGrounded && Owner.LinkedInputManager.PrimaryMovement.y < -Owner.LinkedInputManager.Threshold.y ? Pogo : _weapon; 35 | _last.WeaponState.OnStateChange += DisableOnStop; 36 | _last.enabled = true; 37 | _last.TurnWeaponOn(); 38 | } 39 | private void DisableOnStop() 40 | { 41 | if (_last.WeaponState.CurrentState != WeaponStates.WeaponStop) return; 42 | _last.WeaponState.OnStateChange -= DisableOnStop; 43 | _last.enabled = false; 44 | } 45 | protected override void Update() 46 | { 47 | base.Update(); 48 | if (CharacterHandleWeapon.CurrentWeapon == this) return; 49 | // we store which weapon ComboWeapon changed to and change CurrentWeapon back to this 50 | _weapon = CharacterHandleWeapon.CurrentWeapon; 51 | CharacterHandleWeapon.CurrentWeapon = this; 52 | Weapon.transform.SetParent(transform); 53 | _weapon.enabled = false; 54 | } 55 | 56 | public override void FlipWeapon() 57 | { 58 | base.FlipWeapon(); 59 | Weapon.GetComponent()?.FlipUnusedWeapons(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /PogoWeapon/PogoWeapon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13bd0a92b8ef721479ee9974350ec22d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /PogoWeapon/PogoWeapon.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/PogoWeapon/PogoWeapon.unitypackage -------------------------------------------------------------------------------- /PogoWeapon/PogoWeaponDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 352ef01ba65a5cb468fd83f1492853c4 3 | timeCreated: 1459863179 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PogoWeapon/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7f5aa2b0433d5d418f8169323d2d1c5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PogoWeapon/Prefabs/Pogo.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5bef674fd88bee64a85a721fc5ebed54 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /PogoWeapon/Prefabs/PogoWeapon.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d4dde4ae23cfcd4ab554aad271b6090 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProgressionSystem/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 884043528d28e3643be8a8e234e1237c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Editor/LevelValueCurveVariableEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using ProgressionSystem.Scripts.Variables; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace ProgressionSystem.Editor 7 | { 8 | [CanEditMultipleObjects] 9 | [CustomEditor(typeof(LevelValueCurveVariable))] 10 | public class LevelValueCurveVariableEditor : UnityEditor.Editor 11 | { 12 | private Vector2 _scroll; 13 | public override void OnInspectorGUI() 14 | { 15 | base.OnInspectorGUI(); 16 | EditorGUILayout.Space(); 17 | _scroll = EditorGUILayout.BeginScrollView(_scroll, GUILayout.MaxHeight(600)); 18 | var levelValueCurve = (LevelValueCurveVariable)target; 19 | for (var i = levelValueCurve.MinLevel; i <= levelValueCurve.MaxLevel; i++) 20 | { 21 | EditorGUILayout.BeginHorizontal("box"); 22 | EditorGUILayout.LabelField("Level " + i); 23 | EditorGUILayout.LabelField((levelValueCurve.DisplayIntValues ? levelValueCurve.EvaluateInt(i).ToString() : levelValueCurve.Evaluate(i).ToString("F", CultureInfo.InvariantCulture)) + " " + levelValueCurve.ValueRepresents); 24 | EditorGUILayout.EndHorizontal(); 25 | } 26 | 27 | EditorGUILayout.EndScrollView(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProgressionSystem/Editor/LevelValueCurveVariableEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5429b09388c37b42baae4449617c6a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3c79013c2465484da354295a66966cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Prefabs/DamageMultipliedCorgiMachineGun.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &6338414724250245190 4 | PrefabInstance: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: 10 | - target: {fileID: 1000010407495960, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 11 | propertyPath: m_Name 12 | value: DamageMultipliedCorgiMachineGun 13 | objectReference: {fileID: 0} 14 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 15 | propertyPath: m_RootOrder 16 | value: 0 17 | objectReference: {fileID: 0} 18 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 19 | propertyPath: m_LocalPosition.x 20 | value: 0 21 | objectReference: {fileID: 0} 22 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 23 | propertyPath: m_LocalPosition.y 24 | value: 0 25 | objectReference: {fileID: 0} 26 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 27 | propertyPath: m_LocalPosition.z 28 | value: 0 29 | objectReference: {fileID: 0} 30 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 31 | propertyPath: m_LocalRotation.w 32 | value: 1 33 | objectReference: {fileID: 0} 34 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 35 | propertyPath: m_LocalRotation.x 36 | value: 0 37 | objectReference: {fileID: 0} 38 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 39 | propertyPath: m_LocalRotation.y 40 | value: 0 41 | objectReference: {fileID: 0} 42 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 43 | propertyPath: m_LocalRotation.z 44 | value: 0 45 | objectReference: {fileID: 0} 46 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 47 | propertyPath: m_LocalEulerAnglesHint.x 48 | value: 0 49 | objectReference: {fileID: 0} 50 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 51 | propertyPath: m_LocalEulerAnglesHint.y 52 | value: 0 53 | objectReference: {fileID: 0} 54 | - target: {fileID: 4000013472678096, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 55 | propertyPath: m_LocalEulerAnglesHint.z 56 | value: 0 57 | objectReference: {fileID: 0} 58 | - target: {fileID: 114000010078180980, guid: c061427043f064e3e8034c5f6499c9e6, 59 | type: 3} 60 | propertyPath: RandomSpread 61 | value: 0 62 | objectReference: {fileID: 0} 63 | - target: {fileID: 114368442086977796, guid: c061427043f064e3e8034c5f6499c9e6, 64 | type: 3} 65 | propertyPath: GameObjectToPool 66 | value: 67 | objectReference: {fileID: 100002, guid: dd3d29ea84feeb841821f770d2a07e46, type: 3} 68 | m_RemovedComponents: [] 69 | m_SourcePrefab: {fileID: 100100000, guid: c061427043f064e3e8034c5f6499c9e6, type: 3} 70 | -------------------------------------------------------------------------------- /ProgressionSystem/Prefabs/DamageMultipliedCorgiMachineGun.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4aed8d1c01450ff459e72f1cad5e3fa8 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProgressionSystem/Prefabs/DamageMultipliedCorgiMachineGunProjectile.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd3d29ea84feeb841821f770d2a07e46 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /ProgressionSystem/Prefabs/ProgressionBar.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac7eb83c3d3510647b5b4a2601083805 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProgressionSystem/ProgressionSystem.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/ProgressionSystem/ProgressionSystem.unitypackage -------------------------------------------------------------------------------- /ProgressionSystem/ProgressionSystemDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b932b7f01dc6e244ae4eb2bf3f4ed79 3 | timeCreated: 1459863179 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c510d0ddc41ebf04da301d6378c0b5d5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c068eb012cbda74b96eebc41e3ef667 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerExperience.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 645d7531690a2674494e0445fde5bb17, type: 3} 13 | m_Name: PlayerExperience 14 | m_EditorClassIdentifier: 15 | CurrentValue: 98274 16 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerExperience.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e48e13182b65a65459fddd2613a1e53f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerLevel.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 645d7531690a2674494e0445fde5bb17, type: 3} 13 | m_Name: PlayerLevel 14 | m_EditorClassIdentifier: 15 | CurrentValue: 1 16 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerLevel.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 778ed0cdce2dfff44b996c3dbe18da82 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerLevelExperienceCurve.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: af6ec8805fedad54a94ef260388e6c3b, type: 3} 13 | m_Name: PlayerLevelExperienceCurve 14 | m_EditorClassIdentifier: 15 | LevelValueCurve: 16 | serializedVersion: 2 17 | m_Curve: 18 | - serializedVersion: 3 19 | time: 1 20 | value: 0 21 | inSlope: 0 22 | outSlope: 0 23 | tangentMode: 0 24 | weightedMode: 0 25 | inWeight: 0 26 | outWeight: 0 27 | - serializedVersion: 3 28 | time: 100 29 | value: 100000 30 | inSlope: 2843.2944 31 | outSlope: 2843.2944 32 | tangentMode: 0 33 | weightedMode: 0 34 | inWeight: 0.1013824 35 | outWeight: 0 36 | m_PreInfinity: 2 37 | m_PostInfinity: 2 38 | m_RotationOrder: 4 39 | DisplayIntValues: 1 40 | ValueRepresents: XP 41 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerLevelExperienceCurve.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e64ec317e33e7a14ab3c0e9dab90ba4f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerProgression.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 724828227216e0d43b739c866d0fc23a, type: 3} 13 | m_Name: PlayerProgression 14 | m_EditorClassIdentifier: 15 | Experience: {fileID: 11400000, guid: e48e13182b65a65459fddd2613a1e53f, type: 2} 16 | Level: {fileID: 11400000, guid: 778ed0cdce2dfff44b996c3dbe18da82, type: 2} 17 | LevelExperienceCurve: {fileID: 11400000, guid: e64ec317e33e7a14ab3c0e9dab90ba4f, 18 | type: 2} 19 | ResetExperienceOnEnable: 1 20 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Progression/PlayerProgression.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8be6c8e213d1824cb0ce50c356fa4d5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4225fdb57c9983f4ab71615f72596a1c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a913acc3e327c8a45990aa3258d86c61 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerDamageMultiplier.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b295801db0a33f741aa7b9e19171c024, type: 3} 13 | m_Name: PlayerDamageMultiplier 14 | m_EditorClassIdentifier: 15 | CurrentValue: 0 16 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerDamageMultiplier.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c503757d95f17374791b370c970555c6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerDamageMultiplierUpdater.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 7a76dbc77164e6c43a002ca8f6efe921, type: 3} 13 | m_Name: PlayerDamageMultiplierUpdater 14 | m_EditorClassIdentifier: 15 | Level: {fileID: 11400000, guid: 778ed0cdce2dfff44b996c3dbe18da82, type: 2} 16 | LevelValueCurve: {fileID: 11400000, guid: 627d53dc3cd070340a2ca30ea3646ad4, type: 2} 17 | Variable: {fileID: 11400000, guid: c503757d95f17374791b370c970555c6, type: 2} 18 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerDamageMultiplierUpdater.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13b6909c08e37b746ad765d64a677cd0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerLevelDamageMultiplierCurve.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: af6ec8805fedad54a94ef260388e6c3b, type: 3} 13 | m_Name: PlayerLevelDamageMultiplierCurve 14 | m_EditorClassIdentifier: 15 | LevelValueCurve: 16 | serializedVersion: 2 17 | m_Curve: 18 | - serializedVersion: 3 19 | time: 1 20 | value: 1 21 | inSlope: 0.3101771 22 | outSlope: 0.3101771 23 | tangentMode: 0 24 | weightedMode: 0 25 | inWeight: 0 26 | outWeight: 0.19072197 27 | - serializedVersion: 3 28 | time: 10.1737385 29 | value: 2.8554409 30 | inSlope: 0.027628835 31 | outSlope: 0.027628835 32 | tangentMode: 0 33 | weightedMode: 0 34 | inWeight: 0.33333334 35 | outWeight: 0.09064882 36 | - serializedVersion: 3 37 | time: 100 38 | value: 4 39 | inSlope: 0.0045614336 40 | outSlope: 0.0045614336 41 | tangentMode: 0 42 | weightedMode: 0 43 | inWeight: 0.15668203 44 | outWeight: 0 45 | m_PreInfinity: 2 46 | m_PostInfinity: 2 47 | m_RotationOrder: 4 48 | DisplayIntValues: 0 49 | ValueRepresents: Damage Multiplier 50 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/DamageMultiplier/PlayerLevelDamageMultiplierCurve.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 627d53dc3cd070340a2ca30ea3646ad4 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e4ee7a108153114e9f50ac280e6a380 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerLevelMaxHealthCurve.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: af6ec8805fedad54a94ef260388e6c3b, type: 3} 13 | m_Name: PlayerLevelMaxHealthCurve 14 | m_EditorClassIdentifier: 15 | LevelValueCurve: 16 | serializedVersion: 2 17 | m_Curve: 18 | - serializedVersion: 3 19 | time: 1 20 | value: 100 21 | inSlope: 26.36506 22 | outSlope: 26.36506 23 | tangentMode: 0 24 | weightedMode: 0 25 | inWeight: 0 26 | outWeight: 0.027649771 27 | - serializedVersion: 3 28 | time: 100 29 | value: 1000 30 | inSlope: 0.91228974 31 | outSlope: 0.91228974 32 | tangentMode: 0 33 | weightedMode: 0 34 | inWeight: 0.23502304 35 | outWeight: 0 36 | m_PreInfinity: 2 37 | m_PostInfinity: 2 38 | m_RotationOrder: 4 39 | DisplayIntValues: 1 40 | ValueRepresents: Maximum Health 41 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerLevelMaxHealthCurve.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9a5101185eb48a418af3009dc6e54ac 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerMaxHealth.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 645d7531690a2674494e0445fde5bb17, type: 3} 13 | m_Name: PlayerMaxHealth 14 | m_EditorClassIdentifier: 15 | CurrentValue: 0 16 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerMaxHealth.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f53cd3a2806b4f34f9924ac291ea75d6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerMaxHealthUpdater.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 04350326e1c96c04991225ded7ca6768, type: 3} 13 | m_Name: PlayerMaxHealthUpdater 14 | m_EditorClassIdentifier: 15 | Level: {fileID: 11400000, guid: 778ed0cdce2dfff44b996c3dbe18da82, type: 2} 16 | LevelValueCurve: {fileID: 11400000, guid: e9a5101185eb48a418af3009dc6e54ac, type: 2} 17 | Variable: {fileID: 11400000, guid: f53cd3a2806b4f34f9924ac291ea75d6, type: 2} 18 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/MaxHealth/PlayerMaxHealthUpdater.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab3549bd9ad273545a9bf3740714a6cb 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cbaa353fa70e524ead49e16bafe9664 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerLevelWalkSpeedCurve.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: af6ec8805fedad54a94ef260388e6c3b, type: 3} 13 | m_Name: PlayerLevelWalkSpeedCurve 14 | m_EditorClassIdentifier: 15 | LevelValueCurve: 16 | serializedVersion: 2 17 | m_Curve: 18 | - serializedVersion: 3 19 | time: 1 20 | value: 4 21 | inSlope: 0.63780195 22 | outSlope: 0.63780195 23 | tangentMode: 0 24 | weightedMode: 0 25 | inWeight: 0 26 | outWeight: 0.036866363 27 | - serializedVersion: 3 28 | time: 100 29 | value: 25 30 | inSlope: 0.020483334 31 | outSlope: 0.020483334 32 | tangentMode: 0 33 | weightedMode: 0 34 | inWeight: 0.122119784 35 | outWeight: 0 36 | m_PreInfinity: 2 37 | m_PostInfinity: 2 38 | m_RotationOrder: 4 39 | DisplayIntValues: 0 40 | ValueRepresents: Walk Speed 41 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerLevelWalkSpeedCurve.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f3078b84ba30ed498aaead525b63e05 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerWalkSpeed.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b295801db0a33f741aa7b9e19171c024, type: 3} 13 | m_Name: PlayerWalkSpeed 14 | m_EditorClassIdentifier: 15 | CurrentValue: 0 16 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerWalkSpeed.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe44e3e463a8ab54c9a1268a4a2e2740 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerWalkSpeedUpdater.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 7a76dbc77164e6c43a002ca8f6efe921, type: 3} 13 | m_Name: PlayerWalkSpeedUpdater 14 | m_EditorClassIdentifier: 15 | Level: {fileID: 11400000, guid: 778ed0cdce2dfff44b996c3dbe18da82, type: 2} 16 | LevelValueCurve: {fileID: 11400000, guid: 9f3078b84ba30ed498aaead525b63e05, type: 2} 17 | Variable: {fileID: 11400000, guid: fe44e3e463a8ab54c9a1268a4a2e2740, type: 2} 18 | -------------------------------------------------------------------------------- /ProgressionSystem/ScriptableObjects/Stats/WalkSpeed/PlayerWalkSpeedUpdater.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a0813f78f1b3c240b593a472a86768b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 553a562beb05d4b49a82ae78e755ddf9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0217f1192ab716b458c4d77db892dbd9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Core/Progression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ProgressionSystem.Scripts.Variables; 3 | using UnityEngine; 4 | 5 | namespace ProgressionSystem.Scripts.Core 6 | { 7 | [CreateAssetMenu(fileName = "Progression", menuName = "Progression/Progression")] 8 | public class Progression : ScriptableObject 9 | { 10 | [SerializeField] private IntVariable Experience; 11 | [SerializeField] private IntVariable Level; 12 | [SerializeField] private LevelValueCurveVariable LevelExperienceCurve; 13 | [SerializeField] private bool ResetExperienceOnEnable = true; 14 | public Action Progressed; 15 | public int LevelExperience => Experience.Value - LevelExperienceCurve.EvaluateInt(Level.Value); 16 | public int NextLevelExperience => LevelExperienceCurve.EvaluateInt(Level.Value + 1) - LevelExperienceCurve.EvaluateInt(Level.Value); 17 | 18 | private void UpdateLevel() 19 | { 20 | while (Experience.Value >= LevelExperienceCurve.EvaluateInt(Level.Value + 1)) Level.Value++; 21 | Progressed?.Invoke(); 22 | } 23 | 24 | private void OnEnable() 25 | { 26 | if (ResetExperienceOnEnable) Experience.Value = LevelExperienceCurve.EvaluateInt(LevelExperienceCurve.MinLevel); 27 | Level.Value = 0; 28 | UpdateLevel(); 29 | 30 | Experience.Changed += UpdateLevel; 31 | LevelExperienceCurve.Changed += UpdateLevel; 32 | } 33 | 34 | private void OnDisable() 35 | { 36 | Experience.Changed -= UpdateLevel; 37 | LevelExperienceCurve.Changed -= UpdateLevel; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Core/Progression.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 724828227216e0d43b739c866d0fc23a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Events.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ead72d0357e5e444b99450ed542fe74f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Events/OnDeath.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | 5 | namespace ProgressionSystem.Scripts.Events 6 | { 7 | public class OnDeath : MonoBehaviour 8 | { 9 | [SerializeField] private UnityEvent OnDeathEvent; 10 | private Health _health; 11 | private void Awake() { _health = GetComponent(); } 12 | private void OnEnable() { _health.OnDeath += OnDeathEvent.Invoke; } 13 | private void OnDisable() { _health.OnDeath -= OnDeathEvent.Invoke; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Events/OnDeath.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 322904ffb5f964542a855bb63617fa43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Events/OnIntVariableChange.cs: -------------------------------------------------------------------------------- 1 | using ProgressionSystem.Scripts.Variables; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | 5 | namespace ProgressionSystem.Scripts.Events 6 | { 7 | public class OnIntVariableChange : MonoBehaviour 8 | { 9 | [SerializeField] private IntVariable IntVariable; 10 | [SerializeField] private UnityEvent OnIntVariableChangeEvent; 11 | private void OnEnable() { IntVariable.Changed += OnIntVariableChangeEvent.Invoke; } 12 | private void OnDisable() { IntVariable.Changed -= OnIntVariableChangeEvent.Invoke; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Events/OnIntVariableChange.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54dbf5143ce9573489b1f29b51930528 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c7ddf14c51d8b246ac82e2469a6c9dc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Extensions/MultipliedDamageOnTouch.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Feedbacks; 4 | using ProgressionSystem.Scripts.Variables; 5 | using UnityEngine; 6 | 7 | namespace ProgressionSystem.Scripts.Extensions 8 | { 9 | public class MultipliedDamageOnTouch : DamageOnTouch 10 | { 11 | [SerializeField] private FloatVariable DamageMultiplier; 12 | 13 | protected override void OnCollideWithDamageable(Health health) 14 | { 15 | if (health.CanTakeDamageThisFrame()) 16 | { 17 | // if what we're colliding with is a CorgiController, we apply a knockback force 18 | _colliderCorgiController = health.gameObject.MMGetComponentNoAlloc(); 19 | 20 | float randomDamage = UnityEngine.Random.Range(MinDamageCaused, Mathf.Max(MaxDamageCaused, MinDamageCaused)); 21 | 22 | ApplyDamageCausedKnockback(randomDamage, TypedDamages); 23 | 24 | OnHitDamageable?.Invoke(); 25 | 26 | HitDamageableFeedback?.PlayFeedbacks(this.transform.position); 27 | 28 | if ((FreezeFramesOnHitDuration > 0) && (Time.timeScale > 0)) 29 | { 30 | MMFreezeFrameEvent.Trigger(Mathf.Abs(FreezeFramesOnHitDuration)); 31 | } 32 | 33 | // we apply the damage to the thing we've collided with 34 | if (RepeatDamageOverTime) 35 | { 36 | _colliderHealth.DamageOverTime(DamageMultiplier.Value*randomDamage, gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection, TypedDamages, AmountOfRepeats, DurationBetweenRepeats, DamageOverTimeInterruptible, RepeatedDamageType); 37 | } 38 | else 39 | { 40 | _colliderHealth.Damage(DamageMultiplier.Value*randomDamage, gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection, TypedDamages); 41 | } 42 | 43 | if (_colliderHealth.CurrentHealth <= 0) 44 | { 45 | OnKill?.Invoke(); 46 | } 47 | } 48 | 49 | SelfDamage(DamageTakenEveryTime + DamageTakenDamageable); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Extensions/MultipliedDamageOnTouch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d19364fb38e11b7499d624aa4fbb75d7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Links.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4ad6d12a688f0d4abec36145ed1e21b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Links/MaxHealthLink.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using ProgressionSystem.Scripts.Variables; 3 | using UnityEngine; 4 | 5 | namespace ProgressionSystem.Scripts.Links 6 | { 7 | public class MaxHealthLink : MonoBehaviour 8 | { 9 | [SerializeField] private IntVariable MaxHealth; 10 | [SerializeField] private bool ResetHealthToMaxHealthOnChange; 11 | private Health _health; 12 | 13 | private void Awake() { _health = GetComponent(); } 14 | 15 | private void UpdateMaximumHealth() 16 | { 17 | var maxHealthDifference = MaxHealth.Value - _health.MaximumHealth; 18 | _health.MaximumHealth = MaxHealth.Value; 19 | if (ResetHealthToMaxHealthOnChange) _health.ResetHealthToMaxHealth(); 20 | else _health.GetHealth(maxHealthDifference, gameObject); 21 | } 22 | 23 | private void OnEnable() 24 | { 25 | UpdateMaximumHealth(); 26 | MaxHealth.Changed += UpdateMaximumHealth; 27 | } 28 | 29 | private void OnDisable() 30 | { 31 | MaxHealth.Changed -= UpdateMaximumHealth; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Links/MaxHealthLink.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1712c15ca549ed540ac96f92dfa997d2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Links/WalkSpeedLink.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using ProgressionSystem.Scripts.Variables; 3 | using UnityEngine; 4 | 5 | namespace ProgressionSystem.Scripts.Links 6 | { 7 | public class WalkSpeedLink : MonoBehaviour 8 | { 9 | [SerializeField] private FloatVariable WalkSpeed; 10 | private CharacterHorizontalMovement _movement; 11 | 12 | private void Awake() { _movement = GetComponent(); } 13 | 14 | private void UpdateWalkSpeed() 15 | { 16 | _movement.WalkSpeed = WalkSpeed.Value; 17 | _movement.ResetHorizontalSpeed(); 18 | } 19 | private void OnEnable() 20 | { 21 | UpdateWalkSpeed(); 22 | WalkSpeed.Changed += UpdateWalkSpeed; 23 | } 24 | 25 | private void OnDisable() 26 | { 27 | WalkSpeed.Changed -= UpdateWalkSpeed; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Links/WalkSpeedLink.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eebefe3ab1b810748983349b06254191 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 884bf979d2a6d2c44a4018bcf83e7850 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/ExperienceProgressBar.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using ProgressionSystem.Scripts.Core; 3 | using UnityEngine; 4 | 5 | namespace ProgressionSystem.Scripts.UI 6 | { 7 | public class ExperienceProgressBar : MonoBehaviour 8 | { 9 | [SerializeField] private Progression Progression; 10 | private MMProgressBar _bar; 11 | 12 | private void Awake() { _bar = GetComponent(); } 13 | private void UpdateBar() { _bar.UpdateBar(Progression.LevelExperience, 0, Progression.NextLevelExperience); } 14 | private void OnEnable() 15 | { 16 | _bar.SetBar(Progression.LevelExperience, 0, Progression.NextLevelExperience); 17 | Progression.Progressed += UpdateBar; 18 | } 19 | private void OnDisable() { Progression.Progressed -= UpdateBar; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/ExperienceProgressBar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceff5288a9b825e468be18d5a0dcb16b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/FloatVariableText.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using ProgressionSystem.Scripts.Variables; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace ProgressionSystem.Scripts.UI 7 | { 8 | public class FloatVariableText : MonoBehaviour 9 | { 10 | [SerializeField] private FloatVariable FloatVariable; 11 | [SerializeField] private float Offset; 12 | [SerializeField] private string Prefix = "Walk Speed: "; 13 | private Text _text; 14 | 15 | private void Awake() { _text = GetComponent(); } 16 | private void UpdateText() { _text.text = Prefix + (FloatVariable.Value+Offset).ToString("F", CultureInfo.InvariantCulture);} 17 | 18 | private void OnEnable() 19 | { 20 | UpdateText(); 21 | FloatVariable.Changed += UpdateText; 22 | } 23 | private void OnDisable() { FloatVariable.Changed -= UpdateText; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/FloatVariableText.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bf461c7c628f4a4197a00254305db16 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/IntVariableText.cs: -------------------------------------------------------------------------------- 1 | using ProgressionSystem.Scripts.Variables; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace ProgressionSystem.Scripts.UI 6 | { 7 | public class IntVariableText : MonoBehaviour 8 | { 9 | [SerializeField] private IntVariable IntVariable; 10 | [SerializeField] private int Offset; 11 | [SerializeField] private string Prefix = "LVL "; 12 | private Text _text; 13 | 14 | private void Awake() { _text = GetComponent(); } 15 | private void UpdateText() { _text.text = Prefix + (IntVariable.Value+Offset);} 16 | 17 | private void OnEnable() 18 | { 19 | UpdateText(); 20 | IntVariable.Changed += UpdateText; 21 | } 22 | private void OnDisable() { IntVariable.Changed -= UpdateText; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/UI/IntVariableText.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 506026d41caa10e47a5b319d8df06102 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab91462413682f64bb91d51fc3897ab9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedFloatVariableUpdater.cs: -------------------------------------------------------------------------------- 1 | using ProgressionSystem.Scripts.Variables; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Updaters 5 | { 6 | [CreateAssetMenu(fileName = "LevelFloatVariableUpdater", menuName = "Progression/Updaters/LevelFloatVariableUpdater")] 7 | public class LevelBasedFloatVariableUpdater : LevelBasedVariableUpdater 8 | { 9 | [SerializeField] protected FloatVariable Variable; 10 | protected override void UpdateVariable() { Variable.Value = LevelValueCurve.Evaluate(Level.Value); } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedFloatVariableUpdater.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a76dbc77164e6c43a002ca8f6efe921 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedIntVariableUpdater.cs: -------------------------------------------------------------------------------- 1 | using ProgressionSystem.Scripts.Variables; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Updaters 5 | { 6 | [CreateAssetMenu(fileName = "LevelIntVariableUpdater", menuName = "Progression/Updaters/LevelIntVariableUpdater")] 7 | public class LevelBasedIntVariableUpdater : LevelBasedVariableUpdater 8 | { 9 | [SerializeField] protected IntVariable Variable; 10 | protected override void UpdateVariable() { Variable.Value = LevelValueCurve.EvaluateInt(Level.Value); } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedIntVariableUpdater.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04350326e1c96c04991225ded7ca6768 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedVariableUpdater.cs: -------------------------------------------------------------------------------- 1 | using ProgressionSystem.Scripts.Variables; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Updaters 5 | { 6 | public abstract class LevelBasedVariableUpdater : ScriptableObject 7 | { 8 | [SerializeField] protected IntVariable Level; 9 | [SerializeField] protected LevelValueCurveVariable LevelValueCurve; 10 | 11 | protected abstract void UpdateVariable(); 12 | 13 | private void OnEnable() 14 | { 15 | UpdateVariable(); 16 | Level.Changed += UpdateVariable; 17 | } 18 | private void OnDisable() { Level.Changed -= UpdateVariable; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Updaters/LevelBasedVariableUpdater.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ca489d6840809b4c8680345afb82e92 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff3ab8a6051ffbb40a86e881a633fb8e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/FloatVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Variables 5 | { 6 | [CreateAssetMenu(fileName = "FloatVariable", menuName = "Progression/Variables/FloatVariable")] 7 | public class FloatVariable : NumericVariable 8 | { 9 | public void Add(float value) { Value += value; } 10 | protected override bool NotEquals(float value1, float value2) { return Math.Abs(value1 - value2) > 0.0001; } 11 | } 12 | } -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/FloatVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b295801db0a33f741aa7b9e19171c024 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/IntVariable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace ProgressionSystem.Scripts.Variables 4 | { 5 | [CreateAssetMenu(fileName = "IntVariable", menuName = "Progression/Variables/IntVariable")] 6 | public class IntVariable : NumericVariable 7 | { 8 | public void Add(int value) { Value += value; } 9 | protected override bool NotEquals(int value1, int value2) { return value1 != value2; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/IntVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 645d7531690a2674494e0445fde5bb17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/LevelValueCurveVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Variables 5 | { 6 | [CreateAssetMenu(fileName = "LevelValueCurve", menuName = "Progression/Variables/LevelValueCurve")] 7 | public class LevelValueCurveVariable : ScriptableObject 8 | { 9 | [SerializeField] private AnimationCurve LevelValueCurve = AnimationCurve.EaseInOut(1, 0, 100, 100000); 10 | 11 | [Header("Display")] 12 | public bool DisplayIntValues; 13 | public string ValueRepresents = "XP"; 14 | public Action Changed; 15 | 16 | public int MinLevel => (int)LevelValueCurve.keys[0].time; 17 | public int MaxLevel => (int)LevelValueCurve.keys[LevelValueCurve.length - 1].time; 18 | public int EvaluateInt(int level) { return (int)LevelValueCurve.Evaluate(level); } 19 | public float Evaluate(int level) { return LevelValueCurve.Evaluate(level); } 20 | private void OnValidate() { Changed?.Invoke(); } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/LevelValueCurveVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af6ec8805fedad54a94ef260388e6c3b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/NumericVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace ProgressionSystem.Scripts.Variables 5 | { 6 | public abstract class NumericVariable : ScriptableObject 7 | { 8 | [SerializeField] private T CurrentValue; 9 | public Action Changed; 10 | public T Value 11 | { 12 | get => CurrentValue; 13 | set 14 | { 15 | var oldValue = CurrentValue; 16 | CurrentValue = value; 17 | if (NotEquals(oldValue, CurrentValue)) OnChange(); 18 | } 19 | } 20 | 21 | private void OnValidate() { OnChange(); } 22 | private void OnChange() { Changed?.Invoke(); } 23 | protected abstract bool NotEquals(T value1, T value2); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ProgressionSystem/Scripts/Variables/NumericVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5ca33a6cad1e0b4782136507e7d59d1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectileHoming/ProjectileHoming.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(Collider2D), typeof(Projectile))] 6 | public class ProjectileHoming : MonoBehaviour{ 7 | [SerializeField] private ContactFilter2D TargetDetectionFilter; 8 | [SerializeField] private float TargetDetectionRadius = 100; 9 | [SerializeField] private AnimationCurve Speed = AnimationCurve.EaseInOut(0, 0, 5, 1000); 10 | [SerializeField, HideInInspector] private Projectile Projectile; 11 | [SerializeField, HideInInspector] private Collider2D Collider; 12 | [SerializeField, HideInInspector] private MMPoolableObject Poolable; 13 | private Collider2D _target; 14 | private float _time; 15 | private readonly Collider2D[] _targets = new Collider2D[10]; 16 | private bool _flipped; 17 | 18 | private void OnSpawnComplete(){ 19 | _flipped = Projectile.Direction.x < 0 && (TryGetComponent(out _) || Projectile.FlipValue != Vector3.one); 20 | if (!_flipped && Projectile.Direction.x < 0) Projectile.SetDirection(Projectile.Direction, Quaternion.AngleAxis(Mathf.Atan2(Projectile.Direction.y, Projectile.Direction.x) * Mathf.Rad2Deg, Vector3.forward)); 21 | _time = 0; 22 | _target = null; 23 | var count = Physics2D.OverlapCircle(Collider.bounds.center, TargetDetectionRadius, TargetDetectionFilter, _targets); 24 | if (count == 0) return; 25 | var smallestAngle = 180f; 26 | _target = _targets[0]; 27 | for (var i = 0; i < count; i++) 28 | { 29 | var angleToTarget = Vector3.Angle(Projectile.Direction, _targets[i].bounds.center - transform.position); 30 | if (angleToTarget > smallestAngle) continue; 31 | smallestAngle = angleToTarget; 32 | _target = _targets[i]; 33 | } 34 | } 35 | private void Update(){ 36 | if (!_target) return; 37 | var direction = Vector3.RotateTowards(Projectile.Direction, _target.bounds.center - Collider.bounds.center, 38 | Speed.Evaluate(_time) * Time.deltaTime, 0); 39 | var angle = _flipped ? Mathf.Atan2(-direction.y, -direction.x) : Mathf.Atan2(direction.y, direction.x); 40 | var rotation = Quaternion.AngleAxis(angle * Mathf.Rad2Deg, Vector3.forward); 41 | Projectile.SetDirection(direction, rotation); 42 | _time += Time.deltaTime; 43 | } 44 | 45 | private void OnValidate(){ 46 | Projectile ??= GetComponent(); 47 | Collider ??= GetComponent(); 48 | Poolable ??= GetComponent(); 49 | } 50 | private void OnEnable() => Poolable.OnSpawnComplete += OnSpawnComplete; 51 | private void OnDisable() => Poolable.OnSpawnComplete -= OnSpawnComplete; 52 | private void OnDrawGizmosSelected(){ 53 | Gizmos.color = Color.yellow; 54 | Gizmos.DrawWireSphere(transform.position, TargetDetectionRadius); 55 | } 56 | private void Reset(){ 57 | TargetDetectionFilter.useTriggers = true; 58 | TargetDetectionFilter.SetLayerMask(LayerManager.EnemiesLayerMask); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /RespawnWhenPlayerEntersRoom/RespawnWhenPlayerEntersRoom.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | using UnityEngine.Events; 6 | 7 | public class RespawnWhenPlayerEntersRoom : MonoBehaviour 8 | { 9 | private UnityEvent _onPlayerEntersRoom; 10 | private Health _health; 11 | private AIBrain _brain; 12 | 13 | private void Awake() 14 | { 15 | _health = GetComponent(); 16 | _brain = GetComponentInChildren(true); 17 | _onPlayerEntersRoom = FindObjectsOfType().Single(room => room.GetComponent().bounds.Contains(transform.position.MMSetZ(room.transform.position.z))).OnPlayerEntersRoom; 18 | _onPlayerEntersRoom.AddListener(Respawn); 19 | } 20 | 21 | private void OnDestroy() 22 | { 23 | _onPlayerEntersRoom.RemoveListener(Respawn); 24 | } 25 | 26 | private void Respawn() 27 | { 28 | gameObject.SetActive(true); 29 | _health?.Revive(); 30 | _brain?.ResetBrain(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Retroid/Retroid.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/Retroid/Retroid.unitypackage -------------------------------------------------------------------------------- /RotationalActivation/InputSystemManagerWithRotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using MoreMountains.CorgiEngine; 5 | using MoreMountains.Tools; 6 | using UnityEngine; 7 | using UnityEngine.InputSystem; 8 | 9 | public class InputSystemManagerWithRotation : InputSystemManagerEventsBased 10 | { 11 | public Vector2 CurrentDirection { get; protected set; } 12 | 13 | private Vector2 _previousDirection; 14 | public void OnRotationalMovement(InputValue value) 15 | { 16 | CurrentDirection = value.Get(); 17 | 18 | } 19 | 20 | protected override void BindButton(InputValue inputValue, MMInput.IMButton imButton) 21 | { 22 | if (imButton != null) 23 | { 24 | base.BindButton(inputValue, imButton); 25 | } 26 | } 27 | 28 | protected override void Update() 29 | { 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /SimpleConditionalActions/SimpleConditionalActions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | using MoreMountains.Feedbacks; 5 | using MoreMountains.Tools; 6 | 7 | public class SimpleConditionalActions : MonoBehaviour 8 | { 9 | // Add this component to an emtpy gameobject and set a reference tag, when all the tagged objects are disabled, 10 | // feedbacks and actions will be played before this script disable itself. 11 | // v1.0 / Muppo (2020) 12 | 13 | // If tag is empty, this script will disable itself. 14 | public string referenceTag; 15 | public bool ConditionFulfilled = false; 16 | public float FinishDelay = 0f; 17 | public MMFeedbacks FinishFeedback; 18 | public UnityEvent FinishAction; 19 | 20 | /// TEST ON INSPECTOR 21 | [MMInspectorButton("PlayEffects")] 22 | public bool TestButton; 23 | 24 | private bool Done; 25 | 26 | // 27 | public virtual void Start() 28 | { 29 | if (string.IsNullOrEmpty(referenceTag)) 30 | { 31 | DisableThis(); 32 | } 33 | Done = false; 34 | } 35 | 36 | // 37 | public virtual void LateUpdate() 38 | { 39 | if (Done) 40 | { 41 | return; 42 | } 43 | 44 | if ((GameObject.FindGameObjectsWithTag(referenceTag).Length == 0) || ConditionFulfilled) 45 | { 46 | FinishSequence(); 47 | Done = true; 48 | } 49 | } 50 | 51 | // 52 | public virtual void FinishSequence() 53 | { 54 | if (FinishDelay > 0) { 55 | StartCoroutine(PlayDelay()); 56 | } else { 57 | PlayEffects(); 58 | } 59 | } 60 | 61 | // 62 | public virtual IEnumerator PlayDelay() 63 | { 64 | yield return new WaitForSeconds (FinishDelay); 65 | PlayEffects(); 66 | } 67 | 68 | // 69 | public virtual void PlayEffects() 70 | { 71 | if (FinishFeedback != null) 72 | FinishFeedback?.PlayFeedbacks(); 73 | 74 | if (FinishAction != null) 75 | FinishAction.Invoke(); 76 | 77 | DisableThis(); 78 | } 79 | 80 | // 81 | public virtual void DisableThis() 82 | { 83 | this.enabled = false; 84 | } 85 | } -------------------------------------------------------------------------------- /SplitScreen/SplitScreen.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.CorgiEngine; 5 | using MoreMountains.Tools; 6 | 7 | namespace CameraUtils { 8 | /// 9 | /// Extends corgi's camera controller just to set the target 10 | /// 11 | public class SplitScreen : MoreMountains.CorgiEngine.CameraController 12 | { 13 | /// 14 | /// Set new target for camera 15 | /// 16 | /// 17 | public override void SetTarget(Transform target) 18 | { 19 | Target = target; 20 | 21 | if (Target.GetComponent() == null) { 22 | Debug.LogWarning("CameraController : The Player character doesn't have a CorgiController associated to it, the Camera won't work."); 23 | return; 24 | } 25 | 26 | TargetController = target.GetComponent(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /StackablePushable/Prefabs/StackablePushableBox.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83efb4d5a048c424eb302468fc1c1552 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /StackablePushable/Prefabs/Tileset.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a23bbdccda63c4a419a803927662fbca 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /StackablePushable/Scenes/StackablePushable.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 769907d83785f3a40b923c213822d94f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /StackablePushable/Scripts/StackableCorgiController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e94ea5576d9556a478047d12e2f4bea6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StackablePushable/Scripts/StackablePushable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c741ffcc032fd8f47a74087fe4186521 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StackablePushable/Sprites/Block.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13312, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: Block 14 | m_EditorClassIdentifier: 15 | m_Sprite: {fileID: 21300000, guid: e55f832a99d95f14ba9ae58266762ba1, type: 3} 16 | m_Color: {r: 1, g: 1, b: 1, a: 1} 17 | m_Transform: 18 | e00: 1 19 | e01: 0 20 | e02: 0 21 | e03: 0 22 | e10: 0 23 | e11: 1 24 | e12: 0 25 | e13: 0 26 | e20: 0 27 | e21: 0 28 | e22: 1 29 | e23: 0 30 | e30: 0 31 | e31: 0 32 | e32: 0 33 | e33: 1 34 | m_InstancedGameObject: {fileID: 0} 35 | m_Flags: 1 36 | m_ColliderType: 1 37 | -------------------------------------------------------------------------------- /StackablePushable/Sprites/Block.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce9d844ca461cb9419912edd26dae5a3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StackablePushable/Sprites/Block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/StackablePushable/Sprites/Block.png -------------------------------------------------------------------------------- /StaminaExtension/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6dda4249c1f83e4ab9696a154ba2b92 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StaminaExtension/Scripts/PickableStamina.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using UnityEngine; 3 | 4 | namespace StaminaExtension 5 | { 6 | /// 7 | /// Gives stamina to the player who collects it 8 | /// 9 | [AddComponentMenu("Corgi Engine/Items/Pickable Stamina")] 10 | public class PickableStamina : PickableItem 11 | { 12 | /// the amount of stamina to give the player when collected 13 | [Tooltip("the amount of stamina to give the player when collected")] 14 | public float StaminaToGive = 100; 15 | 16 | /// 17 | /// What happens when the object gets picked 18 | /// 19 | protected override void Pick(GameObject picker) 20 | { 21 | _pickingCollider.GetComponent().CurrentStamina += StaminaToGive; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /StaminaExtension/Scripts/PickableStamina.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42c477d62b02f514287f4fb7a63a11c2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StaminaExtension/Scripts/Stamina.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63dc84d332c71c344ac14634f30a5681 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StaminaExtension/Scripts/StaminaBarUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | 6 | namespace StaminaExtension 7 | { 8 | public class StaminaBarUpdater : MonoBehaviour, MMEventListener, MMEventListener 9 | { 10 | [SerializeField] 11 | [Tooltip("if this is false, the player character will be set as target automatically")] 12 | private bool UseCustomTarget; 13 | [MMCondition(nameof(UseCustomTarget), true)] 14 | [SerializeField] 15 | private GameObject Target; 16 | 17 | private MMProgressBar _bar; 18 | 19 | private void Awake() 20 | { 21 | _bar = GetComponent(); 22 | } 23 | 24 | public void OnMMEvent(StaminaUpdateEvent staminaUpdateEvent) 25 | { 26 | if (staminaUpdateEvent.Target != Target) return; 27 | _bar.UpdateBar(staminaUpdateEvent.Stamina, 0, staminaUpdateEvent.MaxStamina); 28 | } 29 | 30 | public void OnMMEvent(CorgiEngineEvent corgiEngineEvent) 31 | { 32 | if (corgiEngineEvent.EventType == CorgiEngineEventTypes.SpawnCharacterStarts && !UseCustomTarget) Target = LevelManager.Instance.Players[0].gameObject; 33 | } 34 | 35 | private void OnEnable() 36 | { 37 | this.MMEventStartListening(); 38 | this.MMEventStartListening(); 39 | } 40 | 41 | private void OnDisable() 42 | { 43 | this.MMEventStopListening(); 44 | this.MMEventStopListening(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /StaminaExtension/Scripts/StaminaBarUpdater.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09049f3d45c4b1649b9872062048ab19 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StaminaExtension/StaminaDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c07ced8112bf78a4581ae2be9def42cf 3 | timeCreated: 1459863179 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StaminaExtension/StaminaExtension.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/StaminaExtension/StaminaExtension.unitypackage -------------------------------------------------------------------------------- /StaminaExtension/StaminaRectangle.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 121c0169ac2f2b544b321e77658f2006 3 | timeCreated: 1469092248 4 | licenseType: Store 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6f3484150766c848adf4f5b396076ee 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/MinimalStatusEffectDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a106acdcf41c2f4cacc322377da2a95 3 | timeCreated: 1459863179 4 | licenseType: Store 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 399d33f9a796b2b47b063011ae6c19a7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/Items.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2640f24d7702e043a8f72be911e630a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/Items/HealingPotion.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b28106b466948424d961a75dca44f99d, type: 3} 13 | m_Name: HealingPotion 14 | m_EditorClassIdentifier: 15 | ItemID: HealingPotion 16 | TargetInventoryName: SuitMainInventory 17 | ForceSlotIndex: 0 18 | TargetIndex: 0 19 | Usable: 1 20 | Consumable: 1 21 | ConsumeQuantity: 1 22 | Equippable: 0 23 | MoveWhenEquipped: 1 24 | Droppable: 1 25 | CanMoveObject: 1 26 | CanSwapObject: 1 27 | Quantity: 1 28 | ItemName: Healing Potion 29 | ShortDescription: When consumed, heals you over time 30 | Description: Always good to have one of these on hand 31 | Icon: {fileID: 21300020, guid: b528708a5a8f28343aefa9e1d46670a7, type: 3} 32 | Prefab: {fileID: 8069526762727329857, guid: 3f199da48b52a4b4a8832960544d63f3, type: 3} 33 | DropProperties: 34 | Shape: 0 35 | NormalToSpawnPlane: {x: 0, y: 1, z: 0} 36 | MinimumSphereRadius: 1 37 | MaximumSphereRadius: 2 38 | MinimumCubeBaseSize: {x: 1, y: 1, z: 1} 39 | MaximumCubeBaseSize: {x: 2, y: 2, z: 2} 40 | MinimumNormalAxisOffset: 0 41 | MaximumNormalAxisOffset: 0 42 | UseNormalAxisOffsetCurve: 0 43 | NormalOffsetCurve: 44 | serializedVersion: 2 45 | m_Curve: 46 | - serializedVersion: 3 47 | time: 0 48 | value: 1 49 | inSlope: 0 50 | outSlope: 0 51 | tangentMode: 0 52 | weightedMode: 0 53 | inWeight: 0 54 | outWeight: 0 55 | - serializedVersion: 3 56 | time: 1 57 | value: 1 58 | inSlope: 0 59 | outSlope: 0 60 | tangentMode: 0 61 | weightedMode: 0 62 | inWeight: 0 63 | outWeight: 0 64 | m_PreInfinity: 2 65 | m_PostInfinity: 2 66 | m_RotationOrder: 4 67 | NormalOffsetCurveRemapZero: 0 68 | NormalOffsetCurveRemapOne: 1 69 | InvertNormalOffsetCurve: 0 70 | MinimumRotation: {x: 0, y: 0, z: 0} 71 | MaximumRotation: {x: 0, y: 0, z: 0} 72 | MinimumScale: {x: 1, y: 1, z: 1} 73 | MaximumScale: {x: 1, y: 1, z: 1} 74 | MaximumStack: 1 75 | ItemClass: 0 76 | TargetEquipmentInventoryName: 77 | EquippedSound: {fileID: 0} 78 | UsedSound: {fileID: 0} 79 | MovedSound: {fileID: 0} 80 | DroppedSound: {fileID: 0} 81 | UseDefaultSoundsIfNull: 1 82 | StatusEffects: 83 | - {fileID: 11400000, guid: 84023811df3f61f43a1090eb5471a458, type: 2} 84 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/Items/HealingPotion.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e35d61e82f51dd44fac96e4dfb787ffe 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/Items/SharpSword.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b28106b466948424d961a75dca44f99d, type: 3} 13 | m_Name: SharpSword 14 | m_EditorClassIdentifier: 15 | ItemID: SharpSword 16 | TargetInventoryName: SuitMainInventory 17 | ForceSlotIndex: 0 18 | TargetIndex: 0 19 | Usable: 0 20 | Consumable: 1 21 | ConsumeQuantity: 1 22 | Equippable: 1 23 | MoveWhenEquipped: 1 24 | Droppable: 1 25 | CanMoveObject: 1 26 | CanSwapObject: 1 27 | Quantity: 1 28 | ItemName: Sharp sword 29 | ShortDescription: Doubles your damage 30 | Description: Worn on the head, this special sword strikes fear into your enemies, 31 | making your hits twice as powerful 32 | Icon: {fileID: 21300016, guid: febaf98c9e2e16b4693de2178a533b43, type: 3} 33 | Prefab: {fileID: 1987956315814448482, guid: 679c02f70af03de49a48d556869e78b1, type: 3} 34 | DropProperties: 35 | Shape: 0 36 | NormalToSpawnPlane: {x: 0, y: 1, z: 0} 37 | MinimumSphereRadius: 1 38 | MaximumSphereRadius: 2 39 | MinimumCubeBaseSize: {x: 1, y: 1, z: 1} 40 | MaximumCubeBaseSize: {x: 2, y: 2, z: 2} 41 | MinimumNormalAxisOffset: 0 42 | MaximumNormalAxisOffset: 0 43 | UseNormalAxisOffsetCurve: 0 44 | NormalOffsetCurve: 45 | serializedVersion: 2 46 | m_Curve: 47 | - serializedVersion: 3 48 | time: 0 49 | value: 1 50 | inSlope: 0 51 | outSlope: 0 52 | tangentMode: 0 53 | weightedMode: 0 54 | inWeight: 0 55 | outWeight: 0 56 | - serializedVersion: 3 57 | time: 1 58 | value: 1 59 | inSlope: 0 60 | outSlope: 0 61 | tangentMode: 0 62 | weightedMode: 0 63 | inWeight: 0 64 | outWeight: 0 65 | m_PreInfinity: 2 66 | m_PostInfinity: 2 67 | m_RotationOrder: 4 68 | NormalOffsetCurveRemapZero: 0 69 | NormalOffsetCurveRemapOne: 1 70 | InvertNormalOffsetCurve: 0 71 | MinimumRotation: {x: 0, y: 0, z: 0} 72 | MaximumRotation: {x: 0, y: 0, z: 0} 73 | MinimumScale: {x: 1, y: 1, z: 1} 74 | MaximumScale: {x: 1, y: 1, z: 1} 75 | MaximumStack: 1 76 | ItemClass: 0 77 | TargetEquipmentInventoryName: SuitWeaponInventory 78 | EquippedSound: {fileID: 0} 79 | UsedSound: {fileID: 0} 80 | MovedSound: {fileID: 0} 81 | DroppedSound: {fileID: 0} 82 | UseDefaultSoundsIfNull: 1 83 | StatusEffects: 84 | - {fileID: 11400000, guid: 6a602f5bd1bc84e45a6f9891ae6ff6b7, type: 2} 85 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/Items/SharpSword.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef5fa467e61e98a4c8c82d5d082eb087 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/RuntimeSets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5116c3440284f6543b3c94c51b1bd1f5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/RuntimeSets/CharacterDamageMultipliers.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 650e9f96c329885498664eb5474d5058, type: 3} 13 | m_Name: CharacterDamageMultipliers 14 | m_EditorClassIdentifier: 15 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/Resources/RuntimeSets/CharacterDamageMultipliers.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d310a366060dc648ba6369a650eee91 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58839c553b8a6a54d83df284cd921fb3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/DamageOverTime.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 84f9841aed94beb45a4f7eea21736668, type: 3} 13 | m_Name: DamageOverTime 14 | m_EditorClassIdentifier: 15 | Duration: 3 16 | DamagePerInterval: 9 17 | Interval: 0.5 18 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/DamageOverTime.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6ce5d0980a7b8942a0c0ffcee5a1068 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/DoubleDamage.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 1a1def979ea62cc4a8402ba7b0932c85, type: 3} 13 | m_Name: DoubleDamage 14 | m_EditorClassIdentifier: 15 | Multiplier: 2 16 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/DoubleDamage.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a602f5bd1bc84e45a6f9891ae6ff6b7 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/Freeze.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 606a9daf69533624fbd4f342ceab7b39, type: 3} 13 | m_Name: Freeze 14 | m_EditorClassIdentifier: 15 | Duration: 2 16 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/Freeze.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd7b5afcd61de5d4181b25c81e3f8045 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/HealOverTime.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 84f9841aed94beb45a4f7eea21736668, type: 3} 13 | m_Name: HealOverTime 14 | m_EditorClassIdentifier: 15 | Duration: 6 16 | DamagePerInterval: -10 17 | Interval: 1 18 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/HealOverTime.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84023811df3f61f43a1090eb5471a458 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/SpeedBoost.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: dd6b9caaf34785d4594ebad5b950b2a3, type: 3} 13 | m_Name: SpeedBoost 14 | m_EditorClassIdentifier: 15 | Duration: 5 16 | AdditionalSpeed: 10 17 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/SpeedBoost.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8b40e10a6340c541bbdc21ec752eed5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/TemporarySlow.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: dd6b9caaf34785d4594ebad5b950b2a3, type: 3} 13 | m_Name: TemporarySlow 14 | m_EditorClassIdentifier: 15 | Duration: 3 16 | AdditionalSpeed: -3 17 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffects/TemporarySlow.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3b161f82393d2d4facde1548a01e16f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Demo/StatusEffectsRectangle.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0d9352c81299674898a9b94c5add054 3 | timeCreated: 1469092248 4 | licenseType: Store 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ca61f04b15dc464b83be2c07b1c95c7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Character.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 943a4faac5423454ca2fcf211389b103 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Character/CharacterStatusEffectListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MoreMountains.Feedbacks; 3 | using MoreMountains.Tools; 4 | using MoreMountains.CorgiEngine; 5 | using UnityEngine; 6 | 7 | namespace StatusSystem 8 | { 9 | public class CharacterStatusEffectListener : MonoBehaviour, MMEventListener 10 | { 11 | private Character _character; 12 | 13 | [Serializable] 14 | public struct StatusEffectFeedbacks 15 | { 16 | public StatusEffect StatusEffect; 17 | public MMFeedbacks StatusEffectStartFeedbacks; 18 | public MMFeedbacks StatusEffectStopFeedbacks; 19 | 20 | public void OnApply(StatusEffect statusEffect, Character character) 21 | { 22 | if (statusEffect != StatusEffect) return; 23 | StatusEffect.Apply(character); 24 | } 25 | 26 | public void OnStart(StatusEffect statusEffect) 27 | { 28 | if (statusEffect != StatusEffect) return; 29 | StatusEffectStartFeedbacks?.PlayFeedbacks(); 30 | } 31 | 32 | public void OnStop(StatusEffect statusEffect) 33 | { 34 | if (statusEffect != StatusEffect) return; 35 | StatusEffectStopFeedbacks?.PlayFeedbacks(); 36 | } 37 | } 38 | 39 | public StatusEffectFeedbacks[] StatusEffectsAndFeedbacks; 40 | 41 | private void Awake() 42 | { 43 | _character = GetComponentInParent(); 44 | } 45 | 46 | public void OnMMEvent(StatusEffectEvent statusEffectEvent) 47 | { 48 | if (statusEffectEvent.Character != _character) return; 49 | switch (statusEffectEvent.Type) 50 | { 51 | case StatusEffectEventTypes.Apply: 52 | foreach (var statusEffectsFeedback in StatusEffectsAndFeedbacks) 53 | statusEffectsFeedback.OnApply(statusEffectEvent.StatusEffect, _character); 54 | break; 55 | case StatusEffectEventTypes.Start: 56 | foreach (var statusEffectsFeedback in StatusEffectsAndFeedbacks) 57 | statusEffectsFeedback.OnStart(statusEffectEvent.StatusEffect); 58 | break; 59 | case StatusEffectEventTypes.Stop: 60 | foreach (var statusEffectsFeedback in StatusEffectsAndFeedbacks) 61 | statusEffectsFeedback.OnStop(statusEffectEvent.StatusEffect); 62 | break; 63 | } 64 | } 65 | 66 | private void OnEnable() 67 | { 68 | this.MMEventStartListening(); 69 | } 70 | 71 | private void OnDisable() 72 | { 73 | this.MMEventStopListening(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Character/CharacterStatusEffectListener.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6c040f09475000479356e11fddcabd4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Items.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba63e6e1d10403642a27b6ba5896c5db 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Items/InventoryStatusEffect.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.InventoryEngine; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | [CreateAssetMenu(fileName = "InventoryStatusEffect", menuName = "Status System/Items/Inventory Status Effect")] 8 | public class InventoryStatusEffect : InventoryItem 9 | { 10 | public StatusEffect[] StatusEffects; 11 | 12 | public override bool Use(string playerID) 13 | { 14 | var character = TargetInventory(playerID).Owner.GetComponentInParent(); 15 | foreach (var statusEffect in StatusEffects) 16 | StatusEffectEvent.Trigger(statusEffect, character, StatusEffectEventTypes.Apply); 17 | return true; 18 | } 19 | 20 | public override bool Equip(string playerID) 21 | { 22 | var character = TargetInventory(playerID).Owner.GetComponentInParent(); 23 | foreach (var statusEffect in StatusEffects) 24 | StatusEffectEvent.Trigger(statusEffect, character, StatusEffectEventTypes.Apply); 25 | return true; 26 | } 27 | 28 | public override bool UnEquip(string playerID) 29 | { 30 | var character = TargetInventory(playerID).Owner.GetComponentInParent(); 31 | foreach (var statusEffect in StatusEffects) 32 | StatusEffectEvent.Trigger(statusEffect, character, StatusEffectEventTypes.Unapply); 33 | return true; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Items/InventoryStatusEffect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b28106b466948424d961a75dca44f99d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14b889e7beaa4f54dae3cae233271313 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/ApplyStatusAndDamageOnTouch.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | public class ApplyStatusAndDamageOnTouch : MultipliedDamageOnTouch 8 | { 9 | [Header("Status effects")] 10 | [Tooltip("The list of status effects that will be applied to colliding characters (provided they have a CharacterStatusEffectListener with the required status effects)")] 11 | public StatusEffect[] StatusEffects; 12 | 13 | protected Character _character; 14 | 15 | protected override void Colliding(Collider2D collider) 16 | { 17 | if (!this.isActiveAndEnabled) 18 | { 19 | return; 20 | } 21 | 22 | // if the object we're colliding with is part of our ignore list, we do nothing and exit 23 | if (_ignoredGameObjects.Contains(collider.gameObject)) 24 | { 25 | return; 26 | } 27 | 28 | // if what we're colliding with isn't part of the target layers, we do nothing and exit 29 | if (!MMLayers.LayerInLayerMask(collider.gameObject.layer,TargetLayerMask)) 30 | { 31 | return; 32 | } 33 | 34 | // we get the character and apply all the status effects in the list 35 | _character = collider.gameObject.MMGetComponentNoAlloc(); 36 | if (_character != null) 37 | foreach (var statusEffect in StatusEffects) 38 | StatusEffectEvent.Trigger(statusEffect, _character, StatusEffectEventTypes.Apply); 39 | 40 | _collidingCollider = collider; 41 | _colliderHealth = collider.gameObject.MMGetComponentNoAlloc(); 42 | 43 | OnHit?.Invoke(); 44 | 45 | // if what we're colliding with is damageable 46 | if ((_colliderHealth != null) && (_colliderHealth.enabled)) 47 | { 48 | if(_colliderHealth.CurrentHealth > 0) 49 | { 50 | OnCollideWithDamageable(_colliderHealth); 51 | } 52 | } 53 | // if what we're colliding with can't be damaged 54 | else 55 | { 56 | OnCollideWithNonDamageable(); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/ApplyStatusAndDamageOnTouch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b4c1bf9105031e409e416df2ebb057d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/CharacterDamageMultipliers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | [CreateAssetMenu(fileName = "CharacterDamageMultipliers", menuName = "Status System/Runtime Sets/Character Damage Multipliers")] 8 | public class CharacterDamageMultipliers : ScriptableObject 9 | { 10 | private Dictionary _characterDamageMultipliers; 11 | 12 | public float this [Character character] 13 | { 14 | get => !_characterDamageMultipliers.ContainsKey(character) ? 1f : _characterDamageMultipliers[character]; 15 | set => _characterDamageMultipliers[character] = value; 16 | } 17 | 18 | private void OnEnable() 19 | { 20 | _characterDamageMultipliers = new Dictionary(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/CharacterDamageMultipliers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 650e9f96c329885498664eb5474d5058 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/MultipliedDamageOnTouch.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using MoreMountains.Feedbacks; 4 | using UnityEngine; 5 | 6 | namespace StatusSystem 7 | { 8 | public class MultipliedDamageOnTouch : DamageOnTouch 9 | { 10 | private CharacterDamageMultipliers _multipliers; 11 | protected override void Awake() 12 | { 13 | base.Awake(); 14 | // the CharacterDamageMultipliers scriptable object must be in a Resources folder inside your project, like so : Resources/RuntimeSets/CharacterDamageMultipliers 15 | _multipliers = Resources.Load("RuntimeSets/CharacterDamageMultipliers"); 16 | } 17 | 18 | protected override void OnCollideWithDamageable(Health health) 19 | { 20 | // if what we're colliding with is a CorgiController, we apply a knockback force 21 | _colliderCorgiController = health.gameObject.MMGetComponentNoAlloc(); 22 | 23 | ApplyDamageCausedKnockback(); 24 | 25 | OnHitDamageable?.Invoke(); 26 | 27 | HitDamageableFeedback?.PlayFeedbacks(this.transform.position); 28 | 29 | if ((FreezeFramesOnHitDuration > 0) && (Time.timeScale > 0)) 30 | { 31 | MMFreezeFrameEvent.Trigger(Mathf.Abs(FreezeFramesOnHitDuration)); 32 | } 33 | 34 | // we apply the damage to the thing we've collided with 35 | var character = Owner.MMGetComponentNoAlloc(); 36 | if (character != null) 37 | _colliderHealth.Damage((int)(DamageCaused * _multipliers[character]), gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection); 38 | else 39 | _colliderHealth.Damage(DamageCaused, gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection); 40 | if (_colliderHealth.CurrentHealth <= 0) 41 | { 42 | OnKill?.Invoke(); 43 | } 44 | 45 | SelfDamage(DamageTakenEveryTime + DamageTakenDamageable); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/MultipliedDamageOnTouch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: beb279679cc8e6c41981ef177748baad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/StatusEffectMeleeWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | public class StatusEffectMeleeWeapon : MeleeWeapon 8 | { 9 | [MMInspectorGroup("Status Effects Applied", true, 25)] 10 | public StatusEffect[] StatusEffects; 11 | 12 | protected override void CreateDamageArea() 13 | { 14 | _damageArea = new GameObject(); 15 | _damageArea.name = this.name+"DamageArea"; 16 | _damageArea.transform.position = this.transform.position; 17 | _damageArea.transform.rotation = this.transform.rotation; 18 | _damageArea.transform.SetParent(this.transform); 19 | 20 | if (DamageAreaShape == MeleeDamageAreaShapes.Rectangle) 21 | { 22 | _boxCollider2D = _damageArea.AddComponent(); 23 | _boxCollider2D.offset = AreaOffset; 24 | _boxCollider2D.size = AreaSize; 25 | _damageAreaCollider = _boxCollider2D; 26 | } 27 | if (DamageAreaShape == MeleeDamageAreaShapes.Circle) 28 | { 29 | _circleCollider2D = _damageArea.AddComponent(); 30 | _circleCollider2D.transform.position = this.transform.position + this.transform.rotation * AreaOffset; 31 | _circleCollider2D.radius = AreaSize.x/2; 32 | _damageAreaCollider = _circleCollider2D; 33 | } 34 | _damageAreaCollider.isTrigger = true; 35 | 36 | Rigidbody2D rigidBody = _damageArea.AddComponent (); 37 | rigidBody.isKinematic = true; 38 | 39 | _damageOnTouch = _damageArea.AddComponent(); 40 | _damageOnTouch.TargetLayerMask = TargetLayerMask; 41 | _damageOnTouch.DamageCaused = DamageCaused; 42 | _damageOnTouch.DamageCausedKnockbackType = Knockback; 43 | _damageOnTouch.DamageCausedKnockbackForce = KnockbackForce; 44 | _damageOnTouch.InvincibilityDuration = InvincibilityDuration; 45 | ((ApplyStatusAndDamageOnTouch)_damageOnTouch).StatusEffects = StatusEffects; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/StatusEffectMeleeWeapon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4a8950b0a14f92458961ced597f2a19 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/StatusEffectTester.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | public class StatusEffectTester : MonoBehaviour 8 | { 9 | public StatusEffect StatusEffect; 10 | public Character Character; 11 | 12 | [MMInspectorButton("ApplyStatusEffectTest")] 13 | public bool ApplyStatusEffectTestButton; 14 | 15 | [MMInspectorButton("StatusEffectStartFeedbacksTest")] 16 | public bool StatusEffectStartFeedbacksTestButton; 17 | 18 | [MMInspectorButton("StatusEffectStopFeedbacksTest")] 19 | public bool StatusEffectStopFeedbacksTestButton; 20 | 21 | private void ApplyStatusEffectTest() 22 | { 23 | StatusEffectEvent.Trigger(StatusEffect, Character, StatusEffectEventTypes.Apply); 24 | } 25 | 26 | private void StatusEffectStartFeedbacksTest() 27 | { 28 | StatusEffectEvent.Trigger(StatusEffect, Character, StatusEffectEventTypes.Start); 29 | } 30 | 31 | private void StatusEffectStopFeedbacksTest() 32 | { 33 | StatusEffectEvent.Trigger(StatusEffect, Character, StatusEffectEventTypes.Stop); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/Others/StatusEffectTester.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70f2c06e09dfa2140bc95a65184e1888 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f345bad5c51e5740adf0ed9cf050f3d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Abstract.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5b1185ccda7b4a418f3e5515bc48c74 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Abstract/StatusEffect.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.Tools; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace StatusSystem 6 | { 7 | public enum StatusEffectEventTypes 8 | { 9 | Apply, 10 | Unapply, 11 | Start, 12 | Stop 13 | } 14 | 15 | public struct StatusEffectEvent 16 | { 17 | public StatusEffectEventTypes Type; 18 | public StatusEffect StatusEffect; 19 | public Character Character; 20 | 21 | static StatusEffectEvent e; 22 | public static void Trigger(StatusEffect statusEffect, Character character, StatusEffectEventTypes type) 23 | { 24 | e.StatusEffect = statusEffect; 25 | e.Character = character; 26 | e.Type = type; 27 | MMEventManager.TriggerEvent(e); 28 | } 29 | } 30 | 31 | public abstract class StatusEffect : ScriptableObject, MMEventListener 32 | { 33 | public abstract void Apply(Character character); 34 | protected abstract void Unapply(Character character); 35 | 36 | public void OnMMEvent(StatusEffectEvent statusEffectEvent) 37 | { 38 | if (statusEffectEvent.StatusEffect == this && 39 | statusEffectEvent.Type == StatusEffectEventTypes.Unapply) 40 | Unapply(statusEffectEvent.Character); 41 | } 42 | 43 | protected virtual void OnEnable() 44 | { 45 | this.MMEventStartListening(); 46 | } 47 | 48 | protected virtual void OnDisable() 49 | { 50 | this.MMEventStopListening(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Abstract/StatusEffect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95a210f6719888848be8d48c0180ad16 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Abstract/TemporaryStatusEffect.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MoreMountains.CorgiEngine; 4 | using UnityEngine; 5 | 6 | namespace StatusSystem 7 | { 8 | public abstract class TemporaryStatusEffect : StatusEffect 9 | { 10 | [Tooltip("The duration (in seconds) of this status effect")] 11 | public float Duration = 3f; 12 | private readonly Dictionary _isStatusEffectActive = new Dictionary(); 13 | private readonly Dictionary _coroutines = new Dictionary(); 14 | public override void Apply(Character character) 15 | { 16 | _isStatusEffectActive.TryGetValue(character, out var statusEffectActive); 17 | if (statusEffectActive) 18 | { 19 | character.StopCoroutine(_coroutines[character]); 20 | Unapply(character); 21 | } 22 | else 23 | StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Start); 24 | _isStatusEffectActive[character] = true; 25 | _coroutines[character] = character.StartCoroutine(WaitForDurationThenUnapply(character)); 26 | } 27 | 28 | private IEnumerator WaitForDurationThenUnapply(Character character) 29 | { 30 | yield return new WaitForSeconds(Duration); 31 | StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Stop); 32 | _isStatusEffectActive[character] = false; 33 | Unapply(character); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Abstract/TemporaryStatusEffect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5784b27e967fd5b4f812c80aba2f4da0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2e0a13844619ab448424e0a44bc68ef 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/DamageMultiplier.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using UnityEngine; 3 | 4 | namespace StatusSystem 5 | { 6 | [CreateAssetMenu(fileName = "DamageMultiplier", menuName = "Status System/Status Effects/Simple/Damage Multiplier")] 7 | public class DamageMultiplier : StatusEffect 8 | { 9 | public float Multiplier = 2f; 10 | 11 | private CharacterDamageMultipliers _multipliers; 12 | protected override void OnEnable() 13 | { 14 | base.OnEnable(); 15 | _multipliers = Resources.Load("RuntimeSets/CharacterDamageMultipliers"); 16 | } 17 | 18 | public override void Apply(Character character) 19 | { 20 | StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Start); 21 | _multipliers[character] *= Multiplier; 22 | } 23 | 24 | protected override void Unapply(Character character) 25 | { 26 | StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Stop); 27 | _multipliers[character] /= Multiplier; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/DamageMultiplier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a1def979ea62cc4a8402ba7b0932c85 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/DamageOverTime.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MoreMountains.CorgiEngine; 4 | using UnityEngine; 5 | 6 | namespace StatusSystem 7 | { 8 | [CreateAssetMenu(fileName = "DamageOverTime", menuName = "Status System/Status Effects/Temporary/Damage Over Time")] 9 | public class DamageOverTime : TemporaryStatusEffect 10 | { 11 | [Tooltip("How much damage (or healing in case the value is negative) will be done each interval")] 12 | public int DamagePerInterval = 3; 13 | [Tooltip("How often the effect “Ticks” on the character. Each time it ticks, it does damage or healing.")] 14 | public float Interval = .5f; 15 | private Dictionary _coroutines = new Dictionary(); 16 | 17 | public override void Apply(Character character) 18 | { 19 | base.Apply(character); 20 | _coroutines[character] = character.StartCoroutine(ApplyDamageEveryTick(character)); 21 | } 22 | 23 | private IEnumerator ApplyDamageEveryTick(Character character) 24 | { 25 | var health = character.CharacterHealth; 26 | while (true) 27 | { 28 | yield return new WaitForSeconds(Interval); 29 | if (DamagePerInterval > 0) 30 | health.Damage(DamagePerInterval, character.gameObject, 0f, 0f, Vector3.zero); 31 | else 32 | health.GetHealth(-DamagePerInterval, character.gameObject); 33 | } 34 | } 35 | 36 | protected override void Unapply(Character character) 37 | { 38 | character.StopCoroutine(_coroutines[character]); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/DamageOverTime.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84f9841aed94beb45a4f7eea21736668 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/Freeze.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using UnityEngine; 3 | 4 | namespace StatusSystem 5 | { 6 | [CreateAssetMenu(fileName = "Freeze", menuName = "Status System/Status Effects/Temporary/Freeze")] 7 | public class Freeze : TemporaryStatusEffect 8 | { 9 | public override void Apply(Character character) 10 | { 11 | base.Apply(character); 12 | character.Freeze(); 13 | } 14 | 15 | protected override void Unapply(Character character) 16 | { 17 | character.UnFreeze(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/Freeze.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 606a9daf69533624fbd4f342ceab7b39 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/TemporarySpeed.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using UnityEngine; 3 | 4 | namespace StatusSystem 5 | { 6 | [CreateAssetMenu(fileName = "TemporarySpeed", menuName = "Status System/Status Effects/Temporary/Temporary Speed")] 7 | public class TemporarySpeed : TemporaryStatusEffect 8 | { 9 | [Tooltip("How much speed to add to the character when this status effect is applied. Also works with negative numbers for a speed reducing effect.")] 10 | public float AdditionalSpeed = 10f; 11 | public override void Apply(Character character) 12 | { 13 | base.Apply(character); 14 | ChangeSpeed(character, AdditionalSpeed); 15 | } 16 | 17 | protected override void Unapply(Character character) 18 | { 19 | ChangeSpeed(character, -AdditionalSpeed); 20 | } 21 | 22 | private void ChangeSpeed(Character character, float speed) 23 | { 24 | var movement = character.FindAbility(); 25 | if (movement != null) movement.WalkSpeed += speed; 26 | 27 | var run = character.FindAbility(); 28 | if (run != null) run.RunSpeed += speed; 29 | 30 | movement.MovementSpeed = character.MovementState.CurrentState == CharacterStates.MovementStates.Running ? run.RunSpeed : movement.WalkSpeed; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /StatusEffectSystem/Scripts/StatusEffects/Concrete/TemporarySpeed.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd6b9caaf34785d4594ebad5b950b2a3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /StatusEffectSystem/StatusEffectSystem.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reunono/CorgiEngineExtensions/90c49db22fd51f3094549045dd07a8547b0912b6/StatusEffectSystem/StatusEffectSystem.unitypackage -------------------------------------------------------------------------------- /TeleporterWithZoom/TeleporterWithZoom.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.U2D; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using MoreMountains.Tools; 6 | using MoreMountains.MMInterface; 7 | using MoreMountains.Feedbacks; 8 | 9 | namespace MoreMountains.CorgiEngine 10 | { 11 | /// Teleporter with Pixel Perfect Camera pixel per unit custom value, allows you to simulate zooms on selected rooms (i.e. entering a little room) 12 | /// v1.0 / Muppo (2020) 13 | public class TeleporterWithZoom : Teleporter 14 | { 15 | [Header("Extra Settings")] 16 | public Camera _mainCamera; 17 | public int _pixelPerUnit; 18 | protected PixelPerfectCamera _pixelPerfect; 19 | 20 | /// 21 | protected override void Awake() 22 | { 23 | _pixelPerfect = _mainCamera.GetComponent(); 24 | base.Awake(); 25 | } 26 | 27 | /// 28 | protected override void TeleportCollider(Collider2D collider) 29 | { 30 | _pixelPerfect.assetsPPU = _pixelPerUnit; 31 | base.TeleportCollider(collider); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /TriggerEventOnAreaClear/AreaClearTarget.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace TriggerEventOnAreaClear 6 | { 7 | /// 8 | /// Add this class to an object and it will count as a target to clear (if it is inside a collider with a TriggerEventOnAreaClear component) 9 | /// 10 | public class AreaClearTarget : MonoBehaviour 11 | { 12 | private Health _health; 13 | private TriggerEventOnAreaClear _triggerEventOnAreaClear; 14 | private bool _alreadyRemoved; 15 | 16 | private void Awake() 17 | { 18 | _health = GetComponent(); 19 | if (_health != null) _health.OnDeath += RemoveTarget; 20 | } 21 | 22 | private void AddTarget() 23 | { 24 | if (_triggerEventOnAreaClear == null) return; 25 | _triggerEventOnAreaClear.AddTarget(); 26 | _alreadyRemoved = false; 27 | } 28 | 29 | private void RemoveTarget() 30 | { 31 | if (_triggerEventOnAreaClear == null || _alreadyRemoved) return; 32 | _triggerEventOnAreaClear.RemoveTarget(); 33 | _alreadyRemoved = true; 34 | } 35 | 36 | private void OnEnable() 37 | { 38 | _triggerEventOnAreaClear = FindObjectsOfType().SingleOrDefault(room => room.GetComponent().bounds.Contains(transform.position.MMSetZ(room.transform.position.z))); 39 | AddTarget(); 40 | } 41 | 42 | private void OnDisable() { RemoveTarget(); } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /TriggerEventOnAreaClear/TriggerEventOnAreaClear.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | 4 | namespace TriggerEventOnAreaClear 5 | { 6 | /// 7 | /// Requires a Collider and objects with the AreaClearTarget component inside said collider. Make sure both this transform and the targets z positions are 0 8 | /// 9 | public class TriggerEventOnAreaClear : MonoBehaviour 10 | { 11 | [Tooltip("the event to trigger when the area is cleared (all objects marked with AreaClearTarget have been destroyed)")] 12 | public UnityEvent OnAreaCleared; 13 | private int _numberOfTargetsAlive; 14 | 15 | public void AddTarget() { _numberOfTargetsAlive++; } 16 | 17 | public void RemoveTarget() 18 | { 19 | _numberOfTargetsAlive--; 20 | if (_numberOfTargetsAlive == 0) OnAreaCleared?.Invoke(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /TypedDamage/DamageType.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CorgiEngineExtensions 4 | { 5 | [CreateAssetMenu(menuName = "ScriptableCookbook/Damage Type")] 6 | public class DamageType : ScriptableObject {} 7 | } 8 | -------------------------------------------------------------------------------- /TypedDamage/TypedDamageOnTouch.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Feedbacks; 3 | using MoreMountains.Tools; 4 | using UnityEngine; 5 | 6 | namespace CorgiEngineExtensions 7 | { 8 | public class TypedDamageOnTouch : DamageOnTouch 9 | { 10 | [Header("Damage type")] public DamageType DamageType; 11 | protected override void OnCollideWithDamageable(Health health) 12 | { 13 | // if what we're colliding with is a CorgiController, we apply a knockback force 14 | _colliderCorgiController = health.gameObject.MMGetComponentNoAlloc(); 15 | 16 | ApplyDamageCausedKnockback(); 17 | 18 | OnHitDamageable?.Invoke(); 19 | 20 | HitDamageableFeedback?.PlayFeedbacks(this.transform.position); 21 | 22 | if ((FreezeFramesOnHitDuration > 0) && (Time.timeScale > 0)) 23 | { 24 | MMFreezeFrameEvent.Trigger(Mathf.Abs(FreezeFramesOnHitDuration)); 25 | } 26 | 27 | // we apply the damage to the thing we've collided with 28 | var typedHealth = _colliderHealth as TypedHealth; 29 | if (typedHealth != null) 30 | typedHealth.Damage(DamageCaused, gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection, DamageType); 31 | else 32 | _colliderHealth.Damage(DamageCaused, gameObject, InvincibilityDuration, InvincibilityDuration, _damageDirection); 33 | 34 | if (_colliderHealth.CurrentHealth <= 0) 35 | { 36 | OnKill?.Invoke(); 37 | } 38 | 39 | SelfDamage(DamageTakenEveryTime + DamageTakenDamageable); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /TypedDamage/TypedHealth.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using MoreMountains.CorgiEngine; 3 | using UnityEngine; 4 | 5 | namespace CorgiEngineExtensions 6 | { 7 | public class TypedHealth : Health 8 | { 9 | [Header("Damage types")] 10 | public float VulnerableDamageTypeMultiplier = 2; 11 | public DamageType[] VulnerableDamageTypes; 12 | public DamageType[] InvulnerableDamageTypes; 13 | 14 | public void Damage(int damage, GameObject instigator, float flickerDuration, float invincibilityDuration, Vector3 damageDirection, DamageType damageType) 15 | { 16 | if (damageType != null) 17 | { 18 | if (InvulnerableDamageTypes.Any(invulnerableDamageType => damageType == invulnerableDamageType)) return; 19 | if (VulnerableDamageTypes.Any(vulnerableDamageType => damageType == vulnerableDamageType)) 20 | damage = (int) (damage * VulnerableDamageTypeMultiplier); 21 | } 22 | base.Damage(damage, instigator, flickerDuration, invincibilityDuration, damageDirection); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /TypedDamage/TypedMeleeWeapon.cs: -------------------------------------------------------------------------------- 1 | using MoreMountains.CorgiEngine; 2 | using MoreMountains.Tools; 3 | using UnityEngine; 4 | 5 | namespace CorgiEngineExtensions 6 | { 7 | public class TypedMeleeWeapon : MeleeWeapon 8 | { 9 | [MMInspectorGroup("Damage type", true, 25)] 10 | public DamageType DamageType; 11 | protected override void CreateDamageArea() 12 | { 13 | _damageArea = new GameObject(); 14 | _damageArea.name = this.name+"DamageArea"; 15 | _damageArea.transform.position = this.transform.position; 16 | _damageArea.transform.rotation = this.transform.rotation; 17 | _damageArea.transform.SetParent(this.transform); 18 | 19 | if (DamageAreaShape == MeleeDamageAreaShapes.Rectangle) 20 | { 21 | _boxCollider2D = _damageArea.AddComponent(); 22 | _boxCollider2D.offset = AreaOffset; 23 | _boxCollider2D.size = AreaSize; 24 | _damageAreaCollider = _boxCollider2D; 25 | } 26 | if (DamageAreaShape == MeleeDamageAreaShapes.Circle) 27 | { 28 | _circleCollider2D = _damageArea.AddComponent(); 29 | _circleCollider2D.transform.position = this.transform.position + this.transform.rotation * AreaOffset; 30 | _circleCollider2D.radius = AreaSize.x/2; 31 | _damageAreaCollider = _circleCollider2D; 32 | } 33 | _damageAreaCollider.isTrigger = true; 34 | 35 | Rigidbody2D rigidBody = _damageArea.AddComponent (); 36 | rigidBody.isKinematic = true; 37 | 38 | _damageOnTouch = _damageArea.AddComponent(); 39 | _damageOnTouch.TargetLayerMask = TargetLayerMask; 40 | _damageOnTouch.DamageCaused = DamageCaused; 41 | _damageOnTouch.DamageCausedKnockbackType = Knockback; 42 | _damageOnTouch.DamageCausedKnockbackForce = KnockbackForce; 43 | _damageOnTouch.InvincibilityDuration = InvincibilityDuration; 44 | var typedDamageOnTouch = _damageOnTouch as TypedDamageOnTouch; 45 | typedDamageOnTouch.DamageType = DamageType; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /WeaponDisable/WeaponDisable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MoreMountains.CorgiEngine; 5 | using MoreMountains.Tools; 6 | 7 | public class WeaponDisable : CharacterAbility { 8 | 9 | public override string HelpBoxText() { return "This component handles the disabling of weapons during both wall hanging and ladder climbing. This is to create a more visually pleasing situation and should be supplimented in the animator with animations that include the weapon in the position the designer would like it to be in while clibming or wall hanging"; } 10 | 11 | private GameObject weapon; 12 | private GameObject weapon2; 13 | private GameObject weaponSpecial; 14 | private CharacterHandleWeapon weaponScript; 15 | private CharacterHandleSecondaryWeapon secondaryWeaponScript; 16 | 17 | public bool secondaryWeapon; 18 | public bool specialWeapon; 19 | 20 | [HideInInspector] 21 | public bool usingSwitch; 22 | 23 | void Awake () 24 | { 25 | 26 | weapon = transform.Find("WeaponAttachement").gameObject; 27 | 28 | 29 | if(secondaryWeapon) 30 | { 31 | weapon2 = transform.Find("WeaponAttachement2").gameObject; 32 | } 33 | 34 | 35 | if(specialWeapon) 36 | { 37 | weaponSpecial = transform.Find("WeaponAttachementSpecial").gameObject; 38 | } 39 | 40 | weaponScript = GetComponent(); 41 | secondaryWeaponScript = GetComponent(); 42 | 43 | usingSwitch = false; 44 | } 45 | 46 | void Update () 47 | { 48 | if(_movement.CurrentState == CharacterStates.MovementStates.LadderClimbing || _movement.CurrentState == CharacterStates.MovementStates.WallClinging || usingSwitch) 49 | { 50 | DisableNormalWeapons(); 51 | } 52 | else 53 | { 54 | EnableNormalWeapons(); 55 | } 56 | } 57 | 58 | public void EnableNormalWeapons () 59 | { 60 | weapon.SetActive(true); 61 | weaponScript.enabled = true; 62 | 63 | if(secondaryWeapon && secondaryWeaponScript != null) 64 | { 65 | weapon2.SetActive(true); 66 | secondaryWeaponScript.enabled = true; 67 | 68 | } 69 | } 70 | 71 | public void DisableNormalWeapons () 72 | { 73 | weapon.SetActive(false); 74 | weaponScript.enabled = false; 75 | 76 | if(secondaryWeapon && secondaryWeaponScript != null) 77 | { 78 | weapon2.SetActive(false); 79 | secondaryWeaponScript.enabled = false; 80 | } 81 | } 82 | } 83 | --------------------------------------------------------------------------------