diff --git a/Assets/Prefabs/MagicMissile.prefab b/Assets/Prefabs/MagicMissile.prefab index b672f26..2c51d10 100644 --- a/Assets/Prefabs/MagicMissile.prefab +++ b/Assets/Prefabs/MagicMissile.prefab @@ -46,9 +46,14 @@ MonoBehaviour: m_EditorClassIdentifier: abilityName: Magic Missile thisPlayer: {fileID: 0} + canCooldown: 1 cooldown: 0.2 accuracy: 1 bulletLifetime: 3 damage: 5 projectileSpeed: 16 + fireMode: 1 + projectileCount: 1 + offset: {x: 1, y: 1} + angle: 0 projectile: {fileID: 41144518337917555, guid: c8c4bd2326cbed637aa720d1a4d73968, type: 3} diff --git a/Assets/Prefabs/Marisa.prefab b/Assets/Prefabs/Marisa.prefab index f76e113..5c9bcbf 100644 --- a/Assets/Prefabs/Marisa.prefab +++ b/Assets/Prefabs/Marisa.prefab @@ -174,6 +174,37 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1285645608580101256 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6266582235186827771} + m_Layer: 6 + m_Name: FiringPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6266582235186827771 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1285645608580101256} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1955417614592701310} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1580711442395299301 GameObject: m_ObjectHideFlags: 0 @@ -649,6 +680,7 @@ Transform: - {fileID: 3445211528256210067} - {fileID: 9200583498738940138} - {fileID: 5150015966705364997} + - {fileID: 1955417614592701310} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!212 &8885222195297553295 @@ -802,6 +834,8 @@ MonoBehaviour: speed: 8 cam: {fileID: 0} mouseWorldPos: {x: 0, y: 0} + firingPoint: {fileID: 6266582235186827771} + firingPointBase: {fileID: 1955417614592701310} --- !u!1 &6396436912902618782 GameObject: m_ObjectHideFlags: 0 @@ -976,3 +1010,35 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &6725891226587269588 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1955417614592701310} + m_Layer: 6 + m_Name: FiringPointBase + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1955417614592701310 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6725891226587269588} + 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: + - {fileID: 6266582235186827771} + m_Father: {fileID: 5661264056639479186} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/AbilityUpgrade.cs b/Assets/Scripts/AbilityUpgrade.cs index 632e1d7..acf9cc4 100644 --- a/Assets/Scripts/AbilityUpgrade.cs +++ b/Assets/Scripts/AbilityUpgrade.cs @@ -1,8 +1,13 @@ using UnityEngine; -public class AbilityUpgrade : MonoBehaviour +public class AbilityUpgrade : ScriptableObject { [Header("Identification")] public string upgradeName; public PlayerAbility thisPlayerAbility; + + public virtual void ApplyUpgrade() + { + + } } diff --git a/Assets/Scripts/AttackSpeedUpgrade.cs b/Assets/Scripts/AttackSpeedUpgrade.cs new file mode 100644 index 0000000..859ff2a --- /dev/null +++ b/Assets/Scripts/AttackSpeedUpgrade.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +public class AttackSpeedUpgrade : AbilityUpgrade +{ + [SerializeField] private float speedUpgradeAmount; + + public override void ApplyUpgrade() + { + base.ApplyUpgrade(); + thisPlayerAbility.cooldown *= speedUpgradeAmount; + } +} diff --git a/Assets/Scripts/AttackSpeedUpgrade.cs.meta b/Assets/Scripts/AttackSpeedUpgrade.cs.meta new file mode 100644 index 0000000..33ea426 --- /dev/null +++ b/Assets/Scripts/AttackSpeedUpgrade.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8cf716a335ed64e9c9c64a9e934acbd8 \ No newline at end of file diff --git a/Assets/Scripts/EnemySpawner.cs b/Assets/Scripts/EnemySpawner.cs new file mode 100644 index 0000000..6164fe3 --- /dev/null +++ b/Assets/Scripts/EnemySpawner.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +public class EnemySpawner : MonoBehaviour +{ + public Enemy[] enemiesToSpawn; + public float spawnRate; + public float currentSpawnTime; + + public void SpawnEnemy() + { + + } +} diff --git a/Assets/Scripts/EnemySpawner.cs.meta b/Assets/Scripts/EnemySpawner.cs.meta new file mode 100644 index 0000000..b51007f --- /dev/null +++ b/Assets/Scripts/EnemySpawner.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1feaa0eb8751bf4a1b4acb1457d0c538 \ No newline at end of file diff --git a/Assets/Scripts/FireBullet.cs b/Assets/Scripts/FireBullet.cs index 9664069..1046907 100644 --- a/Assets/Scripts/FireBullet.cs +++ b/Assets/Scripts/FireBullet.cs @@ -2,19 +2,35 @@ using UnityEngine; public class FireBullet : PlayerAbility { + [Header("Stats")] public float accuracy; public float bulletLifetime; public float damage; public float projectileSpeed; + + public enum FireMode {Angled, Offset}; + [Header("Projectile")] + public FireMode fireMode = FireMode.Offset; + public float projectileCount; + public Vector2 offset; + public float angle; [SerializeField] private Projectile projectile; protected override void AbilityEffects() { - Projectile newProjectile = Instantiate(projectile, transform.position, transform.rotation); - newProjectile.damage = damage; - newProjectile.speed = projectileSpeed; - newProjectile.lifetime = bulletLifetime; - newProjectile.RotateToTarget(thisPlayer.mouseWorldPos); - newProjectile.transform.Rotate(0, 0, Random.Range(-accuracy, accuracy)); - newProjectile.tag = thisPlayer.tag; + for (int i = 0; i < projectileCount; i++) + { + Projectile newProjectile = Instantiate(projectile, thisPlayer.firingPointBase.position, transform.rotation); + newProjectile.RotateToTarget(thisPlayer.firingPoint.position); + newProjectile.transform.position = thisPlayer.firingPoint.position; //me when i set the position 3 times in a row. but it's to prevent the bullets firing behind marisa + if (fireMode == FireMode.Offset && projectileCount > 1) + { + newProjectile.transform.position += new Vector3(Random.Range(-offset.x, offset.x), Random.Range(-offset.y, offset.y)); + } + newProjectile.damage = damage; + newProjectile.speed = projectileSpeed; + newProjectile.lifetime = bulletLifetime; + newProjectile.transform.Rotate(0, 0, Random.Range(-accuracy, accuracy)); + newProjectile.tag = thisPlayer.tag; + } } } diff --git a/Assets/Scripts/Marisa.cs b/Assets/Scripts/Marisa.cs index 206c833..2479cd7 100644 --- a/Assets/Scripts/Marisa.cs +++ b/Assets/Scripts/Marisa.cs @@ -1,4 +1,5 @@ using System; +using Core.Extensions; using UnityEngine; public class Marisa : Entity @@ -6,9 +7,12 @@ public class Marisa : Entity [Header("Mouse")] [SerializeField] private Camera cam; public Vector2 mouseWorldPos; + public Transform firingPointBase; + public Transform firingPoint; private void Update() { mouseWorldPos = cam.ScreenToWorldPoint(Input.mousePosition); + firingPointBase.Lookat2D(mouseWorldPos); } protected override void FixedUpdate() diff --git a/Assets/Scripts/PlayerAbility.cs b/Assets/Scripts/PlayerAbility.cs index 5b36c3a..e7396e3 100644 --- a/Assets/Scripts/PlayerAbility.cs +++ b/Assets/Scripts/PlayerAbility.cs @@ -10,7 +10,7 @@ public class PlayerAbility : MonoBehaviour public bool canCooldown = true; public float cooldown; private float currentCooldown; - + public void TryAbility() { if (currentCooldown <= 0 && canCooldown)