Ejemplo n.º 1
0
    protected void RemoveProjectile(int projectileIndex)
    {
        GameObject           projectileObject    = null;
        ProjectileController projectileComponent = null;

        if (projectileObjects != null)
        {
            if ((projectileIndex > -1) && (projectileIndex < projectileObjects.Length))
            {
                /*halmeida - relying on the coherence of all the "projectile" arrays.*/
                projectileComponent = projectileComponents[projectileIndex];
                RemoveProjectileInfluence(projectileComponent);
                projectileComponent.Clear();
                projectileObject = projectileObjects[projectileIndex];
                Destroy(projectileObject);
                UsefulFunctions.DecreaseArray <ProjectileController>(ref projectileComponents, projectileIndex);
                UsefulFunctions.DecreaseArray <GameObject>(ref projectileObjects, projectileIndex);
            }
        }
    }
Ejemplo n.º 2
0
    protected void ClearProjectiles()
    {
        GameObject           projectileObject    = null;
        ProjectileController projectileComponent = null;

        if (projectileObjects != null)
        {
            for (int i = 0; i < projectileObjects.Length; i++)
            {
                projectileComponent = projectileComponents[i];
                RemoveProjectileInfluence(projectileComponent);
                projectileComponent.Clear();
                projectileComponents[i] = null;
                projectileObject        = projectileObjects[i];
                Destroy(projectileObject);
                projectileObjects[i] = null;
            }
            projectileComponents = null;
            projectileObjects    = null;
        }
    }