From 68d76037a85571d1a34c4c99b63671bb3221969c Mon Sep 17 00:00:00 2001
From: Ny Bruker <robinhs@stud.ntnu.no>
Date: Sun, 2 Oct 2022 17:54:53 +0200
Subject: [PATCH] Created a second attack that is slower but hits harder.

---
 .../Core/Abilities/BiggerSlowerProjectile.cs  | 67 +++++++++++++++++++
 .../Abilities/BiggerSlowerProjectile.cs.meta  | 11 +++
 2 files changed, 78 insertions(+)
 create mode 100644 MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs
 create mode 100644 MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs.meta

diff --git a/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs b/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs
new file mode 100644
index 00000000..19968e12
--- /dev/null
+++ b/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs
@@ -0,0 +1,67 @@
+using System.Collections;
+using System;
+using System.Collections.Generic;
+
+using UnityEngine;
+using UnityEngine.InputSystem;
+
+using BigSock.Service;
+
+namespace BigSock {
+
+	/*
+		Basic projectile attack for the player..
+	*/
+	public class BiggerSlowerProjectile : BaseAttack {
+		//protected static readonly GameObject PROJECTILE_BASE = new AttackMovement();
+		public const string PROJECTILE_NAME = "bullets/bigslowbullet";
+
+		
+		public override ulong Id => 102;
+		public override string Name => "Big Ball";
+		public override string Description => "It's big and slow, but it packs a punch.";
+
+		public BiggerSlowerProjectile() {
+			AttackStats = new AttackStats{
+				Damage = 4f,
+				Knockback = 5f,
+				Range = 5f,
+				ProjectileSpeed = 3f,
+				AttackSpeed = 1f,
+			};
+
+			Cooldown = new TimeSpan(0, 0, 0, 2, 0);
+		}
+
+
+
+		/*
+			Activates the ability.
+			Returns true if the ability was successfully activated. 
+				- Even if nothing was hit, used to indicate that cooldowns should be updated.
+			This should be overridden in sub-classes for the actual abilities.
+		*/
+		protected override bool Activate(Character actor, Vector3? target) {
+			if(target == null) return false;
+
+			var attack = (AttackStats) AttackStats.Apply(actor.Stats);
+			attack.Actor = actor;
+
+
+			var temp = (target.Value - actor.transform.position);
+			temp.z = 0;
+
+			var bullet = PrefabService.SINGLETON.Instance(PROJECTILE_NAME, actor.transform.position);
+			var bulletScript = bullet.GetComponent<AttackMovement>();
+			//bulletScript.Actor = actor;
+			bulletScript.Stats = attack;
+			bulletScript.Direction = temp.normalized;
+
+
+			//MonoBehaviour.Instantiate(PROJECTILE_BASE, (Vector3) actor.transform.position, PROJECTILE_BASE.transform.rotation);
+			return true;
+		}
+
+	}
+
+}
\ No newline at end of file
diff --git a/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs.meta b/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs.meta
new file mode 100644
index 00000000..b4b06bfe
--- /dev/null
+++ b/MrBigsock/Assets/Code/Core/Abilities/BiggerSlowerProjectile.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c80b74b32e3dc7745a400cec3fae0641
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
-- 
GitLab