Esempio n. 1
0
    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();
    }
Esempio n. 2
0
    // 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!");
    }
Esempio n. 3
0
 public virtual void MakeTriggerAction(AbsorptionGraph.GraphNode node, AbsorptionGraph graph)
 {
 }