public void ensureStatus(alertStatus newStatus) { if (curState != newStatus) { changeStatus(newStatus); } }
public void playCalm() { if (curState != alertStatus.calm) { audio.clip = audioCalm; audio.Play(); curState = alertStatus.calm; } }
public void playSpotted() { if (curState != alertStatus.spotted) { audio.clip = audioSpotted; audio.Play(); curState = alertStatus.spotted; } }
public void playAlarm() { if (curState != alertStatus.alert) { audio.clip = audioAlarm; audio.Play(); curState = alertStatus.alert; } }
public void changeStatus(alertStatus newStatus) { curState = newStatus; //Debug.Log("new state: " + newStatus); if (curState == alertStatus.calm) { audio.playCalm(); //canAttack = true; if (isStationary == true) { Mtr.setTarget(patrolRoute[0].position); } } else if (newStatus == alertStatus.spotted) { audio.playSpotted(); //spotted(); } else if (newStatus == alertStatus.inspect) { //inspect(); } else if (newStatus == alertStatus.alert) { if (type == charType.villager) { //Debug.Log("go to safe zone"); Mtr.setTarget(SafeZoneWP.getP()); } if (Threat == player) { Hostile = true; Vis.Layers = HostileMask; GetComponentInChildren <SpriteRenderer>().color = new Color(1.0f, 0.5f, 0.5f); } audio.playAlarm(); //alert(); } else if (newStatus == alertStatus.flee) { Mtr.setTarget(SafeZoneWP.getP()); } }
// Use this for initialization void Awake() { audio = this.gameObject.GetComponent<AudioSource>(); audio.volume = 0.1f; curState = alertStatus.calm; }
// Use this for initialization void Awake() { audio = this.gameObject.GetComponent <AudioSource>(); audio.volume = 0.1f; curState = alertStatus.calm; }