public override void MakeTriggerAction(AbsorptionGraph.GraphNode node, AbsorptionGraph graph) { // Debug.Log($"Make trigger action on transistor (input {InputType}, output {OutputType})!"); foreach (AbsorptionGraph.GraphNode nextNode in node.connectionsTo) { if (CanAbsorp(nextNode.shape)) { TileMapCell cell = TileMap.Instance.GetCellWithShape(nextNode.shape); if (cell != null) { cell.RemoveShape(); } } } SetAbsorbed(); }
// ckecks all types of shapes interactions upon placing them on tile map private void CheckoutShapeTriggers() { TriggerableContext context = new TriggerableContext(); while (!context.Completed) { context.Completed = true; for (int row = 0; row < 4; row++) { for (int col = 0; col < 4; col++) { if (!m_Cells[row, col].IsEmpty) { m_Cells[row, col].shape.Trigger(context); } } } } // check for infinity explosions if (context.WillExplode) { foreach (TileMapCell cell in m_Cells) { cell.RemoveShape(); } } else { // create Absorption graph and execute it AbsorptionGraph absorptionGraph = AbsorptionGraph.FromContext(context); absorptionGraph.Execute(); } // Debug.Log("Triggers executed!"); }
public virtual void MakeTriggerAction(AbsorptionGraph.GraphNode node, AbsorptionGraph graph) { }