示例#1
0
    public override void Load(ObjSave o)
    {
        base.Load(o);

        WalkerSave w = (WalkerSave)o;

        //retrieve origin and destination structures
        if (w.origin != null)
        {
            Origin = GameObject.Find(world.Map.GetBuildingNameAt(w.origin)).GetComponent <Structure>();
        }
        if (w.destination != null)
        {
            Destination = GameObject.Find(world.Map.GetBuildingNameAt(w.destination)).GetComponent <Structure>();
        }

        Stuck         = w.stuck;
        ReturningHome = w.returningHome;

        Prevx       = w.prevx;
        Prevy       = w.prevy;
        LaborPoints = w.laborPoints;

        MovementDistance = w.movementDistance;

        Path         = w.path;
        VisitedSpots = w.visitedSpots;
        Direction    = w.direction.GetVector3();
        Order        = w.order;
    }
示例#2
0
    public override void Load(ObjSave o)
    {
        base.Load(o);

        WalkerSave w = (WalkerSave)o;

        //retrieve origin and destination structures
        if (w.origin != null)
        {
            Origin = GameObject.Find(world.Map.GetBuildingNameAt(w.origin)).GetComponent <Structure>();
        }
        if (w.destination != null)
        {
            Destination = GameObject.Find(world.Map.GetBuildingNameAt(w.destination)).GetComponent <Structure>();
        }

        Stuck           = w.stuck;
        SpawnedFollower = w.SpawnedFollower;
        GoingOnRamp     = w.GoingOnRamp;

        Prevx       = w.prevx;
        Prevy       = w.prevy;
        LaborPoints = w.laborPoints;
        lifeTime    = w.lifeTime;
        yield       = w.yield;

        MovementDistance = w.movementDistance;

        Path         = w.path;
        VisitedSpots = w.visitedSpots;
        Direction    = w.direction;
        Order        = w.order;

        data       = w.data;
        PersonData = w.PersonData;

        Skin = PersonData != null?PersonData.skinColor.GetColor() : GetSkinColor();

        if (meshRenderer != null)
        {
            meshRenderer.material.color = Skin;
        }

        LoadFollower(w.follower);

        world.EnterSquare(this, X, Y);
    }
示例#3
0
    public WalkerSave(GameObject go) : base(go)
    {
        Walker w = go.GetComponent <Walker>();

        //save origin and destination as coordinates
        Structure o = w.Origin;

        if (o != null)
        {
            origin = new Node(o.X, o.Y);
        }
        Structure d = w.Destination;

        if (d != null)
        {
            destination = new Node(d.X, d.Y);
        }

        prevx       = w.Prevx;
        prevy       = w.Prevy;
        laborPoints = w.LaborPoints;
        lifeTime    = w.lifeTime;
        yield       = w.yield;

        movementDistance = w.MovementDistance;

        stuck           = w.Stuck;
        SpawnedFollower = w.SpawnedFollower;
        GoingOnRamp     = w.GoingOnRamp;

        direction = w.Direction;
        order     = w.Order;

        path         = w.Path;
        visitedSpots = w.VisitedSpots;
        skin         = new Float3d(w.Skin);

        data       = w.data;
        PersonData = w.PersonData;


        if (w.Follower != null)
        {
            follower = new WalkerSave(w.Follower.gameObject);
        }
    }
示例#4
0
    public void LoadFollower(WalkerSave w)
    {
        if (w == null)
        {
            return;
        }

        GameObject go = Instantiate(Resources.Load <GameObject>("Walkers/Followers/" + followerName), new Vector3(Prevx, 0, Prevy), transform.rotation);

        go.name = followerName;

        Follower f = go.GetComponent <Follower>();

        SpawnedFollower = true;
        f.Leader        = this;
        f.world         = world;
        f.Load(w);
        Follower = f;
    }