예제 #1
0
 /// <summary>
 /// Destroys old block handlers on every simulation toggle,
 /// so they can be created again after block array is populated.
 /// </summary>
 private void SimulationToggle(bool simulating)
 {
     if (simulating)
     {
         Functions.ResetTimer();
     }
     BlockHandlerController.DestroyBlockHandlers();
 }
예제 #2
0
 /// <summary>
 /// Returns the block's handler.
 /// </summary>
 /// <param name="blockId">Block identifier string.</param>
 /// <returns>Block object.</returns>
 public static BlockHandler GetBlock(string blockId)
 {
     try
     {
         return(BlockHandlerController.GetBlock(new Guid(blockId)));
     }
     catch (FormatException)
     {
         return(BlockHandlerController.GetBlock(blockId));
     }
 }
예제 #3
0
        internal TrackedCollider(Collider hitCollider, Vector3 hitPoint)
        {
            c            = hitCollider;
            offset       = c.transform.InverseTransformPoint(hitPoint);
            lastPosition = Position;
            var bb = c.transform.parent.gameObject.GetComponent <BlockBehaviour>();

            if (bb != null)
            {
                block = BlockHandlerController.GetBlock(bb);
            }
        }
예제 #4
0
        private void Update()
        {
            // Initialize block handlers
            if (Game.IsSimulating && !BlockHandlerController.Initialised)
            {
                BlockHandlerController.InitializeBlockHandlers();
            }

            // Open or hide ACM mapper
            if (BlockMapper.CurrentInstance != null)
            {
                if (BlockMapper.CurrentInstance.Block != null && BlockMapper.CurrentInstance.Block != ControlMapper.Instance.Block)
                {
                    ControlMapper.Instance.ShowBlockControls(BlockMapper.CurrentInstance.Block);
                }

                if (BlockMapper.CurrentInstance.Block != null)
                {
                    if (InputManager.CopyKeys())
                    {
                        copy_source = BlockMapper.CurrentInstance.Block.Guid;
                    }
                    if (InputManager.PasteKeys())
                    {
                        ControlManager.CopyBlockControls(copy_source, BlockMapper.CurrentInstance.Block.Guid);
                    }
                }
            }
            else
            {
                if (ControlMapper.Instance.Visible)
                {
                    ControlMapper.Instance.Hide();
                }
            }

            if (LoadedMachine)
            {
                LoadedMachine = false;
                ControlOverview.Open(true);
            }

            OnUpdate?.Invoke();
        }