alot of stuff i forgot to commit
This commit is contained in:
parent
fc2329a873
commit
b8d516e734
60 changed files with 7397 additions and 64 deletions
|
|
@ -4,9 +4,9 @@ public class Ability : MonoBehaviour
|
|||
{
|
||||
[Header("Identification")]
|
||||
public string abilityName;
|
||||
public Entity thisEntity;
|
||||
public EntityStats thisEntity;
|
||||
[Header("Cooldown")]
|
||||
protected float currentCooldown;
|
||||
public float currentCooldown;
|
||||
public float cooldown;
|
||||
[Header("Stats")]
|
||||
public float power;
|
||||
|
|
@ -26,10 +26,10 @@ public class Ability : MonoBehaviour
|
|||
{
|
||||
AbilityEffects();
|
||||
currentCooldown = cooldown;
|
||||
Debug.Log($"Ability {abilityName} SUCCESS");
|
||||
//Debug.Log($"Ability {abilityName} SUCCESS");
|
||||
return true;
|
||||
}
|
||||
Debug.Log($"Ability {abilityName} ON COOLDOWN");
|
||||
//Debug.Log($"Ability {abilityName} ON COOLDOWN");
|
||||
return false;
|
||||
}
|
||||
protected virtual void AbilityEffects()
|
||||
|
|
|
|||
33
Assets/Scripts/Abilities/AbilitySelector.cs
Normal file
33
Assets/Scripts/Abilities/AbilitySelector.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AbilitySelector : MonoBehaviour
|
||||
{
|
||||
#region Statication
|
||||
|
||||
public static AbilitySelector instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
[Header("INDEX 0 IS DEFAULT")]
|
||||
[SerializeField] private List<Ability> reisenPrimaries = new();
|
||||
[SerializeField] private List<Ability> reisenSecondaries = new();
|
||||
[SerializeField] private List<Ability> reisenSpecials = new();
|
||||
[SerializeField] private List<Ability> youmuPrimaries = new();
|
||||
[SerializeField] private List<Ability> youmuSecondaries = new();
|
||||
[SerializeField] private List<Ability> youmuSpecials = new();
|
||||
[Header("SelectedAbiltiies")]
|
||||
public List<Ability> reisenAbilities = new();
|
||||
public List<Ability> youmuAbilities = new(); //this will be a mess to work with...
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Abilities/AbilitySelector.cs.meta
Normal file
2
Assets/Scripts/Abilities/AbilitySelector.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 647bb64098fc7ded8834dc44bfaf9fa8
|
||||
56
Assets/Scripts/Abilities/ChargedShot.cs
Normal file
56
Assets/Scripts/Abilities/ChargedShot.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChargedShot : Ability
|
||||
{
|
||||
[Header("Projectile Stats")]
|
||||
[SerializeField] private Projectile projectile;
|
||||
[SerializeField] private float projectileSpeed;
|
||||
[SerializeField] private float projectileLifetime;
|
||||
[SerializeField] private int pierceAmount;
|
||||
[Header("Charge")]
|
||||
private bool isCharging;
|
||||
private float currentChargeDuration;
|
||||
[SerializeField] private float maxChargeDuration;
|
||||
public float chargeModifier;
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
isCharging = true;
|
||||
thisEntity.abilitiesDisabled = true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (isCharging)
|
||||
{
|
||||
if (Input.GetMouseButton(1))
|
||||
{
|
||||
currentChargeDuration += Time.deltaTime;
|
||||
}
|
||||
else if (Input.GetMouseButtonUp(1))
|
||||
{
|
||||
currentChargeDuration = Math.Clamp(currentChargeDuration, 0f, maxChargeDuration);
|
||||
float calculatedChargeModifier = Map(currentChargeDuration, 0f, maxChargeDuration, 0f, chargeModifier);
|
||||
isCharging = false;
|
||||
thisEntity.abilitiesDisabled = false;
|
||||
Projectile newProjectile = Instantiate(projectile, thisEntity.transform.position, projectile.transform.rotation);
|
||||
//newProjectile.owner = thisEntity;
|
||||
newProjectile.tag = thisEntity.tag;
|
||||
newProjectile.speed = projectileSpeed;
|
||||
newProjectile.damage = power * 1f + calculatedChargeModifier;
|
||||
newProjectile.lifetime = projectileLifetime;
|
||||
newProjectile.pierceAmount = pierceAmount;
|
||||
newProjectile.transform.Lookat2D(thisEntity.attackOriginPoint.position); //targetLocation);
|
||||
newProjectile.transform.localScale = new Vector3(newProjectile.transform.localScale.x * (1f + calculatedChargeModifier), newProjectile.transform.localScale.y * (1f + calculatedChargeModifier), 1f);
|
||||
currentChargeDuration = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static float Map (float value, float from1, float to1, float from2, float to2) {
|
||||
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/ChargedShot.cs.meta
Normal file
2
Assets/Scripts/Abilities/ChargedShot.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 78058c1d64b6076979b8185d531afd62
|
||||
56
Assets/Scripts/Abilities/LunaticRedEyes.cs
Normal file
56
Assets/Scripts/Abilities/LunaticRedEyes.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class LunaticRedEyes : Ability
|
||||
{
|
||||
private List<Entity> entitiesInRange = new();
|
||||
[SerializeField] private StunEffect stunEffect;
|
||||
[Header("Effect Chances")]
|
||||
[SerializeField] private float effectChance;
|
||||
[SerializeField] private float hypnotismChance;
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
transform.Lookat2D(thisEntity.attackOriginPoint.position);
|
||||
}
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
foreach (Entity entity in entitiesInRange.ToList())
|
||||
{
|
||||
float rolledEffectChance = Random.Range(0, 100);
|
||||
if (rolledEffectChance > 100 - effectChance) //so if i made it 80 percent, it would need to be higher than 20
|
||||
{
|
||||
float rolledHypnotismChance = Random.Range(0, 100);
|
||||
if (rolledHypnotismChance > 100 - hypnotismChance)
|
||||
{
|
||||
entity.tag = thisEntity.tag;
|
||||
entity.entitiesInRange.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
stunEffect.ApplyEffect(entity.stats);
|
||||
}
|
||||
entitiesInRange.Remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
entitiesInRange.Add(isEntity);
|
||||
}
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Entity isEntity) && entitiesInRange.Contains(isEntity))
|
||||
{
|
||||
entitiesInRange.Remove(isEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/LunaticRedEyes.cs.meta
Normal file
2
Assets/Scripts/Abilities/LunaticRedEyes.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 956259a543e87a821b6850d96d435d33
|
||||
46
Assets/Scripts/Abilities/Parry.cs
Normal file
46
Assets/Scripts/Abilities/Parry.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class Parry : Ability
|
||||
{
|
||||
public List<Projectile> projectilesInRange = new();
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
transform.Lookat2D(thisEntity.attackOriginPoint.position);
|
||||
}
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
foreach (Projectile projectile in projectilesInRange.ToList())
|
||||
{
|
||||
if (!projectile)
|
||||
{
|
||||
projectilesInRange.Remove(projectile);
|
||||
continue;
|
||||
}
|
||||
projectile.transform.eulerAngles = new Vector3(0, 0, 180);
|
||||
projectile.direction = -projectile.transform.right * projectile.speed;
|
||||
projectile.tag = thisEntity.tag;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Projectile isProjectile))
|
||||
{
|
||||
projectilesInRange.Add(isProjectile);
|
||||
}
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Projectile isProjectile) && projectilesInRange.Contains(isProjectile))
|
||||
{
|
||||
projectilesInRange.Remove(isProjectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/Parry.cs.meta
Normal file
2
Assets/Scripts/Abilities/Parry.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b12d958979cb9081693930dc212b4b5b
|
||||
|
|
@ -11,12 +11,12 @@ public class ShootBullet : Ability
|
|||
{
|
||||
base.AbilityEffects();
|
||||
Projectile newProjectile = Instantiate(projectile, thisEntity.transform.position, projectile.transform.rotation);
|
||||
newProjectile.owner = thisEntity;
|
||||
//newProjectile.owner = thisEntity;
|
||||
newProjectile.tag = thisEntity.tag;
|
||||
newProjectile.speed = projectileSpeed;
|
||||
newProjectile.damage = power;
|
||||
newProjectile.lifetime = projectileLifetime;
|
||||
newProjectile.pierceAmount = pierceAmount;
|
||||
newProjectile.transform.Lookat2D(thisEntity.stats.attackOriginPoint.position); //targetLocation);
|
||||
newProjectile.transform.Lookat2D(thisEntity.attackOriginPoint.position); //targetLocation);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class SwordSlash : Ability
|
|||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
Collider2D[] entitiesFound = Physics2D.OverlapCircleAll(thisEntity.stats.attackOriginPoint.position, damageRadius, entityLayer);
|
||||
Collider2D[] entitiesFound = Physics2D.OverlapCircleAll(thisEntity.attackOriginPoint.position, damageRadius, entityLayer);
|
||||
foreach (Collider2D entityFound in entitiesFound)
|
||||
{
|
||||
if (!entityFound.CompareTag(thisEntity.tag))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue