예제 #1
0
    public void Destroy(EditorEntity ee)
    {
        Type type = ee.GetType();

        List <EditorEntity> targetList = null;

        if (type == typeof(ShootingEnemyEE))
        {
            targetList = shootingEnemies;
        }
        else if (type == typeof(WalkingEE))
        {
            targetList = walkingEnemies;
        }
        else if (type == typeof(CheckpointEE))
        {
            targetList = checkpoints;
        }
        else if (type == typeof(LevelExitEE))
        {
        }
        else if (type == typeof(PlayerEE))
        {
        }

        // once done, search it in the target list and destroy it
        if (targetList != null)
        {
            for (int iii = 0; iii < targetList.Count; iii++)
            {
                if (targetList[iii].Equals(ee))
                {
                    targetList.RemoveAt(iii);
                    Destroy(ee.gameObject);
                }
            }
        }
    }