add scripts from post-scale attempt
This commit is contained in:
parent
96dcfa9064
commit
87383d5b8c
18 changed files with 362 additions and 148 deletions
64
Assets/Scripts/Abilities/CirnoIceBall.cs
Normal file
64
Assets/Scripts/Abilities/CirnoIceBall.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class CirnoIceBall : EnemyAbility
|
||||
{
|
||||
[Header("Ice Ball")]
|
||||
[SerializeField] private IceBall iceBall;
|
||||
|
||||
private IceBall iceballInstance;
|
||||
[SerializeField] private float timeUntilShatter;
|
||||
private float currentTimeOnSpawn;
|
||||
[Header("Effects")]
|
||||
[SerializeField] private float sweepDissipationTime;
|
||||
private float currentDissipationTime;
|
||||
[SerializeField] private GameObject swordSweepEffect;
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
iceballInstance = ShootProjectile(iceBall, WaveManager.instance.GetRandomPlayerPoint(), iceBall.speed, false);
|
||||
currentTimeOnSpawn = timeUntilShatter;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (currentTimeOnSpawn > 0)
|
||||
{
|
||||
currentTimeOnSpawn -= Time.deltaTime;
|
||||
if (currentTimeOnSpawn <= 0)
|
||||
{
|
||||
transform.Lookat2D(WaveManager.instance.GetRandomPlayerPoint());
|
||||
swordSweepEffect.SetActive(true);
|
||||
currentDissipationTime = sweepDissipationTime;
|
||||
iceballInstance.Shatter();
|
||||
}
|
||||
}
|
||||
|
||||
if (currentDissipationTime > 0)
|
||||
{
|
||||
currentDissipationTime -= Time.deltaTime;
|
||||
if (currentDissipationTime <= 0)
|
||||
{
|
||||
swordSweepEffect.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private IceBall ShootProjectile(IceBall projectile, Vector3 location, float speed, bool aimed)
|
||||
{
|
||||
IceBall newProjectile = Instantiate(projectile, origin.position, Quaternion.identity);
|
||||
Vector3 projectileDirection = location;
|
||||
if (aimed)
|
||||
{
|
||||
projectileDirection = WaveManager.instance.GetRandomPlayerPoint();
|
||||
}
|
||||
newProjectile.transform.Lookat2D(projectileDirection);
|
||||
newProjectile.damage = power;
|
||||
newProjectile.tag = tag;
|
||||
if (speed > 0f)
|
||||
{
|
||||
newProjectile.speed = speed;
|
||||
}
|
||||
|
||||
return newProjectile;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue