Example #1
0
    public void Add(SceneObjectData data, float totalDistance)
    {
        SceneObject so;

        so = GetSceneObject(data.type);

        if (so == null)
        {
            so      = CreateNew(data.type);
            so.data = data;
        }

        sceneObjects_inScene.Add(so);
        Vector3 pos = lanes.GetCoordsByLane(data.laneID);

        pos.x = data.pos.x + totalDistance;
        so.transform.SetParent(container);
        so.transform.localPosition = pos;
        so.AddToLane(data.laneID);
        so.Init();

        if (so.GetComponent <Enemy>())
        {
            so.GetComponent <Enemy>().InitCharacter(Data.Instance.customizer.GetRandomData(), null, data.laneID);
        }
    }