Pull request #9: Fixed dying twice
Merge in CEGJ/ludumdare50 from jason to dev * commit '5545e42e5aff22b859a3f55bcb8a896e8195a25f': Fixed dying twice
This commit is contained in:
commit
1d8d4c572e
@ -675,6 +675,10 @@ PrefabInstance:
|
||||
propertyPath: gameFlowManager
|
||||
value:
|
||||
objectReference: {fileID: 1359990806}
|
||||
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
||||
propertyPath: arena
|
||||
value:
|
||||
objectReference: {fileID: 397851252}
|
||||
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
||||
propertyPath: healthBar
|
||||
value:
|
||||
|
||||
@ -153,6 +153,8 @@ public class AIEntity : Entity
|
||||
if(!entity.IsAlive()){
|
||||
return new DeadState(entity);
|
||||
}
|
||||
|
||||
if (entity.gameFlowManager.CanDoAction) {
|
||||
if(entity.IsInAttackRange()){
|
||||
if(entity.attackTimer >= entity.attackCooldown){
|
||||
entity.attackTimer = 0;
|
||||
@ -161,9 +163,10 @@ public class AIEntity : Entity
|
||||
entity.attackTimer += Time.deltaTime;
|
||||
}
|
||||
|
||||
}else{
|
||||
}else
|
||||
return new SeekState(entity);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -102,14 +102,14 @@ public class GameFlowManager : MonoBehaviour {
|
||||
public override void EnterState() {
|
||||
base.EnterState();
|
||||
|
||||
gameFlowManager.gameTimer.StartTimer();
|
||||
gameFlowManager.gameTimer.stopped = false;
|
||||
gameFlowManager.SetPauseLevel(PauseLevel.NotPaused);
|
||||
}
|
||||
|
||||
public override void LeaveState() {
|
||||
base.LeaveState();
|
||||
|
||||
gameFlowManager.gameTimer.PauseTimer();
|
||||
gameFlowManager.gameTimer.stopped = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,20 +5,14 @@ using UnityEngine;
|
||||
public class GameTimer : MonoBehaviour {
|
||||
TMP_Text label;
|
||||
float timer;
|
||||
bool stopped;
|
||||
public bool stopped;
|
||||
|
||||
void Awake() {
|
||||
label = GetComponent<TMP_Text>();
|
||||
timer = 0f;
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
public void StartTimer() {
|
||||
timer = Time.time;
|
||||
stopped = false;
|
||||
}
|
||||
|
||||
public void PauseTimer() => stopped = true;
|
||||
|
||||
void Update() {
|
||||
if (stopped)
|
||||
return;
|
||||
|
||||
@ -55,6 +55,9 @@ public class MinionThrower : MonoBehaviour {
|
||||
}
|
||||
|
||||
public void AimThrow(InputAction.CallbackContext context) {
|
||||
if (!gameFlowManager.CanDoAction)
|
||||
return;
|
||||
|
||||
throwDirection = context.ReadValue<Vector2>().normalized;
|
||||
if (vampireEntity.playerMovement.facingRight) {
|
||||
aimArrow.transform.rotation = Quaternion.FromToRotation(Vector2.right, throwDirection);
|
||||
|
||||
@ -9,6 +9,11 @@ public class VampireEntity : Entity {
|
||||
// HealthBar healthBar;
|
||||
[HideInInspector] public PlayerMovement playerMovement;
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
transform.SetParent(arena.minionParent);
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
base.entityType = EntityFlag.Vampire;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user