public void explode()
    {
        if (!Live)
        {
            return;
        }
        Live = false;

        ParticleExplosion.Play();
        Remove();
    }
Exemplo n.º 2
0
    //public ParticleSystem ImpactParticles;
    public void explode()
    {
        if (!Live)
        {
            return;
        }
        Live = false;

        ParticleExplosion.Play(true);
        if (Astronaut.AggressionLevel > 0)
        {
            VoidField vf = GameObject.Instantiate <VoidField>(VoidFieldPrefab, this.transform.position, VoidFieldPrefab.transform.rotation);
            vf.Duration    = (2f + (.5f * Astronaut.AggressionLevel));
            vf.ForceFactor = (1f + (.2f * Astronaut.AggressionLevel));
        }

        Remove();
    }
Exemplo n.º 3
0
    public void explode()
    {
        if (!Live)
        {
            return;
        }
        if (IsSpore)
        {
            Live = false;
            ParticleExplosion.Play(true);
            Remove();
        }
        else
        {
            if (IsSubdivided)
            {
                Live = false;
                ParticleExplosion.Play(true);
                Remove();
            }
            else
            {
                int subs    = (6 + (Astronaut.AggressionLevel * 2));
                int subsets = (1);

                for (int i = 0; i < (subs * subsets); i++)
                {
                    JungleTreeProjectile proj = GameObject.Instantiate(this.gameObject, this.transform.position, this.transform.rotation).GetComponent <JungleTreeProjectile>();
                    proj.transform.localScale = (this.transform.localScale * (.3f));
                    proj.DamageRatio          = (DamageRatio * (1f / ((float)(subs * subsets))));
                    float ang = (360f * (((float)i) / ((float)(subs))));
                    proj.MyRigidbody.velocity  = (new Vector2(Mathf.Cos((ang / 360f) * 2f * Mathf.PI), Mathf.Sin((ang / 360f) * 2f * Mathf.PI)) * this.MyRigidbody.velocity.magnitude * ((1 + (i / subs)) / subsets));
                    proj.IsSubdivided          = true;
                    proj.StartTime             = Time.time;
                    proj.MyConstantForce.force = (Random.insideUnitCircle.normalized * WINDFORCEFACTOR);
                    //proj
                }
                IsSubdivided = true;
                Live         = false;
                ParticleExplosion.Play(true);
                Remove();
            }
        }
    }
Exemplo n.º 4
0
        public virtual void KillUnit()
        {
            if (!isAlive)
            {
                return;
            }

            isAlive = false;

            //Debug.Log("Kill unit");
            if (explosion)
            {
                explosion.Play();
            }

            EventManager.Units.onUnitDestroyed?.Invoke(this);
            GameManager.Instance.unitManager.Unregister(this);

            if (gameObject)
            {
                Destroy(gameObject);
            }
        }