From 92a4999b1c451addc225ac913cb3230e57074034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Tue, 24 Oct 2023 01:40:41 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9C=A0=EB=8B=9B=20=EC=A0=84=ED=88=AC=2050%?= =?UTF-8?q?=20=EC=9E=91=EC=97=85=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client/Assets/1_Script/Info/BuildingInfo.cs | 2 +- Client/Assets/1_Script/Info/SummonsUnit.cs | 50 ++++++ .../Assets/1_Script/Info/SummonsUnit.cs.meta | 11 ++ Client/Assets/1_Script/Info/UnitCtrl.cs | 47 ++++- Client/Assets/1_Script/PlayCtrl.cs | 23 ++- .../3_Prefab/champion Mushroom 0048.prefab | 160 +++++++++++++++++- .../BurstAotSettings_Android.json | 17 ++ .../BurstAotSettings_StandaloneWindows.json | 18 ++ .../CommonBurstAotSettings.json | 6 + Client/ProjectSettings/TimelineSettings.asset | 16 ++ 10 files changed, 333 insertions(+), 17 deletions(-) create mode 100644 Client/Assets/1_Script/Info/SummonsUnit.cs create mode 100644 Client/Assets/1_Script/Info/SummonsUnit.cs.meta create mode 100644 Client/ProjectSettings/BurstAotSettings_Android.json create mode 100644 Client/ProjectSettings/BurstAotSettings_StandaloneWindows.json create mode 100644 Client/ProjectSettings/CommonBurstAotSettings.json create mode 100644 Client/ProjectSettings/TimelineSettings.asset diff --git a/Client/Assets/1_Script/Info/BuildingInfo.cs b/Client/Assets/1_Script/Info/BuildingInfo.cs index 6e9fb561..46f982a9 100644 --- a/Client/Assets/1_Script/Info/BuildingInfo.cs +++ b/Client/Assets/1_Script/Info/BuildingInfo.cs @@ -4,5 +4,5 @@ using UnityEngine; public class BuildingInfo { - List units; + public List units; } diff --git a/Client/Assets/1_Script/Info/SummonsUnit.cs b/Client/Assets/1_Script/Info/SummonsUnit.cs new file mode 100644 index 00000000..399f6e33 --- /dev/null +++ b/Client/Assets/1_Script/Info/SummonsUnit.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SummonsUnit : MonoBehaviour +{ + public bool isEnemy; + public List buildings; + + private void Awake() + { + buildings = new List(); + + buildings.Add(new BuildingInfo()); + buildings.Add(new BuildingInfo()); + buildings.Add(new BuildingInfo()); + buildings.Add(new BuildingInfo()); + buildings.Add(new BuildingInfo()); + } + public UnitCtrl unit; + private void Start() + { + if (isEnemy) + PlayCtrl.Instance.enemy = this; + else + PlayCtrl.Instance.player = this; + + //Å×½ºÆ®¿ë + List units = new List(); + for (int m = 0; m < 5; m++) + { + units.Add(PlayCtrl.Instance.unit.GetComponent()); + } + buildings[0].units = units; + } + + public void Summons(int count) + { + BuildingInfo buildingInfo = buildings[count]; + int listCount = buildingInfo.units.Count; + for (int n = 0; n < listCount; n++) + { + if (isEnemy) //Àû¼Òȯ + Instantiate(buildingInfo.units[n].gameObject, new Vector3(Random.Range(44.0f, 46.0f), Random.Range(-5.0f, 0.0f), 0), Quaternion.identity).GetComponent().isEnemy = isEnemy; + else //¾Æ±º À¯´Ö ¼Òȯ + Instantiate(buildingInfo.units[n].gameObject, new Vector3(Random.Range(-44.0f, -46.0f), Random.Range(-5.0f, 0.0f), 0), Quaternion.identity).GetComponent().isEnemy = isEnemy; + + } + } +} diff --git a/Client/Assets/1_Script/Info/SummonsUnit.cs.meta b/Client/Assets/1_Script/Info/SummonsUnit.cs.meta new file mode 100644 index 00000000..06b5e136 --- /dev/null +++ b/Client/Assets/1_Script/Info/SummonsUnit.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cafe624fe74cb1b4c9c85fb6325c9c87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/1_Script/Info/UnitCtrl.cs b/Client/Assets/1_Script/Info/UnitCtrl.cs index 954741f3..dc62a83b 100644 --- a/Client/Assets/1_Script/Info/UnitCtrl.cs +++ b/Client/Assets/1_Script/Info/UnitCtrl.cs @@ -1,16 +1,61 @@ using System.Collections; using System.Collections.Generic; +using Unity.VisualScripting; using UnityEngine; public class UnitCtrl : MonoBehaviour { public UnitInfo unit; public Animator anim; + public GameObject defensObj; + bool isAttack; public bool isEnemy; + private void Start() + { + if(isEnemy) + defensObj.tag = "enemy"; + else + defensObj.tag = "player"; + } private void Update() { - transform.position += Vector3.left * unit.moveSpeed * Time.deltaTime * (isEnemy ? 1 : -1); + if (isAttack) + { + anim.SetTrigger("att"); + } + else + { + transform.position += Vector3.left * unit.moveSpeed * Time.deltaTime * (isEnemy ? 1 : -1); + } + } + private void OnTriggerEnter2D(Collider2D collision) + { + if (isEnemy) + { + if (collision.gameObject.CompareTag("player")) + { + Debug.Log("Ãæµ¹"); + isAttack = true; + } + } + else + { + if (collision.gameObject.CompareTag("enemy")) + { + Debug.Log("Ãæµ¹"); + isAttack = true; + } + } + } + + //private void OnTriggerExit2D(Collider2D collision) + //{ + // Debug.Log("Ãæµ¹Á¾·á"); + // isAttack = false; + //} + + } diff --git a/Client/Assets/1_Script/PlayCtrl.cs b/Client/Assets/1_Script/PlayCtrl.cs index 5dfc56f8..3edfa253 100644 --- a/Client/Assets/1_Script/PlayCtrl.cs +++ b/Client/Assets/1_Script/PlayCtrl.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -public class PlayCtrl : MonoBehaviour +public class PlayCtrl : SingletonMonoBehaviour { public GameObject camera; public float speed; @@ -16,9 +16,11 @@ public class PlayCtrl : MonoBehaviour public GameObject unit; - private void Awake() + public SummonsUnit player; + public SummonsUnit enemy; + + protected override void OnAwake() { - //ÃʱâÈ­ summons = 0.1f; slider.value = 0; } @@ -36,7 +38,7 @@ public class PlayCtrl : MonoBehaviour { float deltaTime = Time.deltaTime; camera.transform.position += Vector3.left * speed * deltaTime * move; - if(camera.transform.position.x < -40) + if (camera.transform.position.x < -40) { camera.transform.position = new Vector3(-40, 0, -10); } @@ -45,19 +47,16 @@ public class PlayCtrl : MonoBehaviour camera.transform.position = new Vector3(40, 0, -10); } slider.value += Time.deltaTime / 30; - if(slider.value >= 1) + if (slider.value >= 1) { slider.value -= 1; summons = 0.1f; } - if(summons < slider.value) + if (summons < slider.value) { - Debug.Log("¼Òȯ"); - Instantiate(unit, new Vector3(Random.Range(-44.0f,-46.0f), Random.Range(-5.0f,0.0f), 0), Quaternion.identity); - Instantiate(unit, new Vector3(Random.Range(-44.0f,-46.0f), Random.Range(-5.0f,0.0f), 0), Quaternion.identity); - Instantiate(unit, new Vector3(Random.Range(-44.0f,-46.0f), Random.Range(-5.0f,0.0f), 0), Quaternion.identity); - Instantiate(unit, new Vector3(Random.Range(-44.0f,-46.0f), Random.Range(-5.0f,0.0f), 0), Quaternion.identity); - Instantiate(unit, new Vector3(Random.Range(-44.0f,-46.0f), Random.Range(-5.0f,0.0f), 0), Quaternion.identity); + int count = (int)(summons / 0.2); + player.Summons(count); + enemy.Summons(count); summons += 0.2f; } diff --git a/Client/Assets/3_Prefab/champion Mushroom 0048.prefab b/Client/Assets/3_Prefab/champion Mushroom 0048.prefab index 78252861..3ee8f8e3 100644 --- a/Client/Assets/3_Prefab/champion Mushroom 0048.prefab +++ b/Client/Assets/3_Prefab/champion Mushroom 0048.prefab @@ -191,9 +191,11 @@ GameObject: m_Component: - component: {fileID: 4669062451464906} - component: {fileID: 3138165653453361519} - m_Layer: 0 + - component: {fileID: 633896494163313035} + - component: {fileID: 924228214329906313} + m_Layer: 7 m_Name: champion Mushroom 0048 - m_TagString: Untagged + m_TagString: GameController m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -212,6 +214,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4917161157123006} + - {fileID: 1602317403802003956} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &3138165653453361519 @@ -231,8 +234,82 @@ MonoBehaviour: hp: 100 attack: 30 defense: 10 - moveSpeed: 1 + moveSpeed: 3 anim: {fileID: 95599084440857112} + defensObj: {fileID: 8888950729539466495} + isEnemy: 0 +--- !u!61 &633896494163313035 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1056691736844118} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 650} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1500, y: 1300} + m_EdgeRadius: 0 +--- !u!50 &924228214329906313 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1056691736844118} + m_BodyType: 1 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 --- !u!1 &1062490047755888 GameObject: m_ObjectHideFlags: 0 @@ -2490,3 +2567,80 @@ Transform: - {fileID: 4835441770178698} m_Father: {fileID: 4849431348176380} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8888950729539466495 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1602317403802003956} + - component: {fileID: 3180685837361523623} + m_Layer: 0 + m_Name: defens + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1602317403802003956 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8888950729539466495} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4669062451464906} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!61 &3180685837361523623 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8888950729539466495} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 600} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 700, y: 1200} + m_EdgeRadius: 0 diff --git a/Client/ProjectSettings/BurstAotSettings_Android.json b/Client/ProjectSettings/BurstAotSettings_Android.json new file mode 100644 index 00000000..ce2d8aa9 --- /dev/null +++ b/Client/ProjectSettings/BurstAotSettings_Android.json @@ -0,0 +1,17 @@ +{ + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "DebugDataKind": 1, + "EnableArmv9SecurityFeatures": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsArm64": 512, + "OptimizeFor": 0 + } +} diff --git a/Client/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/Client/ProjectSettings/BurstAotSettings_StandaloneWindows.json new file mode 100644 index 00000000..58cf25f2 --- /dev/null +++ b/Client/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -0,0 +1,18 @@ +{ + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "DebugDataKind": 1, + "EnableArmv9SecurityFeatures": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsX32": 6, + "CpuTargetsX64": 72, + "OptimizeFor": 0 + } +} diff --git a/Client/ProjectSettings/CommonBurstAotSettings.json b/Client/ProjectSettings/CommonBurstAotSettings.json new file mode 100644 index 00000000..0293dafc --- /dev/null +++ b/Client/ProjectSettings/CommonBurstAotSettings.json @@ -0,0 +1,6 @@ +{ + "MonoBehaviour": { + "Version": 4, + "DisabledWarnings": "" + } +} diff --git a/Client/ProjectSettings/TimelineSettings.asset b/Client/ProjectSettings/TimelineSettings.asset new file mode 100644 index 00000000..b21943ab --- /dev/null +++ b/Client/ProjectSettings/TimelineSettings.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 53 + 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: a287be6c49135cd4f9b2b8666c39d999, type: 3} + m_Name: + m_EditorClassIdentifier: + assetDefaultFramerate: 60 + m_DefaultFrameRate: 60