Пример #1
0
    public StructureComponent CompByLocal(Vector3 localPos, StructureComponent.StructureComponentType type)
    {
        CompPosNode           node;
        StructureComponentKey key = new StructureComponentKey(localPos);

        if (this._structureComponentsByPosition.TryGetValue(key, out node))
        {
            return(node.GetType(type));
        }
        return(null);
    }
Пример #2
0
    public bool AddCompPositionEntry(StructureComponent comp)
    {
        CompPosNode           node;
        Vector3               v   = this.LocalIndexRound(base.transform.InverseTransformPoint(comp.transform.position));
        StructureComponentKey key = new StructureComponentKey(v);

        if (this._structureComponentsByPosition.TryGetValue(key, out node))
        {
            node.Add(comp);
        }
        else
        {
            node = new CompPosNode();
            node.Add(comp);
            this._structureComponentsByPosition.Add(key, node);
        }
        return(true);
    }