Exemplo n.º 1
0
 private void Update()
 {
     timer += Time.deltaTime;
     if (timer >= LifeTime)
     {
         PoolObject.Despawn();
     }
 }
Exemplo n.º 2
0
        private void OnTriggerExit(Collider other)
        {
            PoolObject poolObject = other.GetComponent <PoolObject>();

            if (poolObject != null)
            {
                poolObject.Despawn();
            }
            else
            {
                Destroy(other.gameObject);
            }
        }
Exemplo n.º 3
0
 private void Update()
 {
     timer += Time.deltaTime;
     if (timer >= LifeTime)
     {
         PoolObject.Despawn(PoolObject);
         if (ParticleSystem != null)
         {
             ParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting);
         }
         return;
     }
 }
Exemplo n.º 4
0
    private void Update()
    {
        Timer += Time.deltaTime;
        float p = Timer / FadeTime;
        float x = FadeCurve.Evaluate(p);

        Decal.fadeFactor = x;

        if (p >= 1f)
        {
            PoolObject.Despawn(this);
        }
    }
Exemplo n.º 5
0
    private void Update()
    {
        foreach (var mat in Renderer.materials)
        {
            var c = mat.color;
            c.a       = timer / Life;
            mat.color = c;
        }

        timer -= Time.deltaTime;
        if (timer <= 0f)
        {
            PoolObject.Despawn(this.gameObject);
        }
    }
Exemplo n.º 6
0
    private void Update()
    {
        timer += Time.deltaTime;
        if (timer >= Duration)
        {
            PoolObject.Despawn(this);
        }

        float alpha = 1f - Mathf.Clamp01(timer / Duration);

        var c = Sprite.color;

        c.a          = alpha;
        Sprite.color = c;

        Light.intensity = BaseLightIntensity * alpha;
    }
Exemplo n.º 7
0
    private void MoveAndCollide(Vector3 oldPos, Vector3 newPos)
    {
        bool didHit = Physics.Linecast(oldPos, newPos, out RaycastHit hit, CollisionMask, QueryTriggerInteraction.Ignore);

        if (didHit)
        {
            PoolObject.Despawn(this);
            Pawn   p = hit.transform.GetComponentInParent <Pawn>();
            Health h = hit.transform.GetComponentInParent <Health>();
            if (p != null)
            {
                p.AddKnockback(Direction * KnockbackMultiplier);
            }

            UponCollision(hit, p, h);
        }
        else
        {
            transform.position = newPos;
        }
    }
Exemplo n.º 8
0
 public void Despawn()
 {
     PoolObject.Despawn(this);
 }
Exemplo n.º 9
0
 private void UponDespawn()
 {
     // This may seem odd, but there is a reason for it. Trust me.
     PoolObject.Despawn(this.PoolObject);
 }