├── .DS_Store ├── Scripts ├── .DS_Store ├── Data │ ├── .DS_Store │ ├── LevelAsset.cs │ ├── CatDynamicStatsRealized.cs │ ├── CatAsset.cs │ ├── StageAsset.cs │ ├── CatDynamicStats.cs │ └── MathUtils.cs ├── Map │ ├── .DS_Store │ ├── LevelButton.cs │ ├── WorldPin.cs │ ├── MapCat.cs │ └── MapManager.cs ├── Shop │ ├── .DS_Store │ ├── ExchangeButton.cs │ ├── CatThoughts.cs │ ├── W2EManager.cs │ └── Shop.cs ├── Editor │ ├── .DS_Store │ ├── CatAssetHelper.cs │ ├── LevelAssetHelper.cs │ ├── StageAssetHelper.cs │ ├── BackgroundRandomizerEditor.cs │ ├── MainMenuCatEditor.cs │ ├── DetailCardEditor.cs │ ├── ExploreCatEditor.cs │ └── ScriptableObjectUtility.cs ├── Explore │ ├── .DS_Store │ ├── ExploreCatYComparer.cs │ ├── ExploreObject.cs │ ├── ResizeCamera.cs │ ├── CreditsCat.cs │ ├── ExploreNotif.cs │ ├── Reward.cs │ ├── Melee.cs │ ├── AttackObj.cs │ ├── Credits.cs │ ├── ExplorePlayer.cs │ ├── ExploreEnd.cs │ ├── Projectile.cs │ └── ExploreStory.cs ├── Serialization │ ├── .DS_Store │ ├── SerializableDictionary │ │ ├── .DS_Store │ │ ├── Editor │ │ │ └── .DS_Store │ │ ├── SerializableDictionary.pdf │ │ ├── WorldIntDictionary.cs │ │ └── SerializableDictionary.cs │ ├── SerializaleEnum.cs │ ├── SerializableHashSet.cs │ └── CatTypeEnumClass.cs ├── RNGMachine.cs ├── ExploreCatHolder.cs ├── Destroy.cs ├── Collectable.cs ├── CameraFollow.cs ├── ExtensionMethods.cs ├── BackgroundRandomizer.cs ├── TeamSelector.cs ├── FadeInOut.cs ├── CameraShake.cs ├── DynamicScaler.cs ├── About.cs ├── CatLevel.cs ├── CatSetUp.cs ├── DeckCard.cs ├── RandomCatNoises.cs ├── HealthBar.cs ├── MainUI.cs ├── SoundManager.cs ├── MainMenuCat.cs ├── AboutText.cs ├── LanguageSupport.cs ├── HowToPlay.cs ├── Cat.cs ├── TutorialExplore.cs ├── PlayerData.cs ├── Notification.cs ├── Deck.cs ├── TeamSetUp.cs ├── DetailCard.cs └── Tutorial.cs ├── Unity.gitignore ├── LICENSE └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/.DS_Store -------------------------------------------------------------------------------- /Scripts/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/.DS_Store -------------------------------------------------------------------------------- /Scripts/Data/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Data/.DS_Store -------------------------------------------------------------------------------- /Scripts/Map/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Map/.DS_Store -------------------------------------------------------------------------------- /Scripts/Shop/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Shop/.DS_Store -------------------------------------------------------------------------------- /Scripts/Editor/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Editor/.DS_Store -------------------------------------------------------------------------------- /Scripts/Explore/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Explore/.DS_Store -------------------------------------------------------------------------------- /Scripts/Serialization/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Serialization/.DS_Store -------------------------------------------------------------------------------- /Scripts/RNGMachine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public interface RNGMachine { 5 | string Yield(); 6 | } 7 | -------------------------------------------------------------------------------- /Scripts/Serialization/SerializableDictionary/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Serialization/SerializableDictionary/.DS_Store -------------------------------------------------------------------------------- /Scripts/Serialization/SerializableDictionary/Editor/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Serialization/SerializableDictionary/Editor/.DS_Store -------------------------------------------------------------------------------- /Scripts/Serialization/SerializableDictionary/SerializableDictionary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephyo/Wholesome-Cats/HEAD/Scripts/Serialization/SerializableDictionary/SerializableDictionary.pdf -------------------------------------------------------------------------------- /Scripts/Data/LevelAsset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class LevelAsset : ScriptableObject { 6 | 7 | public string[] stageNames; 8 | } 9 | -------------------------------------------------------------------------------- /Scripts/ExploreCatHolder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ExploreCatHolder : ExploreObject 6 | { 7 | 8 | public Cat cat; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Scripts/Destroy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Destroy : MonoBehaviour { 6 | 7 | public void DestroyThis(){ 8 | Destroy(this.gameObject); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Scripts/Editor/CatAssetHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class CatAssetHelper 5 | { 6 | [MenuItem("Assets/Cat Asset")] 7 | public static void CreateAsset () 8 | { 9 | ScriptableObjectUtility.CreateAsset(); 10 | } 11 | } -------------------------------------------------------------------------------- /Scripts/Editor/LevelAssetHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class LevelAssetHelper 5 | { 6 | [MenuItem("Assets/Level Asset")] 7 | public static void CreateAsset () 8 | { 9 | ScriptableObjectUtility.CreateAsset(); 10 | } 11 | } -------------------------------------------------------------------------------- /Scripts/Editor/StageAssetHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class StageAssetHelper 5 | { 6 | [MenuItem("Assets/Stage Asset")] 7 | public static void CreateAsset () 8 | { 9 | ScriptableObjectUtility.CreateAsset(); 10 | } 11 | } -------------------------------------------------------------------------------- /Scripts/Explore/ExploreCatYComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | public class ExploreCatYComparer : IComparer { 4 | public int Compare(ExploreCat cat1, ExploreCat cat2) { 5 | return (int)((cat2.gameObject.transform.position.y - cat1.gameObject.transform.position.y) * 100000); 6 | } 7 | } -------------------------------------------------------------------------------- /Scripts/Collectable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | [Serializable] 5 | public class Collectable 6 | { 7 | 8 | // TODO: multiple collectables such as items, house wares, etc 9 | public string GUID; 10 | protected Collectable() 11 | { 12 | System.Guid _guid = System.Guid.NewGuid(); 13 | GUID = _guid.ToString(); 14 | } 15 | } -------------------------------------------------------------------------------- /Scripts/CameraFollow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class CameraFollow : MonoBehaviour 4 | { 5 | public Transform Target; 6 | 7 | /// 8 | /// Update is called once per frame 9 | /// 10 | public void Update () 11 | { 12 | transform.position = new Vector3( 13 | Target.transform.position.x, 14 | Target.transform.position.y+1.85f, 15 | 0 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Scripts/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public static class ExtensionMethods 5 | { 6 | //oh this is just a static utility it's not an extension method whoopsies 7 | public static float SignedAngle(Vector2 from, Vector2 to) 8 | { 9 | float unsigned_angle = Vector2.Angle(from, to); 10 | float sign = Mathf.Sign(from.x * to.y - from.y * to.x); 11 | return unsigned_angle * sign; 12 | } 13 | } -------------------------------------------------------------------------------- /Scripts/Explore/ExploreObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ExploreObject : MonoBehaviour { 6 | 7 | protected Rigidbody2D rigidBody; 8 | 9 | 10 | public Rigidbody2D getRigidBody2D() { 11 | if (rigidBody != null) 12 | { 13 | return rigidBody; 14 | } 15 | rigidBody = this.GetComponent(); 16 | return rigidBody; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Scripts/Editor/BackgroundRandomizerEditor.cs: -------------------------------------------------------------------------------- 1 | 2 | using UnityEngine; 3 | using UnityEditor; 4 | using System; 5 | 6 | [CustomEditor(typeof(BackgroundRandomizer))] 7 | public class BackgroundRandomizerEditor : Editor 8 | { 9 | 10 | public override void OnInspectorGUI() 11 | { 12 | 13 | DrawDefaultInspector(); 14 | BackgroundRandomizer BG = (BackgroundRandomizer)target; 15 | if (GUILayout.Button("RANDOMIZE BACKGROUND/TILE")) 16 | { 17 | BG.RandomizeBackground(); 18 | } 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /Scripts/BackgroundRandomizer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using UnityEngine.SceneManagement; 6 | 7 | 8 | public class BackgroundRandomizer : MonoBehaviour 9 | { 10 | 11 | void Start() 12 | { 13 | RandomizeBackground(); 14 | } 15 | 16 | public void RandomizeBackground() 17 | { 18 | Sprite[] tiles = Resources.LoadAll("tiles"); 19 | GetComponent().sprite = tiles[Random.Range(0, tiles.Length)]; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Scripts/Data/CatDynamicStatsRealized.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CatDynamicStatsRealized { 6 | //TODO make these properties or functions 7 | public uint maxHealth; 8 | public float speed = 1f; // who knows how this translates to move units ingame maybe we'll have to tweak it 9 | public uint attackDamage; // damage per attack 10 | // public float attackCooldown; // seconds between attacks 11 | // public float range; 12 | public float projectileSpeed; 13 | } 14 | -------------------------------------------------------------------------------- /Scripts/Shop/ExchangeButton.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class ExchangeButton : MonoBehaviour 6 | { 7 | 8 | public uint silver; 9 | public uint gold; 10 | private void Awake() 11 | { 12 | SetButton(); 13 | } 14 | public void SetButton() 15 | { 16 | 17 | GameControl.GetTextBox(gameObject, "price").text = CatIAP.silverStr + silver.ToString(); 18 | GameControl.GetTextBox(gameObject, "amount").text = gold.ToString()+"x"; 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Scripts/Serialization/SerializaleEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | [Serializable] 5 | public class SerializableEnum where T : struct, IConvertible 6 | { 7 | public T Value 8 | { 9 | get { 10 | m_EnumValue = (T)Enum.Parse(m_EnumValue.GetType(), m_EnumValueAsString); 11 | return m_EnumValue; 12 | } 13 | set { m_EnumValue = value; m_EnumValueAsString = m_EnumValue.ToString();} 14 | } 15 | 16 | [SerializeField] 17 | private string m_EnumValueAsString; 18 | [SerializeField] 19 | private T m_EnumValue; 20 | } -------------------------------------------------------------------------------- /Unity.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio 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 | *.opendb 26 | 27 | # Unity3D generated meta files 28 | *.meta 29 | 30 | # Unity3D Generated File On Crash Reports 31 | sysinfo.txt 32 | 33 | # Builds 34 | *.apk 35 | *.unitypackage 36 | 37 | .DS_Store 38 | -------------------------------------------------------------------------------- /Scripts/Editor/MainMenuCatEditor.cs: -------------------------------------------------------------------------------- 1 | 2 | using UnityEngine; 3 | using UnityEditor; 4 | using System; 5 | 6 | [CustomEditor(typeof(MainMenuCat))] 7 | public class MainMenuCatEditor : Editor 8 | { 9 | public CatType type = CatType.brown; 10 | public override void OnInspectorGUI() 11 | { 12 | 13 | DrawDefaultInspector(); 14 | MainMenuCat cat = (MainMenuCat)target; 15 | type = (CatType)EditorGUILayout.EnumPopup(type); 16 | if (GUILayout.Button("SET CAT")) 17 | { 18 | Cat newCat = new Cat(type); 19 | newCat.SetCat(cat.transform.GetChild(0)); 20 | } 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /Scripts/TeamSelector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using UnityEngine.Events; 6 | using TMPro; 7 | using System.Linq; 8 | 9 | 10 | public class TeamSelector : DeckCard 11 | { 12 | public ushort position; 13 | 14 | public void SetCatInTeam(Cat newCat) 15 | { 16 | GameControl.control.RemoveFromTeam(this.cat); 17 | GameControl.control.playerData.team.Insert(Mathf.Clamp(position, 0, GameControl.control.playerData.team.Count), newCat); 18 | GameControl.control.SavePlayerData(); 19 | this.cat = newCat; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Scripts/Editor/DetailCardEditor.cs: -------------------------------------------------------------------------------- 1 | 2 | using UnityEngine; 3 | using UnityEditor; 4 | using System; 5 | 6 | [CustomEditor(typeof(DetailCard))] 7 | public class DetailCardEditor : Editor 8 | { 9 | public CatType type = CatType.artist; 10 | public override void OnInspectorGUI() 11 | { 12 | 13 | DrawDefaultInspector(); 14 | DetailCard card = (DetailCard)target; 15 | type = (CatType)EditorGUILayout.EnumPopup(type); 16 | if (GUILayout.Button("SET DETAIL CARD")) 17 | { 18 | Cat cat = new Cat(type); 19 | 20 | card.setDetailCard(cat); 21 | card.transform.Find("about").localScale = Vector3.one; 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /Scripts/Serialization/SerializableHashSet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [System.Serializable] 6 | public class SerializableHashSet : HashSet, ISerializationCallbackReceiver 7 | { 8 | public List values = new List (); 9 | 10 | public void OnBeforeSerialize () 11 | { 12 | var cur = new HashSet (values); 13 | 14 | foreach (var val in this) { 15 | if (!cur.Contains (val)) { 16 | values.Add (val); 17 | } 18 | } 19 | } 20 | 21 | public void OnAfterDeserialize () 22 | { 23 | this.Clear (); 24 | 25 | foreach (var val in values) { 26 | this.Add (val); 27 | } 28 | } 29 | } 30 | 31 | [System.Serializable] 32 | public class PinHashSet : SerializableHashSet 33 | { 34 | } -------------------------------------------------------------------------------- /Scripts/FadeInOut.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class FadeInOut : MonoBehaviour 6 | { 7 | private void OnEnable() 8 | { 9 | CanvasGroup CG = GetComponent(); 10 | CG.blocksRaycasts = false; 11 | LeanTween.value(0, 1, 0.25f).setEaseInSine().setOnUpdate((float val) => 12 | { 13 | CG.alpha = val; 14 | }).setOnComplete(() => 15 | { 16 | CG.blocksRaycasts = true; 17 | }); 18 | } 19 | public void Close() 20 | { 21 | CanvasGroup CG = GetComponent(); 22 | CG.blocksRaycasts = false; 23 | LeanTween.value(1, 0, 0.15f).setEaseOutSine().setOnUpdate((float val) => 24 | { 25 | CG.alpha = val; 26 | }).setOnComplete(() => 27 | { 28 | transform.parent.gameObject.SetActive(false); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Scripts/Data/CatAsset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | 6 | public class CatAsset : ScriptableObject 7 | { 8 | //STRING STATS ------------------------------------------ 9 | 10 | public string defaultName; 11 | public string[] Abouts; 12 | public float pitch = 1; 13 | 14 | [Header("BATTLE")] 15 | public CatDynamicStats dynamicStats; 16 | public AttackType attackType; 17 | public SecondaryType secondaryType; 18 | public FactionType faction; 19 | public ActionType action; 20 | public ushort rarity; 21 | 22 | //SPRITES ------------------------------------------ 23 | [Header("SPRITES")] 24 | public Sprite head; 25 | public Sprite meow, body, foot, tail; 26 | public Sprite bg, bullet; 27 | 28 | //SHOP INFO ------------------------------------------ 29 | [Header("SHOP")] 30 | //from 3 to 10 31 | public ushort price; 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Scripts/CameraShake.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CameraShake : MonoBehaviour 6 | { 7 | 8 | public void Shake() 9 | { 10 | enabled = true; 11 | } 12 | 13 | // How long the object should shake for. 14 | private float shakeDuration = 0f; 15 | 16 | // Amplitude of the shake. A larger value shakes the camera harder. 17 | private float shakeAmount = 0.05f; 18 | private float decreaseFactor = 1.0f; 19 | 20 | 21 | void OnEnable() 22 | { 23 | shakeDuration = 0.18f; 24 | } 25 | 26 | void Update() 27 | { 28 | if (shakeDuration > 0) 29 | { 30 | transform.localPosition = Vector3.zero + Random.insideUnitSphere * shakeAmount; 31 | 32 | shakeDuration -= Time.deltaTime * decreaseFactor; 33 | } 34 | else 35 | { 36 | shakeDuration = 0f; 37 | transform.localPosition = Vector3.zero; 38 | enabled = false; 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /Scripts/Editor/ExploreCatEditor.cs: -------------------------------------------------------------------------------- 1 | 2 | using UnityEngine; 3 | using UnityEditor; 4 | using System; 5 | 6 | [CustomEditor(typeof(ExploreCat))] 7 | public class ExploreCatEditor : Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | 12 | DrawDefaultInspector(); 13 | ExploreCat cat = (ExploreCat)target; 14 | 15 | // type = (CatType)EditorGUILayout.EnumPopup(type); 16 | if (GUILayout.Button("LOVE PARTICLE")) 17 | { 18 | cat.loveParticles(); 19 | } 20 | if (GUILayout.Button("MAGIC PARTICLE")) 21 | { 22 | cat.Magic(); 23 | } 24 | if (GUILayout.Button("FADE")) 25 | { 26 | cat.FadeAndAvoidHit(); 27 | } 28 | if (GUILayout.Button("FLY")) 29 | { 30 | cat.FlyAndAvoidHit(); 31 | } 32 | if (GUILayout.Button("SET TEXTURE")) 33 | { 34 | cat.sideEffect = new SideEffect(Fx.Scared, SecondaryType.Arrow); 35 | cat.setEffect(); 36 | } 37 | 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /Scripts/Editor/ScriptableObjectUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.IO; 4 | 5 | public static class ScriptableObjectUtility 6 | { 7 | /// 8 | // This makes it easy to create, name and place unique new ScriptableObject asset files. 9 | /// 10 | public static void CreateAsset () where T : ScriptableObject 11 | { 12 | T asset = ScriptableObject.CreateInstance (); 13 | 14 | string path = AssetDatabase.GetAssetPath (Selection.activeObject); 15 | if (path == "") 16 | { 17 | path = "Assets"; 18 | } 19 | else if (Path.GetExtension (path) != "") 20 | { 21 | path = path.Replace (Path.GetFileName (AssetDatabase.GetAssetPath (Selection.activeObject)), ""); 22 | } 23 | 24 | string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath (path + "/New " + typeof(T).ToString() + ".asset"); 25 | 26 | AssetDatabase.CreateAsset (asset, assetPathAndName); 27 | 28 | AssetDatabase.SaveAssets (); 29 | AssetDatabase.Refresh(); 30 | EditorUtility.FocusProjectWindow (); 31 | Selection.activeObject = asset; 32 | } 33 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Angela He 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, and sublicense 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /Scripts/Explore/ResizeCamera.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class ResizeCamera : MonoBehaviour { 4 | 5 | public bool Map; 6 | void Start () { 7 | float TARGET_WIDTH =1820f; 8 | float TARGET_HEIGHT = 1080f; 9 | float PIXELS_TO_UNITS = Map ? 30 : 50; // 1:1 ratio of pixels to units 10 | 11 | float desiredRatio = TARGET_WIDTH / TARGET_HEIGHT; 12 | float currentRatio = (float)Screen.width/(float)Screen.height; 13 | 14 | if(currentRatio >= desiredRatio) 15 | { 16 | // Our resolution has plenty of width, so we just need to use the height to determine the camera size 17 | Camera.main.orthographicSize = TARGET_HEIGHT / 4 / PIXELS_TO_UNITS; 18 | } 19 | else 20 | { 21 | // Our camera needs to zoom out further than just fitting in the height of the image. 22 | // Determine how much bigger it needs to be, then apply that to our original algorithm. 23 | float differenceInSize = desiredRatio / currentRatio; 24 | Camera.main.orthographicSize = TARGET_HEIGHT / 4 / PIXELS_TO_UNITS * differenceInSize; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Scripts/Explore/CreditsCat.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System; 5 | 6 | public class CreditsCat : ExploreCatHolder 7 | { 8 | 9 | public void init() 10 | { 11 | Transform body = transform.GetChild(0); 12 | transform.localScale = Vector3.one * 0.8f; 13 | body.GetComponent().enableNoises = false; 14 | body.GetComponent().SetBool("walk", true); 15 | this.cat = new Cat(CatType.sleepy); 16 | cat.SetCat(transform.GetChild(0)); 17 | } 18 | 19 | public IEnumerator walkAcrossScreen() 20 | { 21 | Debug.Log("walk across screen!"); 22 | Vector3 targetPos = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.one).x + 1.5f, 2.15f, 0); 23 | Vector3 orig = transform.position; 24 | Debug.Log("target pos - " + targetPos); 25 | // 1.2f = speed 26 | float time = 15f; 27 | float curT = 0; 28 | while (curT < time) 29 | { 30 | curT += Time.deltaTime; 31 | transform.position = Vector2.Lerp(orig, targetPos, curT / time); 32 | yield return null; 33 | } 34 | Debug.Log("done walking!" + targetPos); 35 | yield return null; 36 | Destroy(gameObject); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Scripts/DynamicScaler.cs: -------------------------------------------------------------------------------- 1 | 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | using System.Collections.Generic; 5 | public class DynamicScaler : MonoBehaviour 6 | { 7 | public Canvas canvas; 8 | public Image bg; 9 | void Start() 10 | { 11 | if (Camera.main.aspect >= 2f) 12 | { 13 | string bgName = bg.sprite.name; 14 | Debug.Log("adjust bg "+bgName); 15 | HashSet dontScale = new HashSet(){ 16 | "computer0", 17 | "computer1" 18 | }; 19 | if (!dontScale.Contains(bgName)) 20 | { 21 | HashSet Scale15 = new HashSet(){ 22 | "house0", 23 | "house1", 24 | "fields0" 25 | }; 26 | if (Scale15.Contains(bgName)) 27 | { 28 | canvas.GetComponent().matchWidthOrHeight = 0.15f; 29 | bg.rectTransform.offsetMax = new Vector2(0, 60); 30 | } 31 | else 32 | { 33 | canvas.GetComponent().matchWidthOrHeight = 0.22f; 34 | } 35 | } 36 | //house 0, house1 : .15, top: -60 37 | } 38 | canvas.renderMode = RenderMode.WorldSpace; 39 | bg = null; 40 | canvas = null; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Scripts/About.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using System; 6 | 7 | public class About : MonoBehaviour 8 | { 9 | const string ABOUT_PREFAB_NAME = "miscPrefabs/About"; 10 | public void InstantiateAbout() 11 | { 12 | GameObject GO = GameObject.Instantiate(Resources.Load(ABOUT_PREFAB_NAME), transform.root, false); 13 | setUpUI(GO.GetComponent()); 14 | } 15 | void setUpUI(Image aboutBG) 16 | { 17 | if (UnityEngine.Random.value > 0.7f) 18 | { 19 | Sprite[] tiles = Resources.LoadAll("tiles"); 20 | aboutBG.sprite = tiles[UnityEngine.Random.Range(0, tiles.Length)]; 21 | //avoid transparent tiles 22 | while (aboutBG.sprite.name == "11" || aboutBG.sprite.name == "bearbunny" 23 | || aboutBG.sprite.name == "feather" || aboutBG.sprite.name == "leaf" 24 | || aboutBG.sprite.name == "leaf2" 25 | || aboutBG.sprite.name == "star4") 26 | { 27 | aboutBG.sprite = tiles[UnityEngine.Random.Range(0, tiles.Length)]; 28 | } 29 | } 30 | else 31 | { 32 | //because of none asset 33 | aboutBG.sprite = Resources.Load("CatAssets/" + ((CatType)(UnityEngine.Random.Range(0, Enum.GetNames(typeof(CatType)).Length - 1))).ToString()).bg; 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Scripts/CatLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | [Serializable] 7 | public class CatLevel 8 | { 9 | 10 | public const uint startingLevel = 1; 11 | public const uint maxLevel = 99; 12 | public uint level = startingLevel; 13 | 14 | public CatLevel() : this(startingLevel) { } 15 | public CatLevel(uint level) 16 | { 17 | this.level = (uint)Mathf.Clamp(level, startingLevel, maxLevel); 18 | } 19 | 20 | public float getPercentageToMaxLevel() 21 | { 22 | return ((float)(level - startingLevel)) / (maxLevel - startingLevel); 23 | } 24 | 25 | public bool canLevelUp() 26 | { 27 | if (level >= maxLevel) 28 | { 29 | return false; 30 | } 31 | return GameControl.control != null && GameControl.control.playerData.silver >= getNextLevelCost(); 32 | } 33 | 34 | public bool levelUp(Cat cat) 35 | { 36 | if (canLevelUp()) 37 | { 38 | GameControl.control.DecrementSilver(getNextLevelCost()); 39 | cat.catLvl = new CatLevel(level + 1); 40 | return true; 41 | } 42 | return false; 43 | } 44 | 45 | public uint getNextLevelCost() 46 | { 47 | return MathUtils.getCatLevelCost(level + 1); 48 | } 49 | 50 | 51 | public override string ToString() 52 | { 53 | return level.ToString(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Scripts/CatSetUp.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CatSetUp : MonoBehaviour 6 | { 7 | 8 | public MainMenuCat MainMenuCat; 9 | 10 | void Start() 11 | { 12 | if (GameControl.control.playerData == null || GameControl.control.playerData.deck.Count == 0) 13 | { 14 | //FTUE or sold all cats 15 | // MainMenuCat.gameObject.SetActive(false); 16 | return; 17 | } 18 | List cats = GameControl.control.playerData.deck; 19 | uint catLayer = 0; 20 | MainMenuCat.gameObject.SetActive(true); 21 | MainMenuCat.init(cats[0], new Vector3(UnityEngine.Random.Range(-7f, 7f), MainMenuCat.transform.position.y, 0), "Cat" + catLayer++); 22 | float step = 1; 23 | if (cats.Count > 5) 24 | { 25 | step = cats.Count / 5 - (cats.Count / 15); 26 | } 27 | for (float i = 1; i < cats.Count; i += step) 28 | { 29 | Cat cat = cats[(int)i]; 30 | 31 | if (UnityEngine.Random.value > 0.5f) 32 | { 33 | MainMenuCat MMCat = GameObject.Instantiate(MainMenuCat.gameObject, transform, false).GetComponent(); 34 | MMCat.init(cat, new Vector3(UnityEngine.Random.Range(-7f, 7f), MainMenuCat.transform.position.y, 0), "Cat" + catLayer); 35 | 36 | catLayer += 1; 37 | if (catLayer > 9) 38 | { 39 | return; 40 | } 41 | 42 | } 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Scripts/Shop/CatThoughts.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CatThoughts : MonoBehaviour 6 | { 7 | 8 | private void OnEnable() 9 | { 10 | string[] catThoughts = new string[]{ 11 | "Every cat is worth something.", 12 | "NOTICE:\nTaking good care of your pets is cool!", 13 | "Cats may not solve your problems,\nbut they might make it better", 14 | "Please do not leave items unattended.\n(They will be pushed)", 15 | "CAT FACT:\nAll you need is a cat. Or two. Or twenty.", 16 | "Do not disturb unless you have money or my box is on fire.", 17 | "A box is a luxurious bed.", 18 | "A lick a day keeps unkempt fur away.", 19 | "Cat Time TM", 20 | "Have a good day!", 21 | "How are mew today?", 22 | "Support your local cats!", 23 | "Non-GMO, organic cats!", 24 | "What's better than a cat shop?\nA cat cafe.", 25 | "First cats, then more cats, then the world.", 26 | "CAT FACT:\nPurring can relieve stress!", 27 | "CAT FACT:\nWe love nice hoomans :p", 28 | "BREAKING NEWS:\nHoomans are big clumsy kittens.", 29 | "May your cats be strong and yourself be cute.", 30 | // todo 31 | }; 32 | GameControl.GetTextBox(transform, "text").text = catThoughts[UnityEngine.Random.Range(0, catThoughts.Length)]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Scripts/Data/StageAsset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | [System.Serializable] 5 | public struct Dialogue 6 | { 7 | public CatType speaker; 8 | public bool meow; 9 | public string[] dialogue; 10 | public Dialogue(CatType speaker, bool meow, string[] dialogue) 11 | { 12 | this.speaker = speaker; 13 | this.meow = meow; 14 | this.dialogue = dialogue; 15 | } 16 | } 17 | [System.Serializable] 18 | public struct ActionResponse 19 | { 20 | public ActionType action; 21 | public Dialogue[] response; 22 | //if not accepted, just provides hint; else, can end stage in victory without fighting. pacifist 23 | public bool accepted; 24 | } 25 | [System.Serializable] 26 | public struct rewardPrompt 27 | { 28 | public string prompt; 29 | //if reward.Length == 1, yes no prompt; else, options prompt with an ability to choose 'none' 30 | public CatType[] rewards; 31 | } 32 | public class StageAsset : ScriptableObject 33 | { 34 | [Header("COMBAT-------------------------------------")] 35 | public Sprite background; 36 | public CatType[] enemyCats; 37 | [Header("RESPONSES---------------------------------------")] 38 | public ActionResponse[] Responses; 39 | [Header("REWARDS---------------------------------------")] 40 | public uint silver = 0; 41 | public uint gold = 0; 42 | public CatType rewardCat; 43 | [Header("UNLOCK")] 44 | public CatType[] unlockCats; 45 | [Header("STORY--")] 46 | public Dialogue[] beforeDialogues; 47 | public Dialogue[] afterDialogues; 48 | public rewardPrompt rewardPrompt; 49 | 50 | 51 | 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Scripts/Explore/ExploreNotif.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System; 5 | using TMPro; 6 | public class ExploreNotif : MonoBehaviour 7 | { 8 | private string[] dialogues = null; 9 | private Action onComplete; 10 | private int currIndex = 0; 11 | public CanvasGroup canvasGroup; 12 | public TextMeshProUGUI text; 13 | public void InitNotify(string[] dialogues, Action onComplete) 14 | { 15 | this.onComplete = onComplete; 16 | if (dialogues == null || dialogues.Length == 0) 17 | { 18 | End(); 19 | return; 20 | } 21 | this.dialogues = dialogues; 22 | LeanTween.value(0, 1, 0.15f).setEaseInQuad().setOnUpdate((float val) => 23 | { 24 | canvasGroup.alpha = val; 25 | }); 26 | Continue(); 27 | } 28 | public void Continue() 29 | { 30 | if (dialogues.Length <= currIndex) 31 | { 32 | End(); 33 | return; 34 | } 35 | //if not inited / user gave input 36 | if (currIndex > 0) 37 | { 38 | GameControl.control.getSoundManager().playSoftButton(); 39 | } 40 | text.text = dialogues[currIndex++]; 41 | } 42 | private void End() 43 | { 44 | canvasGroup.blocksRaycasts = false; 45 | LeanTween.value(1, 0, 0.2f).setEaseInQuad().setOnUpdate((float val) => 46 | { 47 | canvasGroup.alpha = val; 48 | }).setOnComplete(() => 49 | { 50 | if (onComplete != null) 51 | { 52 | onComplete(); 53 | } 54 | Destroy(gameObject); 55 | }); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Scripts/DeckCard.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | using UnityEngine.UI; 4 | using TMPro; 5 | public class DeckCard : MonoBehaviour 6 | { 7 | 8 | public Cat cat; 9 | 10 | public void setName() 11 | { 12 | GameControl.GetTextBox(transform, "name").SetText(cat.Name); 13 | } 14 | 15 | public void setLvl() 16 | { 17 | transform.Find("lvlBG").GetChild(0).GetComponent().text = cat.catLvl.level.ToString(); 18 | } 19 | 20 | public void setDeckCard(Cat cat, TextMeshProUGUI rarity) 21 | { 22 | this.cat = cat; 23 | setName(); 24 | transform.GetChild(0).GetComponent().sprite = cat.getCatAsset().head; 25 | rarity.SetText(GameControl.GenerateStarText(cat.getCatAsset().rarity, false)); 26 | setLvl(); 27 | } 28 | 29 | 30 | public void setPurchaseDeckCard(Cat cat, TextMeshProUGUI rarity) 31 | { 32 | this.cat = cat; 33 | transform.GetChild(0).GetComponent().sprite = cat.getCatAsset().head; 34 | rarity.SetText(GameControl.GenerateStarText(cat.getCatAsset().rarity, false)); 35 | setLvl(); 36 | TextMeshProUGUI name = GameControl.GetTextBox(transform, "name"); 37 | name.fontSizeMax = 105; 38 | name.text = ""+CatIAP.goldStr+cat.getCatAsset().price.ToString(); 39 | name.color= new Color32(255,81,93,255); 40 | name.rectTransform.offsetMax = new Vector2(-70, name.rectTransform.offsetMax.y); 41 | } 42 | 43 | public void setListener(UnityAction UA) 44 | { 45 | Button b = transform.GetComponent