Example #1
0
    // 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];
    }
Example #2
0
 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);
 }
Example #3
0
    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();
    }
Example #4
0
    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();
    }