// Start is called before the first frame update void Start() { currHP = maxHP; hpState = healthState.DefaultState; currentStateManager = GameObject.Find("StateMachine").GetComponent <StateManager>(); }
//Subtract HP public void DecreaseHP(float hpLoss) { hpState = healthState.LosingHP; currHP -= (hpLoss + (currentStateManager.waveCount * 5)); /** Increase damage loss with each wave. By default, * this should mean that enemy and player both loss 30 HP on wave 1, * with an additional 5 HP added as the game goes on (I am projecting a * 50 HP loss by wave 5**/ }
private void writePaper() { if (haveLetter != letterList.HaveWritten) { if (Input.GetKey(KeyCode.E) && (haveLetter == letterList.Have || haveLetter == letterList.IsWriting) && onDoor == false) { Health = healthState.Paper; MasterAudio.PlaySound("paper_in"); MasterAudio.PlaySound("writting"); haveLetter = letterList.IsWriting; levMan.writtenPaper += LevelManager.TUNING.writingSpeed; paper.alpha = 1f; papertxt.color = papertxt.initColor; papertxt.text = levMan.realWrittenPaper + "%"; paper.transform.parent.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); } else if (Input.GetKeyUp(KeyCode.E) && (haveLetter == letterList.Have || haveLetter == letterList.IsWriting) && onDoor == false) { Health = healthState.Alive; MasterAudio.StopAllOfSound("writting"); MasterAudio.PlaySound("paper_out"); paper.alpha = 0f; papertxt.color = Color.clear; paper.transform.parent.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); } } if (levMan.writtenPaper > 100 && haveLetter != letterList.Sent) { MasterAudio.StopAllOfSound("writting"); Health = healthState.Alive; haveLetter = letterList.HaveWritten; paper.alpha = 0f; papertxt.color = Color.clear; } }
private void Respawn() { Health = healthState.Alive; foodState = 3; sleepState = 3; haveLetter = letterList.DontHave; transform.position = initpos; InvokeRepeating("consumeFood", LevelManager.TUNING.delaySecConsumeFood, LevelManager.TUNING.everySecConsumeFood); InvokeRepeating("consumeSleep", LevelManager.TUNING.delaySecConsumeSleep, LevelManager.TUNING.everySecConsumeSleep); }
private void GameStart() { Health = healthState.Cutscene; haveLetter = letterList.DontHave; }
private void GameOver() { print (LevelManager.CAUSEDEATH); Health = healthState.Dead; if (LevelManager.CAUSEDEATH == LevelManager.DeathList.Dracula) { PlayAnim("die"); } CancelInvoke("Foots"); CancelInvoke("consumeFood"); CancelInvoke("consumeSleep"); }
//Add HP public void IncreaseHP(float hpGain) { hpState = healthState.GainingHP; currHP += hpGain; }