Ejemplo n.º 1
0
    IEnumerator SpawnParticle(GameObject enemy, Vector3 SP)
    {
        //spawn particle
        //float delay = enemy.GetComponent<EnemyAI>().spawnParticleDelay;
        ParticleSystem temp = new ParticleSystem();

        if (enemy.tag != "Untagged")
        {
            particleControl p = enemy.GetComponent <EnemyAI>().spawnParticle;
            if (p != null)
            {
                if (!p.gameObject.activeInHierarchy)
                {
                    p.gameObject.SetActive(true);
                }
                Instantiate(p, SP, Quaternion.identity);
            }
            else
            {
                temp = Instantiate(defalseSpawnParticle.particle, SP, Quaternion.identity);
            }
        }
        //yield return new WaitForSeconds((delay == 0 ? defaultDelay : delay));
        yield return(new WaitForSeconds(defaultDelay));

        //spawn monster
        enemy.gameObject.SetActive(true);
        if (temp != null)
        {
            Destroy(temp.gameObject);
        }
    }
Ejemplo n.º 2
0
    public void showParticleEffect(particleControl DamParticle)
    {
        if (DamParticle == null)
        {
            return;
        }
        particleControl newParticle = Instantiate(DamParticle);

        newParticle.transform.SetParent(transform);
        newParticle.setParticle(transform);
    }
Ejemplo n.º 3
0
    void Start()
    {
        enemySpawnSystem = EnemySpawnSystem.Instance;
        if (enemySpawnSystem == null)
        {
            throw new System.Exception("no enemySpawnSystem in scene");
        }

        col = GetComponent <Collider>();
        if (col != null)
        {
            col.isTrigger = true;
        }
        defalseSpawnParticle = enemySpawnSystem.defalseSpawnParticle;
        defalseSpawnParticle.gameObject.SetActive(true);
    }