Exemplo n.º 1
0
    public void ForceScreens(Vector3i _blockPos, BlockValue _blockValue, BlockEntityData _ebcd)
    {
        //GameObjects
        screenOBJ_0 = _ebcd.transform.FindChild("TV/TVScreen1").gameObject;
        screenOBJ_1 = _ebcd.transform.FindChild("TV/TVScreen2").gameObject;
        screenOBJ_2 = _ebcd.transform.FindChild("TV/TVScreen3").gameObject;
        screenOBJ_3 = _ebcd.transform.FindChild("TV/TVScreen4").gameObject;
        //MeshRenderers
        screen0Mesh = screenOBJ_0.GetComponent <MeshRenderer>();
        screen1Mesh = screenOBJ_1.GetComponent <MeshRenderer>();
        screen2Mesh = screenOBJ_2.GetComponent <MeshRenderer>();
        screen3Mesh = screenOBJ_3.GetComponent <MeshRenderer>();

        //System Off
        if (!BlockCCTVScreen.Screen0(_blockValue.meta) && !BlockCCTVScreen.Screen1(_blockValue.meta) && !BlockCCTVScreen.Screen2(_blockValue.meta) && !BlockCCTVScreen.Screen3(_blockValue.meta))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
        }
        //Screen 0 on
        if (BlockCCTVScreen.Screen0(_blockValue.meta))
        {
            screen0Mesh.enabled = true;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
        }
        //Screen 1 on
        if (BlockCCTVScreen.Screen1(_blockValue.meta))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = true;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
        }
        //Screen 2 on
        if (BlockCCTVScreen.Screen2(_blockValue.meta))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = true;
            screen3Mesh.enabled = false;
        }
        //Screen 3 on
        if (BlockCCTVScreen.Screen3(_blockValue.meta))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = true;
        }
    }
Exemplo n.º 2
0
    public override bool OnBlockActivated(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
    {
        BlockEntityData _ebcd = _world.ChunkClusters[_clrIdx].GetBlockEntity(_blockPos);

        if (!BlockCCTVScreen.Screen0(_blockValue.meta) && !BlockCCTVScreen.Screen1(_blockValue.meta) && !BlockCCTVScreen.Screen2(_blockValue.meta) && !BlockCCTVScreen.Screen3(_blockValue.meta))
        {
            return(false);
        }
        else
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 0));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 1));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 2));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 3));
            _world.SetBlockRPC(_blockPos, _blockValue);
            ForceScreens(_blockPos, _blockValue, _ebcd);
            return(false);
        }
    }
Exemplo n.º 3
0
    public override string GetActivationText(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos,
                                             EntityAlive _entityFocusing)
    {
        BlockEntityData _ebcd = _world.ChunkClusters[_clrIdx].GetBlockEntity(_blockPos);

        //GameObjects
        screenOBJ_0 = _ebcd.transform.FindChild("TV/TVScreen1").gameObject;
        screenOBJ_1 = _ebcd.transform.FindChild("TV/TVScreen2").gameObject;
        screenOBJ_2 = _ebcd.transform.FindChild("TV/TVScreen3").gameObject;
        screenOBJ_3 = _ebcd.transform.FindChild("TV/TVScreen4").gameObject;
        //MeshRenderers
        screen0Mesh = screenOBJ_0.GetComponent <MeshRenderer>();
        screen1Mesh = screenOBJ_1.GetComponent <MeshRenderer>();
        screen2Mesh = screenOBJ_2.GetComponent <MeshRenderer>();
        screen3Mesh = screenOBJ_3.GetComponent <MeshRenderer>();
        ForceScreens(_blockPos, _blockValue, _ebcd);
        if (Input.GetKeyUp(KeyCode.Keypad1))
        {
            screen0Mesh.enabled = true;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
            _blockValue.meta    = (byte)(_blockValue.meta | (1 << 0));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 1));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 2));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 3));
            _world.SetBlockRPC(_blockPos, _blockValue);
            return("");
        }


        if (Input.GetKeyUp(KeyCode.Keypad2))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = true;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = false;
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 0));
            _blockValue.meta    = (byte)(_blockValue.meta | (1 << 1));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 2));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 3));
            _world.SetBlockRPC(_blockPos, _blockValue);
            return("");
        }


        if (Input.GetKeyUp(KeyCode.Keypad3))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = true;
            screen3Mesh.enabled = false;
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 0));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 1));
            _blockValue.meta    = (byte)(_blockValue.meta | (1 << 2));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 3));
            _world.SetBlockRPC(_blockPos, _blockValue);
            return("");
        }


        if (Input.GetKeyUp(KeyCode.Keypad4))
        {
            screen0Mesh.enabled = false;
            screen1Mesh.enabled = false;
            screen2Mesh.enabled = false;
            screen3Mesh.enabled = true;
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 0));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 1));
            _blockValue.meta    = (byte)(_blockValue.meta & ~(1 << 2));
            _blockValue.meta    = (byte)(_blockValue.meta | (1 << 3));
            _world.SetBlockRPC(_blockPos, _blockValue);
            return("");
        }
        if (Input.GetKeyUp(KeyCode.Keypad8))
        {
            DisplayChatAreaText("Turn the screen on by selecting a channel with numpad 1, 2, 3 or 4. You can pan the camera left and right using the arrow keys.");
            DisplayChatAreaText("Press E while looking at the screen to turn off the screen and all cams.");
            DisplayChatAreaText("Notes: In order to reduce frame rate loss only one camera is turned on at any time and all cameras are turned of when the screen is off.");
            DisplayChatAreaText("For this reason it's best to have only one screen turned on at a time.");
            return("");
        }
        if (!BlockCCTVScreen.Screen0(_blockValue.meta) && !BlockCCTVScreen.Screen1(_blockValue.meta) && !BlockCCTVScreen.Screen2(_blockValue.meta) && !BlockCCTVScreen.Screen3(_blockValue.meta))
        {
            return("To Turn On Select A Channel Using The NumPad.");
        }
        else
        {
            return("");
        }
    }