add scripts from post-scale attempt
This commit is contained in:
parent
96dcfa9064
commit
87383d5b8c
18 changed files with 362 additions and 148 deletions
|
|
@ -70,7 +70,7 @@ public class CirnoFreezeDeflect : EnemyAbility
|
|||
}
|
||||
}
|
||||
}
|
||||
private void DeflectProjectiles()
|
||||
protected void DeflectProjectiles()
|
||||
{
|
||||
GameManager.instance.deflections += projectilesInRange.Count;
|
||||
foreach (Projectile projectile in projectilesAffected.ToArray())
|
||||
|
|
|
|||
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;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/CirnoIceBall.cs.meta
Normal file
2
Assets/Scripts/Abilities/CirnoIceBall.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fff9dc9791c039bc6b167721faff21d5
|
||||
|
|
@ -1,21 +1,39 @@
|
|||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyAbility : Ability
|
||||
{
|
||||
[SerializeField] private float cooldownDelta;
|
||||
[SerializeField] private bool willLookAtPlayer;
|
||||
protected virtual void Start()
|
||||
{
|
||||
cooldown += Random.Range(-cooldownDelta, cooldownDelta);
|
||||
currentCooldown = Random.Range(0, cooldown);
|
||||
}
|
||||
[SerializeField] private float cooldownDelta;
|
||||
[SerializeField] private bool willLookAtPlayer;
|
||||
protected virtual void Start()
|
||||
{
|
||||
cooldown += Random.Range(-cooldownDelta, cooldownDelta);
|
||||
currentCooldown = Random.Range(0, cooldown);
|
||||
}
|
||||
|
||||
public override bool TryAbility()
|
||||
{
|
||||
if (willLookAtPlayer)
|
||||
{
|
||||
direction = WaveManager.instance.GetRandomPlayerPoint();
|
||||
}
|
||||
return base.TryAbility();
|
||||
}
|
||||
}
|
||||
public override bool TryAbility()
|
||||
{
|
||||
if (willLookAtPlayer)
|
||||
{
|
||||
direction = WaveManager.instance.GetRandomPlayerPoint();
|
||||
transform.Lookat2D(direction);
|
||||
}
|
||||
return base.TryAbility();
|
||||
}
|
||||
public void ShootProjectile(Projectile projectile, Vector3 location, float speed, bool aimed)
|
||||
{
|
||||
Projectile 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,23 +46,6 @@ public class EnemyBulletPattern : EnemyAbility
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShootProjectile(Projectile projectile, Vector3 location, float speed, bool aimed)
|
||||
{
|
||||
Projectile 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;
|
||||
}
|
||||
}
|
||||
private IEnumerator BurstFire(ProjectileDirection projectile, int burstCount, float burstDelay)
|
||||
{
|
||||
int currentCount = 0;
|
||||
|
|
|
|||
52
Assets/Scripts/Abilities/OrinMoveAndSpawn.cs
Normal file
52
Assets/Scripts/Abilities/OrinMoveAndSpawn.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class OrinMoveAndSpawn : EnemyAbility
|
||||
{
|
||||
[SerializeField] private Enemy ghostFairy;
|
||||
[SerializeField] private int fairiesToSpawn;
|
||||
private int currentFairiesLeft;
|
||||
[SerializeField] private int variance;
|
||||
[SerializeField] private Enemy thisEnemy;
|
||||
[SerializeField] private float moveSpeed;
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
base.AbilityEffects();
|
||||
currentFairiesLeft = fairiesToSpawn + Random.Range(-variance, variance);
|
||||
thisEnemy.preventWobble = true;
|
||||
thisEnemy.isStalled = true;
|
||||
StartCoroutine(MoveToPosition(transform.position, WaveManager.instance.GetRandomEnemyPoint(), moveSpeed));
|
||||
}
|
||||
|
||||
private IEnumerator MoveToPosition(Vector3 enemyOrigin, Vector3 moveDirection, float lerpSpeed)
|
||||
{
|
||||
float currentMovement = 0;
|
||||
while (currentMovement < 1)
|
||||
{
|
||||
currentMovement += Time.deltaTime * lerpSpeed;
|
||||
if (currentMovement >= 1)
|
||||
{
|
||||
SpawnGhostFairy();
|
||||
}
|
||||
thisEnemy.transform.position = Vector3.Lerp(enemyOrigin, moveDirection, currentMovement);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnGhostFairy()
|
||||
{
|
||||
Enemy newEnemy = Instantiate(ghostFairy, WaveManager.instance.enemyFolder);
|
||||
newEnemy.originalPosition = transform.position;
|
||||
WaveManager.instance.enemiesInPlay.Add(newEnemy);
|
||||
if (currentFairiesLeft > 0)
|
||||
{
|
||||
currentFairiesLeft--;
|
||||
StartCoroutine(MoveToPosition(transform.position, WaveManager.instance.GetRandomEnemyPoint(), moveSpeed));
|
||||
}
|
||||
else
|
||||
{
|
||||
thisEnemy.preventWobble = false;
|
||||
thisEnemy.isStalled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Abilities/OrinMoveAndSpawn.cs.meta
Normal file
2
Assets/Scripts/Abilities/OrinMoveAndSpawn.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 49a49f9644919e6ebb5aa8f30adbd9e4
|
||||
|
|
@ -73,6 +73,7 @@ public class DialogueManager : MonoBehaviour
|
|||
dialogueActive = false;
|
||||
dialogueUI.SetActive(false);
|
||||
WaveManager.instance.player.isStalled = false;
|
||||
WaveManager.instance.player.invulnerable = false;
|
||||
WaveManager.instance.bossInstance.isStalled = false;
|
||||
//GameManager.instance.SetPause(false);
|
||||
reisenAnimator.SetTrigger(switchToIdleTrigger);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ public class Enemy : Entity
|
|||
{
|
||||
private Ability abilitySelected;
|
||||
public SpriteRenderer sprite;
|
||||
private float currentState = 1;
|
||||
public float colorChangeSpeed;
|
||||
[Header("Movement")]
|
||||
public float moveSpeed;
|
||||
|
|
@ -66,9 +65,8 @@ public class Enemy : Entity
|
|||
abilitySelected = freeAbilities[Random.Range(0, freeAbilities.Count)];
|
||||
}
|
||||
bool success = abilitySelected.TryAbility();
|
||||
if (!success && abilitySelected.currentCooldown <= 0.5f && currentState >= 1f)
|
||||
if (!success && abilitySelected.currentCooldown <= 0.5f)
|
||||
{
|
||||
currentState = 0f;
|
||||
StartCoroutine(ImminentAttackAnim());
|
||||
}
|
||||
else
|
||||
|
|
@ -108,6 +106,7 @@ public class Enemy : Entity
|
|||
|
||||
private IEnumerator ImminentAttackAnim()
|
||||
{
|
||||
float currentState = 0;
|
||||
while (currentState < 1)
|
||||
{
|
||||
currentState += Time.deltaTime * colorChangeSpeed;
|
||||
|
|
|
|||
11
Assets/Scripts/Projectiles/IceBall.cs
Normal file
11
Assets/Scripts/Projectiles/IceBall.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class IceBall : Projectile
|
||||
{
|
||||
[SerializeField] private EnemyBulletPattern pattern;
|
||||
public void Shatter()
|
||||
{
|
||||
pattern.TryAbility();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Projectiles/IceBall.cs.meta
Normal file
2
Assets/Scripts/Projectiles/IceBall.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 79ca09c8408e601d7ba18c2cb6204375
|
||||
|
|
@ -2,15 +2,9 @@ using UnityEngine;
|
|||
|
||||
public class SpinEffect : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
[SerializeField] private float rotationSpeed;
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(Vector3.forward, rotationSpeed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +126,7 @@ public class WaveManager : MonoBehaviour
|
|||
bossDescriptionUI.text = waveList[wave - 1].bossDescription;
|
||||
UpdateBossUI();
|
||||
player.isStalled = true; //wait for boss to enter then start dialogue
|
||||
player.invulnerable = true;
|
||||
}
|
||||
|
||||
public Enemy SpawnEnemy(Enemy enemy)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue