예제 #1
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        print("got deserialization for: " + info.scriptTarget);

        serializationData data = (serializationData)info;

        print("deserilazing building_marker...");

        List <GameObject> prefabs     = GameObject.Find("Terrain").GetComponent <SaveLoad>().prefabs;
        GameObject        prefabFound = null;

        foreach (GameObject prefab in prefabs)
        {
            if (prefab.name.Equals(data.buildTo))
            {
                prefabFound = prefab;
                break;
            }
        }

        this.buildTo      = prefabFound;
        this.inited       = data.inited;
        this.Info         = buildTo.GetComponent <Structure>();
        this.overrideCost = data.overrideCost;
        this.missing      = data.missing;
        this.ordered      = data.ordered;
        this.GetComponent <MeshFilter>().sharedMesh   = buildTo.GetComponent <MeshFilter>().sharedMesh;
        this.GetComponent <MeshCollider>().sharedMesh = buildTo.GetComponent <MeshFilter>().sharedMesh;
        fixScale();
    }
예제 #2
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        serializationData data = (serializationData)info;

        print("deserilazing HP handler..., HP=" + data.HP);
        this.HP        = data.HP;
        this.initialHP = data.initialHP;
        this.type      = data.type;
    }
예제 #3
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        print("got deserialization for: " + info.scriptTarget);

        serializationData data = (serializationData)info;

        print("deserilazing...");
        this.maxSize    = data.maxSize;
        this.newContent = data.newContent;
    }
예제 #4
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        print("got deserialization for: " + info.scriptTarget);

        serializationData data = (serializationData)info;

        print("deserilazing...");
        var rData = new ReactorLogic.HeatableStructure();

        rData.temperature = data.temp;
        this.setData(rData);
    }
예제 #5
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        print("got deserialization for: " + info.scriptTarget);

        serializationData data = (serializationData)info;

        print("deserilazing...");
        if (data.active)
        {
            //start reactor
            StartCoroutine(startReactor());
        }
    }
예제 #6
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        print("got deserialization for: " + info.scriptTarget);

        serializationData data = (serializationData)info;

        print("deserilazing movement controller...");
        this.target = data.target;
        try {
            this.targetObject = atPos(data.targetObject).transform;
        } catch (NullReferenceException ex) {
            this.targetObject = null;
        }
    }
예제 #7
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        serializationData data = (serializationData)info;

        print("deserilazing Action controller...");
        this.idleTimer         = data.idleTimer;
        this.idleDeliveryTimer = data.idleDeliveryTimer;
        this.curState          = data.curState;
        this.delivery          = data.delivery;
        this.target            = atPos(data.target);
        this.lastTarget        = atPos(data.lastTarget);
        this.deliverTarget     = atPos(data.deliverTarget);
        this.deliverFrom       = atPos(data.deliverFrom);
    }
예제 #8
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        serializationData data = (serializationData)info;

        this.storedEnergy = data.storedEnergy;
        this.busy         = data.busy;
        this.ownResource  = data.ownResource;
        this.salvaging    = data.salvaging;

        if (salvaging)
        {
            Debug.Log("got salvaging info, creating particles....");
            //TODO, this gets called before terrain scripts are loaded
            //GameObject.Instantiate(ParticleHelper.getInstance().salvageParticles, this.gameObject.transform);
        }

        //reloadConnections();
    }
예제 #9
0
    public new void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        serializationData data = (serializationData)info;

        this.storedEnergy = data.storedEnergy;
        this.busy         = data.busy;
        this.ownResource  = data.ownResource;
        this.salvaging    = data.salvaging;
        if (this.busy)
        {
            DeliveryRoutes.addRoute(this.gameObject, DeliveryRoutes.getClosest("dropBase", this.gameObject).gameObject, ressources.Trees);
        }

        if (salvaging)
        {
            GameObject.Instantiate(ParticleHelper.getInstance().salvageParticles, this.gameObject.transform);
        }

        //reloadConnections();
    }
예제 #10
0
    public void handleDeserialization(SaveLoad.SerializationInfo info)
    {
        serializationData data = (serializationData)info;

        //create new data
        var from       = findClosestConnection(data.from).transform.parent.gameObject;
        var to         = findClosestConnection(data.to).transform.parent.gameObject;
        var connection = data.connection.getOriginal(from, to);

        print("deserialized data: " + connection);
        this.setData(connection);
        this.loaded = data;

        //create conveyor boxes at end
        var bBox = GameObject.Instantiate(ConveyorBegin, data.from, ConveyorBegin.transform.rotation);
        var eBox = GameObject.Instantiate(ConveyorBegin, data.to, ConveyorBegin.transform.rotation);

        connection.createdObjs.Add(bBox);
        connection.createdObjs.Add(eBox);
        connection.createdObjs.Add(this.gameObject);
    }