Ejemplo n.º 1
0
        public Connection(ContainerAttachmentPoint second, double throughput)
        {
            Construct();

            _throughput      = throughput;
            _secondContainer = second;
        }
Ejemplo n.º 2
0
        void Construct()
        {
            tags.Add("connection");

            _throughput      = 0;
            _secondContainer = null;
        }
Ejemplo n.º 3
0
        public Connection()
            : base()
        {
            Construct();

            _throughput      = 0;
            _secondContainer = null;
        }
Ejemplo n.º 4
0
        public void AddConnection(ContainerAttachmentPoint second, double throughput = 0, bool isTwoWay = true)
        {
            connections.Add(new Connection(second, throughput));

            if (isTwoWay && second != null)
            {
                second.AddConnection(new Connection(this, throughput));
            }
        }
Ejemplo n.º 5
0
        private void Act()
        {
            List <Verb> traversalVerbs = GetVerbs("TraversalVerb");

            if (traversalVerbs.Count > 0)
            {
                ContainerAttachmentPoint container = controlledObject.container as ContainerAttachmentPoint;
                if (container != null)
                {
                    Connection[] connections = container.GetConnections();
                    int          choice      = random.Next(0, connections.Length);

                    Dictionary <string, object> data = new Dictionary <string, object>();
                    data["target"] = connections[choice];
                    traversalVerbs[0].Register(data);                     // XXX: Should pick most appropriate traversal verb
                }
            }
        }
Ejemplo n.º 6
0
        public void Unload()
        {
            InputManager.instance.inputReceived -= player.ParseInput;
            player = null;

            // For now delete everything non root
            foreach (GameObject root in rootObjects)
            {
                Container containerRoot = root as Container;
                if (containerRoot != null)
                {
                    ContainerAttachmentPoint contents = containerRoot.GetContents();
                    foreach (GameObject obj in contents.GetAttached())
                    {
                        contents.Remove(obj);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public Connection(Dictionary <string, object> data)
            : base(data)
        {
            Construct();

            if (data.ContainsKey("second"))
            {
                _secondContainer = data["second"] as ContainerAttachmentPoint;
            }

            if (data.ContainsKey("throughput"))
            {
                _throughput = (double)data["throughput"];
            }

            if (!data.ContainsKey("description"))
            {
                description = "an opening";
            }
        }
Ejemplo n.º 8
0
        public void AddConnection(Dictionary <string, object> data, bool isTwoWay = true)
        {
            if (!data.ContainsKey("parent"))
            {
                data.Add("parent", this);
            }
            else
            {
                data["parent"] = this;
            }
            connections.Add(new Connection(data));

            if (isTwoWay && data.ContainsKey("second"))
            {
                ContainerAttachmentPoint second = data["second"] as ContainerAttachmentPoint;
                data["parent"] = second;
                data["second"] = this;

                second.AddConnection(new Connection(data));
            }
        }
Ejemplo n.º 9
0
        private void Construct()
        {
            tags.Add("container");

            contents = new ContainerAttachmentPoint(new Dictionary <string, object>()
            {
                { "parent", this }, { "capacity", 0.0 }, { "name", "contents" }
            });
            AddAttachmentPoint(contents);

            spawnLists = new List <SpawnList>();

            objectData["innervolume"]     = GetDescriptiveInnerVolume;
            objectData["filledvolume"]    = GetDescriptiveFilledVolume;
            objectData["remainingvolume"] = GetDescriptiveRemainingVolume;
            objectData["volumeratio"]     = GetDescriptionVolumeRatio;

            relevantData.Insert(0, GetDescriptionVolumeRatio);
            relevantData.Add(GetDescriptiveRemainingVolume);
            relevantData.Add(GetDescriptiveInnerVolume);
            relevantData.Add(GetDescriptiveFilledVolume);
        }
Ejemplo n.º 10
0
 public void AddConnection(ContainerAttachmentPoint second, double throughput = 0, bool isTwoWay = true)
 {
     contents.AddConnection(second, throughput, isTwoWay);
 }