Merge remote-tracking branch 'origin/Syntriax' into Over

This commit is contained in:
OverflowNarhoym
2022-02-25 21:38:35 +01:00
34 changed files with 3973 additions and 1070 deletions

View File

@@ -20,6 +20,8 @@ namespace AI
protected Transform target = null;
protected bool isShooting = false;
protected IMovement movement = null;
protected Animator animator = null;
protected int layerMask = ~(1 << 9);
protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared;
@@ -41,6 +43,7 @@ namespace AI
protected virtual void Start()
{
movement = transform.GetComponentInParent<IMovement>();
animator = transform.GetComponentInParent<Animator>();
UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform);
}
@@ -57,8 +60,11 @@ namespace AI
isShooting = true;
float movementBaseSpeed = movement.BaseSpeed;
movement.BaseSpeed = 0f;
animator.SetBool("isAttacking", true);
animator.speed = 0f;
yield return new WaitForSeconds(focusingTime);
animator.speed = 1f;
while (canShoot)
{
@@ -67,6 +73,7 @@ namespace AI
yield return null;
}
movement.BaseSpeed = movementBaseSpeed;
animator.SetBool("isAttacking", false);
isShooting = false;
}
@@ -77,7 +84,7 @@ namespace AI
Vector3 velocity = GetVelocityForProjectile(timeForProjectileToHit);
RaycastHit2D raycastHit2D = Physics2D.Raycast(transform.position, target.position - transform.position, attackRange);
RaycastHit2D raycastHit2D = Physics2D.Raycast(transform.position, target.position - transform.position, attackRange, layerMask);
if (raycastHit2D.transform != target)
velocity = GetVelocityForProjectile(timeForProjectileToHit * 2);

View File

@@ -41,6 +41,8 @@ namespace Level
needsRestart = false;
}
public void EndLevel() => PlayerPrefs.SetInt(LevelName, 1);
[ContextMenu("Restart")]
public void Restart() => LevelManager.Instance.SwitchToLevel(LevelName);
}

View File

@@ -0,0 +1,12 @@
namespace Level
{
using UnityEngine;
public class LevelEnd : MonoBehaviour
{
private Level level = null;
private void Awake() => level = GetComponentInParent<Level>();
public void EndLevel() => level.EndLevel();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 696558d6c83d74a498934105513921b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: