Ejemplo n.º 1
0
	void Awake () {
		var managers = GameObject.FindWithTag ("Managers");
		timeLine = managers.GetComponent<TimeLine> ();
		slotRecord = managers.GetComponent<SlotRecord> ();
		csqTable = managers.GetComponent<MadnessConsequencesTable> ();
		soundMgr = managers.GetComponent<SoundManager> ();

		if (path == null)
			Debug.LogError (gameObject.name + " doesn't have a path");
		if (itemHolder == null)
			Debug.LogError (gameObject.name + " doesn't have an item holder");
		if (headRenderer == null)
			Debug.LogError (gameObject.name + " doesn't have an head renderer");
		if (materials.Length < 4)
			Debug.LogWarning (gameObject.name + " doesn't have enough materials");
		if (soundsMadnessConsequences.Length < 4)
			Debug.LogWarning (gameObject.name + " doesn't have enough sounds");

		anim = GetComponentInChildren<Animator> ();
		soundSrc = GetComponents<AudioSource> ();

		UpdateOrder ();
		CheckActionValidity ();
	}
Ejemplo n.º 2
0
	void PlayActionSound (CharacterAction action, bool atStart, Item item, MadnessConsequencesTable.Severity madnessSeverity) {
		if (atStart) {
			if (item != null && item.OverrideSound (soundMgr, soundSrc [0], action.animDuration))
				return;

			if (action.soundPlayed != "None")
				soundMgr.PlaySoundForDurtation (soundSrc [0], action.soundPlayed, action.animDuration);
		} else {
			string madsound = soundsMadnessConsequences[(int)madnessSeverity];
			if (madsound != "None")
				soundMgr.PlaySound (soundSrc [1], madsound);
		}
	}