示例#1
0
    protected virtual void OnProjectileUpdate(ProjectileHandler projectile)
    {
        if (projectile.LifeSpan < projectile.Airtime)
        {
            projectile.ToDestroy();
            return;
        }

        projectile.transform.position += (Vector3)projectile.Velocity
                                         * Time.deltaTime;
    }
示例#2
0
    protected override void OnProjectileUpdate(ProjectileHandler projectile)
    {
        if (projectile.LifeSpan < projectile.Airtime)
        {
            projectile.ToDestroy();
            return;
        }

        float s = 1 - (projectile.Airtime / projectile.LifeSpan);

        projectile.transform.localScale =
            new Vector3(s, s, 1);
    }
示例#3
0
    protected virtual void OnProjectileHit(
        ProjectileHandler projectile, Collider2D collision)
    {
        if (projectile.IsSameSender(collision.gameObject))
        {
            return;
        }

        BaseController controller = collision.gameObject
                                    .GetComponent <BaseController>();

        if (controller)
        {
            controller.ProjectileHit(projectile);
        }

        projectile.ToDestroy();
    }