From cfca46e063b63f9ba2a3793799c92edf03f3e545 Mon Sep 17 00:00:00 2001 From: trananh Date: Tue, 5 Jul 2022 22:26:47 +0700 Subject: [PATCH 1/4] commit --- .../.idea.spellcasters/.idea/indexLayout.xml | 8 + .../.idea/projectSettingsUpdater.xml | 6 + .idea/.idea.spellcasters/.idea/vcs.xml | 6 + .idea/.idea.spellcasters/.idea/workspace.xml | 118 ++++++++++++++ Assets/Prefab.meta | 8 + Assets/Prefab/bullet_105.prefab | 150 ++++++++++++++++++ Assets/Prefab/bullet_105.prefab.meta | 7 + Assets/Scenes/Prototype.unity | 59 ++++++- Assets/Scripts/BasePlayerController.cs | 19 +++ Assets/Scripts/BasePlayerController.cs.meta | 11 ++ Assets/Scripts/BaseProjectileSpell.cs | 46 ++++++ Assets/Scripts/BaseProjectileSpell.cs.meta | 11 ++ Assets/Scripts/FluxShot.cs | 26 +++ Assets/Scripts/FluxShot.cs.meta | 11 ++ Assets/Scripts/FluxShotBullet.cs | 30 ++++ Assets/Scripts/FluxShotBullet.cs.meta | 11 ++ Assets/Scripts/IDamageable.cs | 12 ++ Assets/Scripts/IDamageable.cs.meta | 11 ++ Assets/Scripts/Player.cs | 4 +- Assets/Scripts/ShootingSkill.cs | 14 ++ Assets/Scripts/ShootingSkill.cs.meta | 11 ++ Assets/Sprites/GameEntities.meta | 8 + Assets/Sprites/GameEntities/bullet_105.png | 3 + .../Sprites/GameEntities/bullet_105.png.meta | 134 ++++++++++++++++ Packages/manifest.json | 2 +- Packages/packages-lock.json | 16 +- ProjectSettings/ProjectSettings.asset | 95 ++++++++++- ProjectSettings/ProjectVersion.txt | 4 +- 28 files changed, 826 insertions(+), 15 deletions(-) create mode 100644 .idea/.idea.spellcasters/.idea/indexLayout.xml create mode 100644 .idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml create mode 100644 .idea/.idea.spellcasters/.idea/vcs.xml create mode 100644 .idea/.idea.spellcasters/.idea/workspace.xml create mode 100644 Assets/Prefab.meta create mode 100644 Assets/Prefab/bullet_105.prefab create mode 100644 Assets/Prefab/bullet_105.prefab.meta create mode 100644 Assets/Scripts/BasePlayerController.cs create mode 100644 Assets/Scripts/BasePlayerController.cs.meta create mode 100644 Assets/Scripts/BaseProjectileSpell.cs create mode 100644 Assets/Scripts/BaseProjectileSpell.cs.meta create mode 100644 Assets/Scripts/FluxShot.cs create mode 100644 Assets/Scripts/FluxShot.cs.meta create mode 100644 Assets/Scripts/FluxShotBullet.cs create mode 100644 Assets/Scripts/FluxShotBullet.cs.meta create mode 100644 Assets/Scripts/IDamageable.cs create mode 100644 Assets/Scripts/IDamageable.cs.meta create mode 100644 Assets/Scripts/ShootingSkill.cs create mode 100644 Assets/Scripts/ShootingSkill.cs.meta create mode 100644 Assets/Sprites/GameEntities.meta create mode 100644 Assets/Sprites/GameEntities/bullet_105.png create mode 100644 Assets/Sprites/GameEntities/bullet_105.png.meta diff --git a/.idea/.idea.spellcasters/.idea/indexLayout.xml b/.idea/.idea.spellcasters/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.spellcasters/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml b/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/vcs.xml b/.idea/.idea.spellcasters/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.spellcasters/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/workspace.xml b/.idea/.idea.spellcasters/.idea/workspace.xml new file mode 100644 index 0000000..7f0b20d --- /dev/null +++ b/.idea/.idea.spellcasters/.idea/workspace.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1656954059094 + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/Prefab.meta b/Assets/Prefab.meta new file mode 100644 index 0000000..2ffd895 --- /dev/null +++ b/Assets/Prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c7b758c5b931f7d48a81f99030584cd6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/bullet_105.prefab b/Assets/Prefab/bullet_105.prefab new file mode 100644 index 0000000..ad7f79e --- /dev/null +++ b/Assets/Prefab/bullet_105.prefab @@ -0,0 +1,150 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1321403650375130719 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1803406985377751684} + - component: {fileID: 728066807453616797} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1803406985377751684 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1321403650375130719} + 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: 1619133627816819449} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!70 &728066807453616797 +CapsuleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1321403650375130719} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_Size: {x: 0.0001, y: 0.0001} + m_Direction: 1 +--- !u!1 &8442789017307878925 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1619133627816819449} + - component: {fileID: 1882434149266867794} + - component: {fileID: 4137173044849846708} + m_Layer: 0 + m_Name: bullet_105 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1619133627816819449 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8442789017307878925} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -3.81, y: -0.47, z: 0} + m_LocalScale: {x: 5, y: 5, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1803406985377751684} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1882434149266867794 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8442789017307878925} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 5b268c7d143ff8c4e92d14e58ec06183, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.34, y: 0.14} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &4137173044849846708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8442789017307878925} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84d4afd561852c74f8383ca7651b8f4b, type: 3} + m_Name: + m_EditorClassIdentifier: + damage: 0 + rigidBody2D: {fileID: 0} diff --git a/Assets/Prefab/bullet_105.prefab.meta b/Assets/Prefab/bullet_105.prefab.meta new file mode 100644 index 0000000..1dd5fad --- /dev/null +++ b/Assets/Prefab/bullet_105.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d08590ee691649042b4c72240f8fec7a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Prototype.unity b/Assets/Scenes/Prototype.unity index 1dc5ece..e5e87dc 100644 --- a/Assets/Scenes/Prototype.unity +++ b/Assets/Scenes/Prototype.unity @@ -417,7 +417,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: -1 m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -696,3 +696,60 @@ Rigidbody2D: m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 +--- !u!1001 &7858754246842062965 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalPosition.x + value: -3.81 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalPosition.y + value: -0.47 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1619133627816819449, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8442789017307878925, guid: d08590ee691649042b4c72240f8fec7a, type: 3} + propertyPath: m_Name + value: bullet_105 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d08590ee691649042b4c72240f8fec7a, type: 3} diff --git a/Assets/Scripts/BasePlayerController.cs b/Assets/Scripts/BasePlayerController.cs new file mode 100644 index 0000000..b726b1b --- /dev/null +++ b/Assets/Scripts/BasePlayerController.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class BasePlayerController : MonoBehaviour, IDamageable +{ + + public float Health { get; set; } + public float Energy { get; set; } + + private float _healthProperty; + private float _energyProperty; + + public void TakeDamage(DamageData data) + { + var resutDamage = data.Damage; + _healthProperty -= resutDamage; + } +} diff --git a/Assets/Scripts/BasePlayerController.cs.meta b/Assets/Scripts/BasePlayerController.cs.meta new file mode 100644 index 0000000..89e8259 --- /dev/null +++ b/Assets/Scripts/BasePlayerController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9cca0ffd3ea23b24ba9a7a4a62df5ee0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BaseProjectileSpell.cs b/Assets/Scripts/BaseProjectileSpell.cs new file mode 100644 index 0000000..0f4f79c --- /dev/null +++ b/Assets/Scripts/BaseProjectileSpell.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class BaseProjectileSpell : MonoBehaviour +{ + [SerializeField] protected float damage; + [SerializeField] protected Collision2D spellCollider; + [SerializeField] protected Rigidbody2D rigidBody2D; + + private Vector2 _screenPosition; + + private Vector3 _worldPosition; + + protected void Update() + { + if (Input.GetMouseButtonDown(0)) + { + Vector3 mousePos = Input.mousePosition; + _screenPosition = new Vector2(mousePos.x, mousePos.y); + } + + _worldPosition = Camera.main.ScreenToWorldPoint(_screenPosition); + } + + protected virtual void DamageTarget(Collision2D other) { } + + protected virtual void OnCollisionEnter2D(Collision2D other) + { + DamageTarget(other); + } + + protected virtual void Shoot(Quaternion angle, float speed, ForceMode2D forceMode2D = ForceMode2D.Impulse) + { + transform.rotation = angle; + rigidBody2D.SetRotation(angle); + rigidBody2D.AddRelativeForce(Vector2.up * speed, forceMode2D); + + } + + protected virtual void DeSpawn() + { + Destroy(this.gameObject); + } +} \ No newline at end of file diff --git a/Assets/Scripts/BaseProjectileSpell.cs.meta b/Assets/Scripts/BaseProjectileSpell.cs.meta new file mode 100644 index 0000000..d56d1c4 --- /dev/null +++ b/Assets/Scripts/BaseProjectileSpell.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76a476f1f3d2f2c44b6c74c303169ef9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FluxShot.cs b/Assets/Scripts/FluxShot.cs new file mode 100644 index 0000000..370d2a8 --- /dev/null +++ b/Assets/Scripts/FluxShot.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; + +public class FluxShot : ShootingSkill +{ + [SerializeField] protected BaseProjectileSpell prefabSpell; + [SerializeField] protected Transform shootPoint; + [SerializeField] protected float speed = 400f; + + private BaseProjectileSpell _bullet; + + private void Update() + { + if (Input.GetMouseButtonDown(0)) + { + Shoot(); + } + } + + public override void Shoot() + { + _bullet = SpawnProjectile(prefabSpell, shootPoint.position); + } +} \ No newline at end of file diff --git a/Assets/Scripts/FluxShot.cs.meta b/Assets/Scripts/FluxShot.cs.meta new file mode 100644 index 0000000..2b056a7 --- /dev/null +++ b/Assets/Scripts/FluxShot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0936fa5babff5e84988bae9309cae705 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FluxShotBullet.cs b/Assets/Scripts/FluxShotBullet.cs new file mode 100644 index 0000000..9ea86b4 --- /dev/null +++ b/Assets/Scripts/FluxShotBullet.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class FluxShotBullet : BaseProjectileSpell +{ + private void Update() + { + Shoot(transform.rotation, 40f, ForceMode2D.Force); + } + protected override void DamageTarget(Collision2D other) + { + var damageable = other.gameObject.GetComponent(); + if (damageable != null) + { + damageable.TakeDamage(new DamageData + { + Damage = damage, + ImpactObject = gameObject + }); + DeSpawn(); + } + else + { + //collide with wall + DeSpawn(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/FluxShotBullet.cs.meta b/Assets/Scripts/FluxShotBullet.cs.meta new file mode 100644 index 0000000..a84b0a9 --- /dev/null +++ b/Assets/Scripts/FluxShotBullet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84d4afd561852c74f8383ca7651b8f4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/IDamageable.cs b/Assets/Scripts/IDamageable.cs new file mode 100644 index 0000000..f26a862 --- /dev/null +++ b/Assets/Scripts/IDamageable.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +public interface IDamageable +{ + void TakeDamage(DamageData data); +} + +public struct DamageData +{ + public float Damage; + public GameObject ImpactObject; +} \ No newline at end of file diff --git a/Assets/Scripts/IDamageable.cs.meta b/Assets/Scripts/IDamageable.cs.meta new file mode 100644 index 0000000..44e7d9d --- /dev/null +++ b/Assets/Scripts/IDamageable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb93178e5caefc04599c6460a5245e07 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index c4a69af..d560791 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class Player : MonoBehaviour +public class Player : BasePlayerController { [SerializeField] Collider2D boundary; @@ -23,7 +23,7 @@ private void Update() { Vector3 viewPos = transform.position; viewPos.x = Mathf.Clamp(viewPos.x, boundary.bounds.min.x + _playerWidth, boundary.bounds.max.x - _playerWidth); - viewPos.y = Mathf.Clamp(viewPos.y, boundary.bounds.min.y + _playerHeight, boundary.bounds.max.y - _playerHeight); ` + viewPos.y = Mathf.Clamp(viewPos.y, boundary.bounds.min.y + _playerHeight, boundary.bounds.max.y - _playerHeight); transform.position = viewPos; } diff --git a/Assets/Scripts/ShootingSkill.cs b/Assets/Scripts/ShootingSkill.cs new file mode 100644 index 0000000..5c8b702 --- /dev/null +++ b/Assets/Scripts/ShootingSkill.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public abstract class ShootingSkill : MonoBehaviour +{ + public abstract void Shoot(); + + protected virtual BaseProjectileSpell SpawnProjectile(BaseProjectileSpell prefab, Vector3 position) + { + var spell = Instantiate(prefab, position, Quaternion.identity); + return spell; + } +} \ No newline at end of file diff --git a/Assets/Scripts/ShootingSkill.cs.meta b/Assets/Scripts/ShootingSkill.cs.meta new file mode 100644 index 0000000..35a91c7 --- /dev/null +++ b/Assets/Scripts/ShootingSkill.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3efc27fbab83d3648b3a4205f902d874 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/GameEntities.meta b/Assets/Sprites/GameEntities.meta new file mode 100644 index 0000000..26dd91c --- /dev/null +++ b/Assets/Sprites/GameEntities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa0278790266bef458d95c49054381f9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/GameEntities/bullet_105.png b/Assets/Sprites/GameEntities/bullet_105.png new file mode 100644 index 0000000..03b0f51 --- /dev/null +++ b/Assets/Sprites/GameEntities/bullet_105.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7e8f59a0421949db2dfeb71e777f181eab17f2d9ec3dd6b0ca0dc6a8cd11493 +size 203 diff --git a/Assets/Sprites/GameEntities/bullet_105.png.meta b/Assets/Sprites/GameEntities/bullet_105.png.meta new file mode 100644 index 0000000..72b57b0 --- /dev/null +++ b/Assets/Sprites/GameEntities/bullet_105.png.meta @@ -0,0 +1,134 @@ +fileFormatVersion: 2 +guid: 5b268c7d143ff8c4e92d14e58ec06183 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 20 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index ac41e8e..5e30318 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,6 +1,6 @@ { "dependencies": { - "com.unity.collab-proxy": "1.15.17", + "com.unity.collab-proxy": "1.15.18", "com.unity.feature.2d": "1.0.0", "com.unity.ide.rider": "3.0.14", "com.unity.ide.visualstudio": "2.0.15", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 3b227af..e13b1e4 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { "com.unity.2d.animation": { - "version": "7.0.5", + "version": "7.0.6", "depth": 1, "source": "registry", "dependencies": { @@ -39,11 +39,11 @@ "url": "https://packages.unity.com" }, "com.unity.2d.psdimporter": { - "version": "6.0.3", + "version": "6.0.4", "depth": 1, "source": "registry", "dependencies": { - "com.unity.2d.animation": "7.0.4", + "com.unity.2d.animation": "7.0.6", "com.unity.2d.common": "6.0.3", "com.unity.2d.sprite": "1.0.0" }, @@ -74,7 +74,7 @@ "dependencies": {} }, "com.unity.2d.tilemap.extras": { - "version": "2.2.2", + "version": "2.2.3", "depth": 1, "source": "registry", "dependencies": { @@ -95,7 +95,7 @@ "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "1.15.17", + "version": "1.15.18", "depth": 0, "source": "registry", "dependencies": { @@ -115,13 +115,13 @@ "depth": 0, "source": "builtin", "dependencies": { - "com.unity.2d.animation": "7.0.5", + "com.unity.2d.animation": "7.0.6", "com.unity.2d.pixel-perfect": "5.0.1", - "com.unity.2d.psdimporter": "6.0.3", + "com.unity.2d.psdimporter": "6.0.4", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.spriteshape": "7.0.4", "com.unity.2d.tilemap": "1.0.0", - "com.unity.2d.tilemap.extras": "2.2.2" + "com.unity.2d.tilemap.extras": "2.2.3" } }, "com.unity.ide.rider": { diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 2ed1261..e6c7d27 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -270,7 +270,99 @@ PlayerSettings: AndroidValidateAppBundleSize: 1 AndroidAppBundleSizeToValidate: 150 m_BuildTargetIcons: [] - m_BuildTargetPlatformIcons: [] + m_BuildTargetPlatformIcons: + - m_BuildTarget: Android + m_Icons: + - m_Textures: [] + m_Width: 432 + m_Height: 432 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 324 + m_Height: 324 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 216 + m_Height: 216 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 162 + m_Height: 162 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 108 + m_Height: 108 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 81 + m_Height: 81 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 0 + m_SubKind: m_BuildTargetBatching: [] m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport @@ -544,6 +636,7 @@ PlayerSettings: ps4videoRecordingFeaturesUsed: 0 ps4contentSearchFeaturesUsed: 0 ps4CompatibilityPS5: 0 + ps4AllowPS5Detection: 0 ps4GPU800MHz: 1 ps4attribEyeToEyeDistanceSettingVR: 0 ps4IncludedModules: [] diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 501a25e..bdb3ba5 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.4f1 -m_EditorVersionWithRevision: 2021.3.4f1 (cb45f9cae8b7) +m_EditorVersion: 2021.3.5f1 +m_EditorVersionWithRevision: 2021.3.5f1 (40eb3a945986) From 4edf64f2de958cd10ccc305716b68c9ea35e4268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20Ti=E1=BA=BFn=20Minh?= Date: Tue, 5 Jul 2022 23:21:17 +0700 Subject: [PATCH 2/4] fix: rearrange file system --- .gitignore | 3 +- Assets/Scripts/FluxShotBullet.cs | 30 ------------------- Assets/Scripts/Players.meta | 8 +++++ Assets/Scripts/Players/Interface.meta | 8 +++++ .../Interface}/BasePlayerController.cs | 3 +- .../Interface}/BasePlayerController.cs.meta | 2 +- Assets/Scripts/{ => Players}/Player.cs | 0 Assets/Scripts/{ => Players}/Player.cs.meta | 2 +- .../Scripts/{ => Players}/PlayerController.cs | 0 .../{ => Players}/PlayerController.cs.meta | 2 +- Assets/Scripts/Spells.meta | 8 +++++ Assets/Scripts/Spells/Flux.meta | 8 +++++ Assets/Scripts/{ => Spells/Flux}/FluxShot.cs | 0 .../{ => Spells/Flux}/FluxShot.cs.meta | 2 +- Assets/Scripts/Spells/Flux/FluxShotBullet.cs | 28 +++++++++++++++++ .../{ => Spells/Flux}/FluxShotBullet.cs.meta | 2 +- Assets/Scripts/Spells/Interface.meta | 8 +++++ .../Interface}/BaseProjectileSpell.cs | 0 .../Interface}/BaseProjectileSpell.cs.meta | 2 +- Assets/Scripts/{ => Spells}/ShootingSkill.cs | 2 +- .../{ => Spells}/ShootingSkill.cs.meta | 2 +- Assets/Scripts/Utils.meta | 8 +++++ .../Scripts/{ => Utils}/ForceCameraRatio.cs | 0 .../{ => Utils}/ForceCameraRatio.cs.meta | 2 +- Assets/Scripts/{ => Utils}/IDamageable.cs | 0 .../Scripts/{ => Utils}/IDamageable.cs.meta | 2 +- Packages/packages-lock.json | 14 ++++----- 27 files changed, 96 insertions(+), 50 deletions(-) delete mode 100644 Assets/Scripts/FluxShotBullet.cs create mode 100644 Assets/Scripts/Players.meta create mode 100644 Assets/Scripts/Players/Interface.meta rename Assets/Scripts/{ => Players/Interface}/BasePlayerController.cs (96%) rename Assets/Scripts/{ => Players/Interface}/BasePlayerController.cs.meta (83%) rename Assets/Scripts/{ => Players}/Player.cs (100%) rename Assets/Scripts/{ => Players}/Player.cs.meta (83%) rename Assets/Scripts/{ => Players}/PlayerController.cs (100%) rename Assets/Scripts/{ => Players}/PlayerController.cs.meta (83%) create mode 100644 Assets/Scripts/Spells.meta create mode 100644 Assets/Scripts/Spells/Flux.meta rename Assets/Scripts/{ => Spells/Flux}/FluxShot.cs (100%) rename Assets/Scripts/{ => Spells/Flux}/FluxShot.cs.meta (83%) create mode 100644 Assets/Scripts/Spells/Flux/FluxShotBullet.cs rename Assets/Scripts/{ => Spells/Flux}/FluxShotBullet.cs.meta (83%) create mode 100644 Assets/Scripts/Spells/Interface.meta rename Assets/Scripts/{ => Spells/Interface}/BaseProjectileSpell.cs (100%) rename Assets/Scripts/{ => Spells/Interface}/BaseProjectileSpell.cs.meta (83%) rename Assets/Scripts/{ => Spells}/ShootingSkill.cs (98%) rename Assets/Scripts/{ => Spells}/ShootingSkill.cs.meta (83%) create mode 100644 Assets/Scripts/Utils.meta rename Assets/Scripts/{ => Utils}/ForceCameraRatio.cs (100%) rename Assets/Scripts/{ => Utils}/ForceCameraRatio.cs.meta (83%) rename Assets/Scripts/{ => Utils}/IDamageable.cs (100%) rename Assets/Scripts/{ => Utils}/IDamageable.cs.meta (83%) diff --git a/.gitignore b/.gitignore index 37d59e5..41044b5 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,5 @@ crashlytics-build.properties /[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa/* -.vscode \ No newline at end of file +.vscode +.idea \ No newline at end of file diff --git a/Assets/Scripts/FluxShotBullet.cs b/Assets/Scripts/FluxShotBullet.cs deleted file mode 100644 index 9ea86b4..0000000 --- a/Assets/Scripts/FluxShotBullet.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FluxShotBullet : BaseProjectileSpell -{ - private void Update() - { - Shoot(transform.rotation, 40f, ForceMode2D.Force); - } - protected override void DamageTarget(Collision2D other) - { - var damageable = other.gameObject.GetComponent(); - if (damageable != null) - { - damageable.TakeDamage(new DamageData - { - Damage = damage, - ImpactObject = gameObject - }); - DeSpawn(); - } - else - { - //collide with wall - DeSpawn(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Players.meta b/Assets/Scripts/Players.meta new file mode 100644 index 0000000..5209789 --- /dev/null +++ b/Assets/Scripts/Players.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e2bb72b338aea7e44a8260a49e98c9e5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Players/Interface.meta b/Assets/Scripts/Players/Interface.meta new file mode 100644 index 0000000..ce20814 --- /dev/null +++ b/Assets/Scripts/Players/Interface.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e793b3834bab1c54c861c2c5618a3928 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BasePlayerController.cs b/Assets/Scripts/Players/Interface/BasePlayerController.cs similarity index 96% rename from Assets/Scripts/BasePlayerController.cs rename to Assets/Scripts/Players/Interface/BasePlayerController.cs index b726b1b..3a44712 100644 --- a/Assets/Scripts/BasePlayerController.cs +++ b/Assets/Scripts/Players/Interface/BasePlayerController.cs @@ -4,13 +4,12 @@ public class BasePlayerController : MonoBehaviour, IDamageable { - public float Health { get; set; } public float Energy { get; set; } private float _healthProperty; private float _energyProperty; - + public void TakeDamage(DamageData data) { var resutDamage = data.Damage; diff --git a/Assets/Scripts/BasePlayerController.cs.meta b/Assets/Scripts/Players/Interface/BasePlayerController.cs.meta similarity index 83% rename from Assets/Scripts/BasePlayerController.cs.meta rename to Assets/Scripts/Players/Interface/BasePlayerController.cs.meta index 89e8259..5177335 100644 --- a/Assets/Scripts/BasePlayerController.cs.meta +++ b/Assets/Scripts/Players/Interface/BasePlayerController.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9cca0ffd3ea23b24ba9a7a4a62df5ee0 +guid: d096c2edb51d8ee47b6eb4007b5d3888 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Players/Player.cs similarity index 100% rename from Assets/Scripts/Player.cs rename to Assets/Scripts/Players/Player.cs diff --git a/Assets/Scripts/Player.cs.meta b/Assets/Scripts/Players/Player.cs.meta similarity index 83% rename from Assets/Scripts/Player.cs.meta rename to Assets/Scripts/Players/Player.cs.meta index f20a4fc..245335b 100644 --- a/Assets/Scripts/Player.cs.meta +++ b/Assets/Scripts/Players/Player.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3e75455201130cd43864c935ba61835b +guid: e1c06956d10b31444984f86f7c355e19 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/Players/PlayerController.cs similarity index 100% rename from Assets/Scripts/PlayerController.cs rename to Assets/Scripts/Players/PlayerController.cs diff --git a/Assets/Scripts/PlayerController.cs.meta b/Assets/Scripts/Players/PlayerController.cs.meta similarity index 83% rename from Assets/Scripts/PlayerController.cs.meta rename to Assets/Scripts/Players/PlayerController.cs.meta index 788aa9c..18b9923 100644 --- a/Assets/Scripts/PlayerController.cs.meta +++ b/Assets/Scripts/Players/PlayerController.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 41390dd645cf0e64eab22b0294256450 +guid: ec4df0e9642fda24e9eab5e4e747073f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Spells.meta b/Assets/Scripts/Spells.meta new file mode 100644 index 0000000..1b40820 --- /dev/null +++ b/Assets/Scripts/Spells.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 277cf5e99faaf384ba97769f89bae46c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Spells/Flux.meta b/Assets/Scripts/Spells/Flux.meta new file mode 100644 index 0000000..819ff8a --- /dev/null +++ b/Assets/Scripts/Spells/Flux.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf085aba8cecd3048ab0ade6f6e9181f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FluxShot.cs b/Assets/Scripts/Spells/Flux/FluxShot.cs similarity index 100% rename from Assets/Scripts/FluxShot.cs rename to Assets/Scripts/Spells/Flux/FluxShot.cs diff --git a/Assets/Scripts/FluxShot.cs.meta b/Assets/Scripts/Spells/Flux/FluxShot.cs.meta similarity index 83% rename from Assets/Scripts/FluxShot.cs.meta rename to Assets/Scripts/Spells/Flux/FluxShot.cs.meta index 2b056a7..0b1004b 100644 --- a/Assets/Scripts/FluxShot.cs.meta +++ b/Assets/Scripts/Spells/Flux/FluxShot.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0936fa5babff5e84988bae9309cae705 +guid: cf4df7e20e03d8e4f94fd400b35ae091 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Spells/Flux/FluxShotBullet.cs b/Assets/Scripts/Spells/Flux/FluxShotBullet.cs new file mode 100644 index 0000000..2ecb871 --- /dev/null +++ b/Assets/Scripts/Spells/Flux/FluxShotBullet.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +public class FluxShotBullet : BaseProjectileSpell +{ + private new void Update() + { + Shoot(transform.rotation, 40f, ForceMode2D.Force); + } + + protected override void DamageTarget(Collision2D other) + { + var damageable = other.gameObject.GetComponent(); + if (damageable != null) + { + damageable.TakeDamage(new DamageData + { + Damage = damage, + ImpactObject = gameObject + }); + DeSpawn(); + } + else + { + //collide with wall + DeSpawn(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/FluxShotBullet.cs.meta b/Assets/Scripts/Spells/Flux/FluxShotBullet.cs.meta similarity index 83% rename from Assets/Scripts/FluxShotBullet.cs.meta rename to Assets/Scripts/Spells/Flux/FluxShotBullet.cs.meta index a84b0a9..b716089 100644 --- a/Assets/Scripts/FluxShotBullet.cs.meta +++ b/Assets/Scripts/Spells/Flux/FluxShotBullet.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 84d4afd561852c74f8383ca7651b8f4b +guid: 0e84af4441d8f034fb074282d1904b99 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Spells/Interface.meta b/Assets/Scripts/Spells/Interface.meta new file mode 100644 index 0000000..2029c58 --- /dev/null +++ b/Assets/Scripts/Spells/Interface.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 393b6b230aa02ec42b6e432dd42c644a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BaseProjectileSpell.cs b/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs similarity index 100% rename from Assets/Scripts/BaseProjectileSpell.cs rename to Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs diff --git a/Assets/Scripts/BaseProjectileSpell.cs.meta b/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs.meta similarity index 83% rename from Assets/Scripts/BaseProjectileSpell.cs.meta rename to Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs.meta index d56d1c4..3a555cd 100644 --- a/Assets/Scripts/BaseProjectileSpell.cs.meta +++ b/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 76a476f1f3d2f2c44b6c74c303169ef9 +guid: b573d745d94c50240a83ee3b28223fea MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/ShootingSkill.cs b/Assets/Scripts/Spells/ShootingSkill.cs similarity index 98% rename from Assets/Scripts/ShootingSkill.cs rename to Assets/Scripts/Spells/ShootingSkill.cs index 5c8b702..8cc3215 100644 --- a/Assets/Scripts/ShootingSkill.cs +++ b/Assets/Scripts/Spells/ShootingSkill.cs @@ -5,7 +5,7 @@ public abstract class ShootingSkill : MonoBehaviour { public abstract void Shoot(); - + protected virtual BaseProjectileSpell SpawnProjectile(BaseProjectileSpell prefab, Vector3 position) { var spell = Instantiate(prefab, position, Quaternion.identity); diff --git a/Assets/Scripts/ShootingSkill.cs.meta b/Assets/Scripts/Spells/ShootingSkill.cs.meta similarity index 83% rename from Assets/Scripts/ShootingSkill.cs.meta rename to Assets/Scripts/Spells/ShootingSkill.cs.meta index 35a91c7..e189215 100644 --- a/Assets/Scripts/ShootingSkill.cs.meta +++ b/Assets/Scripts/Spells/ShootingSkill.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3efc27fbab83d3648b3a4205f902d874 +guid: b547fc7ea79c2ab4382127e1a833939f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Utils.meta b/Assets/Scripts/Utils.meta new file mode 100644 index 0000000..6811cd2 --- /dev/null +++ b/Assets/Scripts/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 34218aacc3c9fc4438c998ed9b25f85b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ForceCameraRatio.cs b/Assets/Scripts/Utils/ForceCameraRatio.cs similarity index 100% rename from Assets/Scripts/ForceCameraRatio.cs rename to Assets/Scripts/Utils/ForceCameraRatio.cs diff --git a/Assets/Scripts/ForceCameraRatio.cs.meta b/Assets/Scripts/Utils/ForceCameraRatio.cs.meta similarity index 83% rename from Assets/Scripts/ForceCameraRatio.cs.meta rename to Assets/Scripts/Utils/ForceCameraRatio.cs.meta index c75de22..f50970f 100644 --- a/Assets/Scripts/ForceCameraRatio.cs.meta +++ b/Assets/Scripts/Utils/ForceCameraRatio.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8f04eb23e3a71dd4fa42338714e99671 +guid: 404e331b08bb3a240a347b7c7fb90f46 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/IDamageable.cs b/Assets/Scripts/Utils/IDamageable.cs similarity index 100% rename from Assets/Scripts/IDamageable.cs rename to Assets/Scripts/Utils/IDamageable.cs diff --git a/Assets/Scripts/IDamageable.cs.meta b/Assets/Scripts/Utils/IDamageable.cs.meta similarity index 83% rename from Assets/Scripts/IDamageable.cs.meta rename to Assets/Scripts/Utils/IDamageable.cs.meta index 44e7d9d..adf3a81 100644 --- a/Assets/Scripts/IDamageable.cs.meta +++ b/Assets/Scripts/Utils/IDamageable.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cb93178e5caefc04599c6460a5245e07 +guid: 22b0f09898eb93542a75a80ebe0f2dd4 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index e13b1e4..bfe6007 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { "com.unity.2d.animation": { - "version": "7.0.6", + "version": "7.0.5", "depth": 1, "source": "registry", "dependencies": { @@ -39,11 +39,11 @@ "url": "https://packages.unity.com" }, "com.unity.2d.psdimporter": { - "version": "6.0.4", + "version": "6.0.3", "depth": 1, "source": "registry", "dependencies": { - "com.unity.2d.animation": "7.0.6", + "com.unity.2d.animation": "7.0.4", "com.unity.2d.common": "6.0.3", "com.unity.2d.sprite": "1.0.0" }, @@ -74,7 +74,7 @@ "dependencies": {} }, "com.unity.2d.tilemap.extras": { - "version": "2.2.3", + "version": "2.2.2", "depth": 1, "source": "registry", "dependencies": { @@ -115,13 +115,13 @@ "depth": 0, "source": "builtin", "dependencies": { - "com.unity.2d.animation": "7.0.6", + "com.unity.2d.animation": "7.0.5", "com.unity.2d.pixel-perfect": "5.0.1", - "com.unity.2d.psdimporter": "6.0.4", + "com.unity.2d.psdimporter": "6.0.3", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.spriteshape": "7.0.4", "com.unity.2d.tilemap": "1.0.0", - "com.unity.2d.tilemap.extras": "2.2.3" + "com.unity.2d.tilemap.extras": "2.2.2" } }, "com.unity.ide.rider": { From 9587bf8d74f1ba922621be1931ba49d308e3e863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20Ti=E1=BA=BFn=20Minh?= Date: Tue, 5 Jul 2022 23:22:51 +0700 Subject: [PATCH 3/4] fix: update .gitignore --- .gitignore | 5 +- .../.idea.spellcasters/.idea/indexLayout.xml | 8 -- .../.idea/projectSettingsUpdater.xml | 6 - .idea/.idea.spellcasters/.idea/vcs.xml | 6 - .idea/.idea.spellcasters/.idea/workspace.xml | 118 ------------------ .vscode/settings.json | 55 -------- Assets/Prefab/bullet_105.prefab | 32 ++++- .../Spells/Interface/BaseProjectileSpell.cs | 63 +++++----- ProjectSettings/ProjectVersion.txt | 4 +- 9 files changed, 62 insertions(+), 235 deletions(-) delete mode 100644 .idea/.idea.spellcasters/.idea/indexLayout.xml delete mode 100644 .idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml delete mode 100644 .idea/.idea.spellcasters/.idea/vcs.xml delete mode 100644 .idea/.idea.spellcasters/.idea/workspace.xml delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 41044b5..798c888 100644 --- a/.gitignore +++ b/.gitignore @@ -71,5 +71,6 @@ crashlytics-build.properties /[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa/* -.vscode -.idea \ No newline at end of file +.vscode/ + +.idea/ \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/indexLayout.xml b/.idea/.idea.spellcasters/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/.idea/.idea.spellcasters/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml b/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml deleted file mode 100644 index 4bb9f4d..0000000 --- a/.idea/.idea.spellcasters/.idea/projectSettingsUpdater.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/vcs.xml b/.idea/.idea.spellcasters/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/.idea.spellcasters/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/.idea.spellcasters/.idea/workspace.xml b/.idea/.idea.spellcasters/.idea/workspace.xml deleted file mode 100644 index 7f0b20d..0000000 --- a/.idea/.idea.spellcasters/.idea/workspace.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1656954059094 - - - - - - - - - - - - \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e232cd6..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "files.exclude": - { - "**/.DS_Store":true, - "**/.git":true, - "**/.gitmodules":true, - "**/*.booproj":true, - "**/*.pidb":true, - "**/*.suo":true, - "**/*.user":true, - "**/*.userprefs":true, - "**/*.unityproj":true, - "**/*.dll":true, - "**/*.exe":true, - "**/*.pdf":true, - "**/*.mid":true, - "**/*.midi":true, - "**/*.wav":true, - "**/*.gif":true, - "**/*.ico":true, - "**/*.jpg":true, - "**/*.jpeg":true, - "**/*.png":true, - "**/*.psd":true, - "**/*.tga":true, - "**/*.tif":true, - "**/*.tiff":true, - "**/*.3ds":true, - "**/*.3DS":true, - "**/*.fbx":true, - "**/*.FBX":true, - "**/*.lxo":true, - "**/*.LXO":true, - "**/*.ma":true, - "**/*.MA":true, - "**/*.obj":true, - "**/*.OBJ":true, - "**/*.asset":true, - "**/*.cubemap":true, - "**/*.flare":true, - "**/*.mat":true, - "**/*.meta":true, - "**/*.prefab":true, - "**/*.unity":true, - "build/":true, - "Build/":true, - "Library/":true, - "library/":true, - "obj/":true, - "Obj/":true, - "ProjectSettings/":true, - "temp/":true, - "Temp/":true - } -} \ No newline at end of file diff --git a/Assets/Prefab/bullet_105.prefab b/Assets/Prefab/bullet_105.prefab index ad7f79e..0e7951e 100644 --- a/Assets/Prefab/bullet_105.prefab +++ b/Assets/Prefab/bullet_105.prefab @@ -58,7 +58,8 @@ GameObject: m_Component: - component: {fileID: 1619133627816819449} - component: {fileID: 1882434149266867794} - - component: {fileID: 4137173044849846708} + - component: {fileID: 5322296178168887703} + - component: {fileID: 5049604820480247189} m_Layer: 0 m_Name: bullet_105 m_TagString: Untagged @@ -134,7 +135,7 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!114 &4137173044849846708 +--- !u!114 &5322296178168887703 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -143,8 +144,29 @@ MonoBehaviour: m_GameObject: {fileID: 8442789017307878925} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 84d4afd561852c74f8383ca7651b8f4b, type: 3} + m_Script: {fileID: 11500000, guid: 0e84af4441d8f034fb074282d1904b99, type: 3} m_Name: m_EditorClassIdentifier: - damage: 0 - rigidBody2D: {fileID: 0} + damage: 10 + rigidBody2D: {fileID: 5049604820480247189} +--- !u!50 &5049604820480247189 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8442789017307878925} + m_BodyType: 0 + 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_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 diff --git a/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs b/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs index 0f4f79c..ad29ad3 100644 --- a/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs +++ b/Assets/Scripts/Spells/Interface/BaseProjectileSpell.cs @@ -1,46 +1,43 @@ -using System; -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class BaseProjectileSpell : MonoBehaviour { - [SerializeField] protected float damage; - [SerializeField] protected Collision2D spellCollider; - [SerializeField] protected Rigidbody2D rigidBody2D; - - private Vector2 _screenPosition; + [SerializeField] protected float damage; + [SerializeField] protected Collision2D spellCollider; + [SerializeField] protected Rigidbody2D rigidBody2D; - private Vector3 _worldPosition; + private Vector2 _screenPosition; - protected void Update() - { - if (Input.GetMouseButtonDown(0)) - { - Vector3 mousePos = Input.mousePosition; - _screenPosition = new Vector2(mousePos.x, mousePos.y); - } + private Vector3 _worldPosition; - _worldPosition = Camera.main.ScreenToWorldPoint(_screenPosition); + protected void Update() + { + if (Input.GetMouseButtonDown(0)) + { + Vector3 mousePos = Input.mousePosition; + _screenPosition = new Vector2(mousePos.x, mousePos.y); } - protected virtual void DamageTarget(Collision2D other) { } + _worldPosition = Camera.main.ScreenToWorldPoint(_screenPosition); + } - protected virtual void OnCollisionEnter2D(Collision2D other) - { - DamageTarget(other); - } + protected virtual void DamageTarget(Collision2D other) { } - protected virtual void Shoot(Quaternion angle, float speed, ForceMode2D forceMode2D = ForceMode2D.Impulse) - { - transform.rotation = angle; - rigidBody2D.SetRotation(angle); - rigidBody2D.AddRelativeForce(Vector2.up * speed, forceMode2D); - - } + protected virtual void OnCollisionEnter2D(Collision2D other) + { + DamageTarget(other); + } - protected virtual void DeSpawn() - { - Destroy(this.gameObject); - } + protected virtual void Shoot(Quaternion angle, float speed, ForceMode2D forceMode2D = ForceMode2D.Impulse) + { + transform.rotation = angle; + rigidBody2D.SetRotation(angle); + rigidBody2D.AddRelativeForce(Vector2.up * speed, forceMode2D); + + } + + protected virtual void DeSpawn() + { + Destroy(this.gameObject); + } } \ No newline at end of file diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index bdb3ba5..501a25e 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.5f1 -m_EditorVersionWithRevision: 2021.3.5f1 (40eb3a945986) +m_EditorVersion: 2021.3.4f1 +m_EditorVersionWithRevision: 2021.3.4f1 (cb45f9cae8b7) From 9110e77ab9d20a00dcc70d4630e09ea0ad920fd7 Mon Sep 17 00:00:00 2001 From: trananh Date: Wed, 6 Jul 2022 16:21:53 +0700 Subject: [PATCH 4/4] commit --- .idea/.idea.spellcasters/.idea/workspace.xml | 30 ++------------------ 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/.idea/.idea.spellcasters/.idea/workspace.xml b/.idea/.idea.spellcasters/.idea/workspace.xml index 7f0b20d..fb8f2c3 100644 --- a/.idea/.idea.spellcasters/.idea/workspace.xml +++ b/.idea/.idea.spellcasters/.idea/workspace.xml @@ -2,34 +2,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - +