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