// Use this for initialization void Start() { renderer = GetComponent <SpriteRenderer>(); platformtypes = GetComponentInParent <Platform>().platformtype; if (platformtypes == Enums.PlatformType.DEFAULT) { gameObject.SetActive(false); return; } renderer.sprite = glasuren[(int)platformtypes - 1]; }
private void TriggerAction(Enums.PlatformType type) { foreach (Platform platform in FindObjectsOfType <Platform>()) { if (platform.platformtype == type) { platform.TriggerAction(); } } playerManager.numberCollected--; cooldownTimer = maxCooldown; StartCoroutine("PlaySound", type); }
public void PlayElement(Enums.PlatformType element) { switch (element) { case Enums.PlatformType.FEUER: audioSource.clip = fire; break; case Enums.PlatformType.WASSER: audioSource.clip = water; break; case Enums.PlatformType.STURM: audioSource.clip = storm; break; } audioSource.Play(); }
public IEnumerator PlaySound(Enums.PlatformType type) { audio.PlayElement(type); float waitTime = 0.2f; switch (type) { case Enums.PlatformType.FEUER: waitTime = GameManager.self.fireTime; break; case Enums.PlatformType.WASSER: waitTime = GameManager.self.waterTime; break; } yield return(new WaitForSeconds(waitTime)); audio.Stop(); }