Пример #1
0
        public RoamingJobState(Vector3Int pos, Colony colony, string objectiveType, IRoamingJobObjective settings = null)
        {
            Position      = pos;
            RoamObjective = objectiveType;
            Colony        = colony;

            if (settings == null)
            {
                RoamingJobSettings = RoamingJobManager.GetCallbacks(objectiveType);
            }
            else
            {
                RoamingJobSettings = settings;
            }

            Initialize();
        }
Пример #2
0
        public RoamingJobState(JSONNode baseNode, Colony colony)
        {
            Position = (Vector3Int)baseNode[nameof(Position)];
            Colony   = colony;

            if (baseNode.TryGetAs <string>(nameof(RoamObjective), out var ro))
            {
                RoamObjective = ro;
            }

            if (baseNode.TryGetAs(nameof(ActionEnergy), out JSONNode ItemsRemovedNode) && ItemsRemovedNode.NodeType == NodeType.Object)
            {
                foreach (var aNode in ItemsRemovedNode.LoopObject())
                {
                    ActionEnergy.Add(aNode.Key, aNode.Value.GetAs <int>());
                }
            }

            RoamingJobSettings = RoamingJobManager.GetCallbacks(RoamObjective);
            Initialize();
        }