Esempio n. 1
0
    public void CreateParticle(string Name, Vector3 position)
    {
        ParticleSFX _particle = Particles.FirstOrDefault(x => x.name == Name);

        if (_particle == null)
        {
            return;
        }

        GameObject _obj = Instantiate(_particle.gameObject, position, Quaternion.identity) as GameObject;
    }
Esempio n. 2
0
    public void DestroyWithParticle(string Name, GameObject ObjectToDestroy)
    {
        ParticleSFX _particle = Particles.FirstOrDefault(x => x.name == Name);

        if (_particle == null)
        {
            return;
        }

        GameObject  _obj  = Instantiate(_particle.gameObject, ObjectToDestroy.transform.position, ObjectToDestroy.transform.rotation) as GameObject;
        ParticleSFX _sfxP = _obj.GetComponent <ParticleSFX>();

        _sfxP.ObjectToDestroy = ObjectToDestroy;
    }
Esempio n. 3
0
    public void DamagedByHitbox(Hitbox hitbox)
    {
        //Set on fire
        if (_Properties.Contains(Properties.CanBurn) && hitbox.Properties.Contains(Properties.Fire) && !onFire)
        {
            onFire = true;

            ParticleSFX _particleFire = GameManager.Instance.Particles.FirstOrDefault(x => x.name == Defines.ParticleFire);
            GameObject  go            = Instantiate(_particleFire.gameObject, transform.position, Quaternion.identity) as GameObject;

            go.transform.parent = transform;

            ParticleController pc = go.GetComponent <ParticleController>();
            pc.vScaleMin = transform.localScale;
            pc.vScaleMax = transform.localScale * 1.1f;
            pc.fTimeLife = Defines.burningTime;
            Invoke("QuitBurning", Defines.burningTime);
        }
    }
Esempio n. 4
0
    void OnTriggerEnter(Collider col)
    {
        int Cure = 0;

        if (col.name == Defines.Player)
        {
            Creature Player = GameManager.Instance.Player;

            switch (opcion)
            {
            case Option.Health:
            {
                Cure = Random.Range(40, 60) / 100 * Player.GetComponent <Life>().life.value;
                Player.GetComponent <Life>().OnHeal(Cure);
                break;
            }

            case Option.Explosion:
            {
                Cure = Random.Range(10, 25) / 100 * Player.GetComponent <Life>().life.value;
                Player.GetComponent <Life>().OnDamage(Cure);
                //Todo
                // en lugar de partículas spawmeamos un enemigo
                //instanciamos las partículas de explosión
                ParticleSFX _particleFire = GameManager.Instance.Particles.FirstOrDefault(x => x.name == Defines.ParticleDustExplosion);
                break;
            }

            case Option.Fairy:
            {
                //instanciamos las partículas de explosión
                ParticleSFX _particleFire = GameManager.Instance.Particles.FirstOrDefault(x => x.name == Defines.ParticleDeath);
                break;
            }

            default: break;
            }


            Destroy(this.gameObject);
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Encargada del desplazamiento a un punto seguro
    /// para el respawn de tu cadaver
    /// cinemática de la muerte y recarga del nivel actual
    /// </summary>
    /// <returns></returns>
    public IEnumerator CorrutinaDeLaMuerte()
    {
        float nearDistObj  = Mathf.Infinity;
        float distance     = 0.0f;
        float SizeVelocity = 2.0f;

        EnablePlayerNoDesactivate(false);

        //instanciamos las partículas de muerte
        ParticleSFX _particleFire = GameManager.Instance.Particles.FirstOrDefault(x => x.name == Defines.ParticleDeath);

        GameObject goSpawn = null;

        //Buscamos el punto seguro más cercano.
        List <GameObject> go = GameObject.FindGameObjectsWithTag(Defines.PuntoSeguro).ToList();

        foreach (GameObject goAux in go)
        {
            distance = Vector3.Distance(Player.transform.position, goAux.transform.position);

            if (distance < nearDistObj)
            {
                goSpawn     = goAux;
                nearDistObj = distance;
            }
        }

        //Trasladamos al player al pto seguro
        Player.transform.position = goSpawn.transform.position;

        GameObject creature = GameObject.Instantiate(Corpse.gameObject, Player.transform.position, Player.transform.rotation) as GameObject;

        creature.transform.localScale = new Vector3(Defines.Scala01, Defines.Scala01, Defines.Scala01);

        while (!creature.Equals(null) && creature.transform.localScale != Vector3.one)
        {
            creature.transform.localScale = Vector3.Lerp(creature.transform.localScale, Vector3.one, Time.fixedDeltaTime * SizeVelocity);
            yield return(new WaitForEndOfFrame());
        }

        LoadLevel(CurrentlyLoadedLevel);
    }