Example #1
0
    /// <sumamry>
    /// Open chest coroutine.
    /// </summary>
    /// <returns>IEnumerator</returns>
    public IEnumerator OpenRoutine()
    {
        opened = true;

        // play sound.
        _audio.PlaySound();

        // remove current chest particles.
        externalParticles.Stop();

        // open chest.
        anim.SetBool("Open", true);
        yield return(new WaitForSeconds(.6f));

        innerLight.SetActive(true);
        yield return(new WaitForSeconds(1.65f));

        // play particle effects.
        foreach (ParticleSystem particles in openinigParticles)
        {
            particles.gameObject.SetActive(true);
        }

        // drop chest content into game scene.
        loot.DropLoot();
    }
Example #2
0
    /// <summary>
    /// Die method.
    /// </summary>
    public virtual IEnumerator Die()
    {
        isAlive      = false;
        canBeStunned = false;
        currentHp    = 0f;

        if (isMoving)
        {
            StopMoving();
        }

        if (inBattle)
        {
            StopBattle();
        }

        // disable physics for this enemy - they are not longer neecesary.
        if (_rigi != null)
        {
            _rigi.isKinematic = true;
            _rigi.useGravity  = false;
        }

        // remove colliders
        UpdateColliderStatus(false);

        // disable enemy in the enemy group.
        if (enemyGroup != null)
        {
            enemyGroup.DisableEnemy(publicID);
        }

        // display death particles if required.
        if (deathParticles)
        {
            StartCoroutine(deathParticles.DisplayDeathParticles());
        }

        // update data defeated value.
        data.defeated++;

        // grant player experience.
        Player.instance.weapon.GetExp(data.expGiven);

        // update UI with exp given.
        GamePlayUI.instance.weaponSectionUI.UpdateExpUI(data.expGiven);

        // let animation happen before the loot drops.
        yield return(new WaitForSeconds(.5f));

        loot.DropLoot();

        yield return(null);
    }
Example #3
0
    /// <summary>
    /// Cristal destroyed.
    /// </summary>
    public override void Destroyed()
    {
        base.Destroyed();

        // Transform crystalModelPosition = cristalModel.transform;

        // disable collider.
        Destroy(meshCollider);

        // display destroyed animation.
        StartCoroutine(DestroyedAnimation());

        // drop loot.
        if (_loot != null)
        {
            _loot.DropLoot();
        }

        // switch light off.
        cristalLight.SwitchOff();

        // destroy this object.
        Destroy(this.gameObject, secondsToDestroy);
    }