party (#15)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			Resolves #6. Updates #3. Co-authored-by: Branden J Brown <zephyrtronium@gmail.com> Reviewed-on: #15 Reviewed-by: madxmike <madxmike@noreply.localhost>
This commit is contained in:
		
							
								
								
									
										13
									
								
								Assets/Prefabs/Hero.prefab
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13
									
								
								Assets/Prefabs/Hero.prefab
									
									
									
										generated
									
									
									
								
							| @@ -31,7 +31,7 @@ Transform: | ||||
|   m_Children: | ||||
|   - {fileID: 4157508313357080045} | ||||
|   m_Father: {fileID: 0} | ||||
|   m_RootOrder: 2 | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!114 &7347972816793018538 | ||||
| MonoBehaviour: | ||||
| @@ -45,11 +45,12 @@ MonoBehaviour: | ||||
|   m_Script: {fileID: 11500000, guid: 583304b24f3e6394f9e4d49747e22193, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   Name:  | ||||
|   Class: {fileID: 0} | ||||
|   Level: 0 | ||||
|   XP: 0 | ||||
|   Attrs: {fileID: 0} | ||||
|   name:  | ||||
|   class_: {fileID: 0} | ||||
|   level: 0 | ||||
|   xp: 0 | ||||
|   attrs: {fileID: 0} | ||||
|   _party: {fileID: 11400000, guid: c9a46588e6ec04d4d91bb80fdffd7869, type: 2} | ||||
| --- !u!1 &4632618406133265053 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   | ||||
							
								
								
									
										15
									
								
								Assets/Scriptables/HeroParty.asset
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Assets/Scriptables/HeroParty.asset
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!114 &11400000 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 0} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: f0603cf6e7f1d884e89c3eb6a478a96c, type: 3} | ||||
|   m_Name: HeroParty | ||||
|   m_EditorClassIdentifier:  | ||||
|   unitList: [] | ||||
							
								
								
									
										8
									
								
								Assets/Scriptables/HeroParty.asset.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scriptables/HeroParty.asset.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: c9a46588e6ec04d4d91bb80fdffd7869 | ||||
| NativeFormatImporter: | ||||
|   externalObjects: {} | ||||
|   mainObjectFileID: 11400000 | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										16
									
								
								Assets/Scripts/HeroPartySO.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Assets/Scripts/HeroPartySO.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.ObjectModel; | ||||
| using UnityEngine; | ||||
| 
 | ||||
