Example #1
0
    private float getSpeedById(int id)
    {
        if (mineList.Count == 0)
        {
            return(-1);
        }
        List <Spawner> templist = mineList[0].getSpawnerList();

        foreach (Spawner i in templist)
        {
            if (i.spawnUnit.GetComponent <GameobjBase>().game_ID == id)
            {
                if (IDs.getLayerByID(id) == Layers.VEHICLE)
                {
                    return(i.spawnUnit.GetComponent <GameobjBase>().GetComponent <RailwayMovable>().speed);
                }
                if (IDs.getLayerByID(id) == Layers.CHARACTER)
                {
                    return(i.spawnUnit.GetComponent <GameobjBase>().GetComponent <Roadmovable>().speed);
                }
                break;
            }
        }
        return(-1);
    }