Example #1
0
    //MAIN-----------------------------------------------------------------------------------------------------------------
    void Start()
    {
        halfSize = GetComponent <BoxCollider2D>().size.y / 2;

        hp       = hpMax;
        stealth  = isStealth;
        orgPos   = transform.position;
        rb       = GetComponent <Rigidbody2D>();
        mySprite = GetComponent <SpriteRenderer>();
        auraDmg  = aura.GetComponent <EnemyDMG>();

        deathExplosion = transform.Find("DeathExplosion").GetComponent <DeathExplosion>();

        animator = GetComponent <Animator>();

        soundHandler = GetComponent <OozeSoundHandler>();
        audioSource  = GetComponent <AudioSource>();

        if (stealth)
        {
            mySprite.material = chameleonMat;
        }
        else
        {
            mySprite.material = defaultMat;
        }
    }
Example #2
0
    //MAIN-----------------------------------------------------------------------------------------------------------------
    void Start()
    {
        hp        = hpMax;
        orgPos    = transform.position;
        rb        = GetComponent <Rigidbody2D>();
        objPlayer = GameObject.FindGameObjectWithTag("Player");
        mySprite  = GetComponent <SpriteRenderer>();
        auraDmg   = aura.GetComponent <EnemyDMG>();

        questHandler = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerQuestHandler>();

        stealth = true;

        deathExplosion = transform.Find("DeathExplosion").GetComponent <DeathExplosion>();

        animator = GetComponent <Animator>();

        soundHandler = GetComponent <PaintSoundHandler>();

        mouthSprite = transform.Find("Mouth").GetComponent <SpriteRenderer>();

        if (stealth)
        {
            mySprite.material    = chameleonMat;
            mouthSprite.material = chameleonMat;
        }
        else
        {
            mySprite.material    = defaultMat;
            mouthSprite.material = defaultMat;
        }
    }
Example #3
0
    //MAIN-----------------------------------------------------------------------------------------------------------------
    void Start()
    {
        stealth  = isStealth;
        orgPos   = transform.position;
        rb       = GetComponent <Rigidbody2D>();
        mySprite = GetComponent <SpriteRenderer>();
        auraDmg  = aura.GetComponent <EnemyDMG>();

        questHandler = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerQuestHandler>();

        animator = GetComponent <Animator>();

        soundHandler = GetComponent <DanceSoundHandler>();
        audioSource  = GetComponent <AudioSource>();

        if (stealth)
        {
            mySprite.material = chameleonMat;
        }
        else
        {
            mySprite.material = defaultMat;
        }
    }
Example #4
0
    //Wenn der Spieler im DMG des Gegners steht und er verwundbar ist, bekommt er Schaden und wird kurzzeitig unverwundbar
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (/*dmgTimer<=0 && */ collision.gameObject.tag == "DmgToPlayer")
        {
            //Variables

            EnemyDMG enemyDMG = collision.GetComponent <EnemyDMG>();
            int      dir      = 1;

            //Prüft ob Gegner bereits erneut Schaden verursachen kann
            if (enemyDMG.timer < 0)
            {
                //DMG to player
                hp -= enemyDMG.dmg;
                if (!dead)
                {
                    GetComponent <PlayerSoundHandler>().Hit();
                }
                //print("HP: " + hp);

                //UnverwundbarkeitsTimer
                //dmgTimer = dmgCD;
                //print("Timer: " + dmgTimer);

                //Knockback
                if (collision.transform.position.x > transform.position.x)
                {
                    dir = -1;
                }
                GetComponent <PlayerController>().KnockBack(enemyDMG.knockback * dir);
                //print("Knockback: " + enemyDMG.knockback);

                //Timer bis Gegner erneut Schaden verursachen kann
                enemyDMG.timer = enemyDMG.dmgTime;
            }
        }
        if (/*dmgTimer <= 0 && */ poetryBuff <= 0 && collision.gameObject.tag == "PoetryDmgToPlayer")
        {
            //Variables
            EnemyDMG enemyDMG = collision.GetComponent <EnemyDMG>();

            //Die Sirene verursacht Schaden pro Sekunde!
            hp -= Time.deltaTime * enemyDMG.dmg;
            //print("HP: " + hp);

            //Prüft ob Gegner bereits erneut Schaden verursachen kann
            if (enemyDMG.timer < 0)
            {
                //Die Sirene verursacht Schaden pro Sekunde!
                hp -= Time.deltaTime * enemyDMG.dmg;
                GetComponent <PlayerSoundHandler>().Hit();
                //print("HP: " + hp);

                //UnverwundbarkeitsTimer
                //dmgTimer = dmgCD;
                //print("Timer: " + dmgTimer);

                //Timer bis Gegner erneut Schaden verursachen kann
                enemyDMG.timer = enemyDMG.dmgTime;
            }
        }
    }