Пример #1
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;
        }
    }
Пример #2
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;
        }
    }
Пример #3
0
    public void Die()
    {
        DeathExplosion deathExplosion = Instantiate(deathExplosionPrefab).GetComponent <DeathExplosion>();

        deathExplosion.transform.position = this.transform.position;
        deathExplosion.SetColor(color);
        Destroy(this.gameObject);
    }
Пример #4
0
    protected void RpcColor(GameObject obj, Color color)
    {
        obj.GetComponent <Renderer>().material.color = color;
        DeathExplosion deathExplosion = obj.GetComponentInChildren <DeathExplosion>();

        deathExplosion?.SetColor(color);

        m_headController?.SetColor(color);
        m_gun?.SetColor(color);
    }
Пример #5
0
    protected virtual void Die()
    {
        IsDead           = true;
        gameObject.layer = 9; // DeadPlayers layer;
        m_deathTime      = Time.time;
        Score.Deaths++;
        Team.AddDeath();

        DeathExplosion deathExplosion = GetComponentInChildren <DeathExplosion>();

        deathExplosion?.Fire();
        m_defaultAudioSource.PlayOneShot(m_deathSound, m_deathSoundVolume);
    }