예제 #1
0
    private void UpdateLocations()
    {
        // TODO: FIX THIS SO THAT DESTROYED OBJECTS GET THEIR ENTRIES GC'ed.
        foreach (var p in Registry <PhysicalObject>())
        {
            var o = p.gameObject;
            var n = locationRoot.ChildWithKey(o);
            // Don't do anything if /perception/location/O:Location:override in database,
            // which would mean the character is brainwashed about O's position.
            if (n == null || n.Children.Count == 0 || !n.Children[0].ContainsKey(brainwashedSymbol))
            {
                if (!p.Exists)
                {
                    // Dead; remove it.
                    locationRoot.DeleteKey(o);
                }
                // Determine if it's inside something
                else if (p.Container == null)
                {
                    // It's not inside another object, so find what room it's in.

                    if (n == null || !n.ExclusiveKeyValue <GameObject>().GetComponent <Room>().Contains(o))
                    {
                        var r        = TileMap.TheTileMap.TileRoom(o);
                        var location = r != null?(r.gameObject):null;
                        if (location == null && p is Door)
                        {
                            location = ((Door)p).ForceRoom;
                        }
                        ELNode.Store(locationRoot / o % location);
                        if (o == gameObject)
                        {
                            myCurrentRoom = r;
                        }
                    }
                }
                else
                {
                    if (!p.IsHidden)
                    {
                        ELNode.Store((locationRoot / o % p.Container));
                    }
                }
            }
        }
    }
예제 #2
0
    private void UpdateStatusTextBids(ELNode concern)
    {
        var textRoot = concern.ChildWithKey(SStatusText);

        if (textRoot != null && textRoot.Children.Count > 0)
        {
            var text = textRoot.Children[0];
            if (text.Children.Count > 0)
            {
                var bid = Convert.ToSingle(text.Children[0].Key);
                if (bid > maxStatusBid)
                {
                    maxStatusBid = bid;
                    maxBidStatus = text.Key.ToString();
                }
            }
        }
    }