| [CreateAssetMenu(fileName = "HeroParty", menuName = "Hero Party")] | ||||
| public class HeroPartySO : ScriptableObject | ||||
| { | ||||
|     [SerializeField] | ||||
|     private List<HeroUnit> unitList = new List<HeroUnit>(); | ||||
|     public ReadOnlyCollection<HeroUnit> UnitList => unitList.AsReadOnly(); | ||||
| 
 | ||||
|     public void Add(HeroUnit unit) { unitList.Add(unit); } | ||||
|     public void Remove(HeroUnit unit) { unitList.Remove(unit); } | ||||
|     public int Count => unitList.Count; | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/HeroPartySO.cs.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/HeroPartySO.cs.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: f0603cf6e7f1d884e89c3eb6a478a96c | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -1,6 +1,10 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.Assertions; | ||||
| 
 | ||||
| using System.Runtime.CompilerServices; | ||||
| [assembly: InternalsVisibleTo("TestsPlaymode")] | ||||
| 
 | ||||
| /// <summary> | ||||
| /// Component that makes a duder a duder. | ||||
| @@ -13,4 +17,17 @@ public class HeroUnit : MonoBehaviour | ||||
|     [SerializeField] private long level; | ||||
|     [SerializeField] private long xp; | ||||
|     [SerializeField] private HeroAttributesSO attrs; | ||||
|     [SerializeField] private HeroPartySO _party; | ||||
|     internal HeroPartySO party => _party; | ||||
| 
 | ||||
|     private void OnEnable() | ||||
|     { | ||||
|         Assert.IsNotNull(_party); | ||||
|         _party.Add(this); | ||||
|     } | ||||
| 
 | ||||
|     private void OnDisable() | ||||
|     { | ||||
|         _party.Remove(this); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										8
									
								
								Assets/TestsPlaymode.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/TestsPlaymode.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 761a28b9566afe848955bfe8200ff125 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										23
									
								
								Assets/TestsPlaymode/HeroPartyTest.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Assets/TestsPlaymode/HeroPartyTest.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using NUnit.Framework; | ||||
| using UnityEditor; | ||||
| using UnityEngine; | ||||
| using UnityEngine.TestTools; | ||||
| 
 | ||||
| public class HeroPartyTest | ||||
| { | ||||
|     [UnityTest] | ||||
|     public IEnumerator HeroPartyGetsAllTheHeroes() | ||||
|     { | ||||
|         var prefab = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Prefabs/Hero.prefab"); | ||||
|         Assert.IsNotNull(prefab); | ||||
|         var instance = Object.Instantiate(prefab); | ||||
|         var hero = instance.GetComponent<HeroUnit>(); | ||||
|         yield return null; | ||||
|         Assert.AreEqual(1, hero.party.Count); | ||||
|         Object.Destroy(instance); | ||||
|         yield return null; | ||||
|         Assert.IsEmpty(hero.party.UnitList); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/TestsPlaymode/HeroPartyTest.cs.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/TestsPlaymode/HeroPartyTest.cs.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 12e575ff764956245a428c77cced4e48 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										22
									
								
								Assets/TestsPlaymode/TestsPlaymode.asmdef
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								Assets/TestsPlaymode/TestsPlaymode.asmdef
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| { | ||||
|     "name": "TestsPlaymode", | ||||
|     "rootNamespace": "", | ||||
|     "references": [ | ||||
|         "UnityEngine.TestRunner", | ||||
|         "UnityEditor.TestRunner", | ||||
|         "IdleSurvivors" | ||||
|     ], | ||||
|     "includePlatforms": [], | ||||
|     "excludePlatforms": [], | ||||
|     "allowUnsafeCode": false, | ||||
|     "overrideReferences": true, | ||||
|     "precompiledReferences": [ | ||||
|         "nunit.framework.dll" | ||||
|     ], | ||||
|     "autoReferenced": false, | ||||
|     "defineConstraints": [ | ||||
|         "UNITY_INCLUDE_TESTS" | ||||
|     ], | ||||
|     "versionDefines": [], | ||||
|     "noEngineReferences": false | ||||
| } | ||||
							
								
								
									
										7
									
								
								Assets/TestsPlaymode/TestsPlaymode.asmdef.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Assets/TestsPlaymode/TestsPlaymode.asmdef.meta
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: da0ac170c269d9342b202cf3000da737 | ||||
| AssemblyDefinitionImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										121
									
								
								ProjectSettings/SceneTemplateSettings.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								ProjectSettings/SceneTemplateSettings.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,121 @@ | ||||
| { | ||||
|     "templatePinStates": [], | ||||
|     "dependencyTypeInfos": [ | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.AnimationClip", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEditor.Animations.AnimatorController", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.AnimatorOverrideController", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEditor.Audio.AudioMixerController", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.ComputeShader", | ||||
|             "defaultInstantiationMode": 1 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Cubemap", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.GameObject", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEditor.LightingDataAsset", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.LightingSettings", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Material", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEditor.MonoScript", | ||||
|             "defaultInstantiationMode": 1 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.PhysicMaterial", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.PhysicsMaterial2D", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Rendering.VolumeProfile", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEditor.SceneAsset", | ||||
|             "defaultInstantiationMode": 1 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Shader", | ||||
|             "defaultInstantiationMode": 1 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.ShaderVariantCollection", | ||||
|             "defaultInstantiationMode": 1 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Texture", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Texture2D", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         }, | ||||
|         { | ||||
|             "userAdded": false, | ||||
|             "type": "UnityEngine.Timeline.TimelineAsset", | ||||
|             "defaultInstantiationMode": 0 | ||||
|         } | ||||
|     ], | ||||
|     "defaultDependencyTypeInfo": { | ||||
|         "userAdded": false, | ||||
|         "type": "<default_scene_template_dependencies>", | ||||
|         "defaultInstantiationMode": 1 | ||||
|     }, | ||||
|     "newSceneOverride": 0 | ||||
| } | ||||
		Reference in New Issue
	
	Block a user