コード例 #1
0
    public void AddElectricalNode(Vector3Int position, ElectricalCableTile electricalCableTile, bool AddTile = false)
    {
        var checkPos = position;

        checkPos.z = 0;
        var metaData = metaDataLayer.Get(checkPos, true);
        var newdata  = new ElectricalMetaData();

        newdata.Initialise(electricalCableTile, metaData, position, this);
        metaData.ElectricalData.Add(newdata);
        if (AddTile)
        {
            if (electricalCableTile != null)
            {
                if (UnderFloorLayer == null)
                {
                    underFloorLayer = GetComponentInChildren <UnderFloorLayer>();
                }
                if (UnderFloorLayer != null)
                {
                    UnderFloorLayer.SetTile(position, electricalCableTile, Matrix4x4.identity);
                }
            }
        }
    }
コード例 #2
0
ファイル: Matrix.cs プロジェクト: ktndrnl/unitystation
    public void AddElectricalNode(Vector3Int position, WireConnect wireConnect)
    {
        var metaData = metaDataLayer.Get(position, true);
        var newdata  = new ElectricalMetaData();

        newdata.Initialise(wireConnect, metaData, position, this);
        metaData.ElectricalData.Add(newdata);

        UnderFloorElectricalSetTile(wireConnect.InData.WireEndA, wireConnect.InData.WireEndB,
                                    wireConnect.InData.Categorytype, position, newdata);
    }
コード例 #3
0
    public void AddElectricalNode(Vector3Int position, ElectricalCableTile wireConnect)
    {
        var checkPos = position;

        checkPos.z = 0;
        var metaData = metaDataLayer.Get(checkPos, true);
        var newdata  = new ElectricalMetaData();

        newdata.Initialise(wireConnect, metaData, position, this);
        metaData.ElectricalData.Add(newdata);
    }
コード例 #4
0
ファイル: Matrix.cs プロジェクト: ktndrnl/unitystation
    public void AddElectricalNode(Vector3Int position, ElectricalCableTile electricalCableTile, bool AddTile = false)
    {
        var checkPos = position;

        checkPos.z = 0;
        var metaData = metaDataLayer.Get(checkPos, true);
        var newdata  = new ElectricalMetaData();

        newdata.Initialise(electricalCableTile, metaData, position, this);
        metaData.ElectricalData.Add(newdata);
        if (AddTile)
        {
            if (electricalCableTile != null)
            {
                AddUnderFloorTile(position, electricalCableTile, Matrix4x4.identity, Color.white);
            }
        }
    }
コード例 #5
0
    public void AddElectricalNode(Vector3Int position, WireConnect wireConnect)
    {
        var metaData = metaDataLayer.Get(position, true);
        var newdata  = new ElectricalMetaData();

        newdata.Initialise(wireConnect, metaData, position, this);
        metaData.ElectricalData.Add(newdata);

        ElectricalCableTile Tile = null;
        string Compound;

        if (newdata.InData.WireEndA < newdata.InData.WireEndB)
        {
            Compound = newdata.InData.WireEndA + "_" + newdata.InData.WireEndB;
        }
        else
        {
            Compound = newdata.InData.WireEndB + "_" + newdata.InData.WireEndA;
        }
        int spriteIndex = WireDirections.GetSpriteIndex(Compound);

        switch (newdata.InData.Categorytype)
        {
        case PowerTypeCategory.StandardCable:
            Tile = ElectricalManager.Instance.MediumVoltageCables.Tiles[spriteIndex];
            break;

        case PowerTypeCategory.LowVoltageCable:
            Tile = ElectricalManager.Instance.LowVoltageCables.Tiles[spriteIndex];
            break;

        case PowerTypeCategory.HighVoltageCable:
            Tile = ElectricalManager.Instance.HighVoltageCables.Tiles[spriteIndex];
            break;
        }
        newdata.RelatedTile = Tile;
        if (Tile != null)
        {
            if (metaTileMap != null)
            {
                metaTileMap.SetTile(position, Tile);
            }
        }
    }
コード例 #6
0
    public void AddElectricalNode(Vector3Int position, ElectricalCableTile electricalCableTile, bool AddTile = false)
    {
        var checkPos = position;

        checkPos.z = 0;
        var metaData = metaDataLayer.Get(checkPos, true);

        if (AddTile)
        {
            if (electricalCableTile != null)
            {
                position = TileChangeManager.UpdateTile(position, electricalCableTile);
            }
        }

        var newdata = new ElectricalMetaData();

        newdata.Initialise(electricalCableTile, metaData, position, this);
        metaData.ElectricalData.Add(newdata);
    }