Exemple #1
0
 void Spawn()
 {
     if (_randomSpawn != null)
     {
         _points = _randomSpawn.Spawn(2, 2f);
     }
 }
Exemple #2
0
    /// <summary>
    /// Zerstört den Feind, wenn er vom Schwert getroffen wird.
    /// (Wird aufgerufen von Sword.onCollisionDetected.)
    /// </summary>
    public void OnHitBySword()
    {
        RandomSpawn rs = GetComponent <RandomSpawn>();

        if (rs != null)
        {
            GameObject item = rs.Spawn(); //Zufällig gespawnter Schatz.
            if (item != null)
            {
                item.transform.position = transform.position;
            }
        }

        GameObject explosion = Instantiate(explosionPrototype, transform.parent);

        explosion.transform.position = transform.position;

        SaveGameData.current.RecordDestroy(gameObject); //Destroy(gameObject);
    }
Exemple #3
0
    protected IEnumerator PlayOnHitBySwordAni()
    {
        isHitAniPlaying = true;

        RandomSpawn rs = GetComponent <RandomSpawn>();

        if (rs != null)
        {
            GameObject item = rs.Spawn(); //Zufällig gespawnter Schatz.
            if (item != null)
            {
                item.transform.position = transform.position;
            }
        }

        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        for (int i = 0; i < destructionFrames.Length; i++)
        {
            sr.sprite = destructionFrames[i];
            yield return(new WaitForSeconds(duration / destructionFrames.Length));
        }
        SaveGameData.current.RecordDestroy(gameObject);
    }