basically the whole game
This commit is contained in:
parent
949135cecb
commit
96dcfa9064
315 changed files with 34386 additions and 396 deletions
42
Assets/Scripts/Projectiles/DelayedAimShot.cs
Normal file
42
Assets/Scripts/Projectiles/DelayedAimShot.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class DelayedAimShot : Projectile
|
||||
{
|
||||
[SerializeField] private float aimDelay;
|
||||
[SerializeField] private float aimedSpeed;
|
||||
[SerializeField] private float movementDelay;
|
||||
|
||||
private Vector3 GetAimedDirection()
|
||||
{
|
||||
return (WaveManager.instance.GetRandomPlayerPoint() - transform.position).normalized;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (aimDelay > 0)
|
||||
{
|
||||
aimDelay -= Time.deltaTime;
|
||||
if (aimDelay <= 0)
|
||||
{
|
||||
speed = aimedSpeed;
|
||||
if (movementDelay <= 0)
|
||||
{
|
||||
direction = GetAimedDirection();
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (movementDelay > 0)
|
||||
{
|
||||
movementDelay -= Time.deltaTime;
|
||||
if (movementDelay <= 0)
|
||||
{
|
||||
direction = GetAimedDirection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue