start work on implementing gameplay
This commit is contained in:
parent
94f5a5e209
commit
274af1e5a1
42 changed files with 3054 additions and 371 deletions
35
Assets/Scripts/YoumuDeflect.cs
Normal file
35
Assets/Scripts/YoumuDeflect.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class YoumuDeflect : Ability
|
||||
{
|
||||
private List<Projectile> projectilesInRange = new();
|
||||
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
foreach (Projectile projectile in projectilesInRange)
|
||||
{
|
||||
projectile.transform.eulerAngles = new Vector3(0, 0, 180);
|
||||
projectile.direction = -transform.right;
|
||||
projectile.tag = tag;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag) && other.TryGetComponent(out Projectile isProjectile))
|
||||
{
|
||||
projectilesInRange.Add(isProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag(tag) && other.TryGetComponent(out Projectile isProjectile) && projectilesInRange.Contains(isProjectile))
|
||||
{
|
||||
projectilesInRange.Add(isProjectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue