public void Deactivate()
 {
     if (baseNode != null)
     {
         baseNode.Deactivate();
     }
 }
 public void Delete()
 {
     if (linkedSpellNode.IsMagicCircle())
     {
         MagicCircle mc = (MagicCircle)linkedSpellNode;
         mc.Deactivate();
     }
     Destroy(linkedSpellNode.gameObject);
     Destroy(this.gameObject);
 }
    public void ActivateMagicCircle(bool shouldActivate)
    {
        MagicCircle mc = (MagicCircle)selectedUISN.linkedSpellNode;

        if (mc != null)
        {
            if (shouldActivate)
            {
                mc.Activate();
            }
            else
            {
                mc.Deactivate();
            }
        }
    }
    public void DestroyNode(SpellNode node)
    {
        RemoveNode(node);
        MagicCircle mc = (MagicCircle)node;

        if (mc != null)
        {
            mc.Deactivate();
            // for( int i = 0; i < links.Count; i++ )
            // {
            //     if( links[i].destination == node || links[i].source == node )
            //     {
            //         DestroyLink(links[i]);
            //     }
            // }
        }
        Destroy(node);
    }
 public virtual bool RemoveMagicCircle(MagicCircle mc)
 {
     foreach (int currMcType in innerMagicCircleList.Keys)
     {
         Debug.Log("innerMagicCircleList: " + ((MagicCircleType)currMcType).ToString());
     }
     if (innerMagicCircleList.ContainsKey((int)mc.GetMcType()))
     {
         mc.Deactivate();
         mc.RemoveAllMagicCircles();
         innerMagicCircleList.Remove((int)mc.GetMcType());
         Destroy(mc.gameObject);
         UpdateCirclePositions();
         return(true);
     }
     else
     {
         Debug.LogError("This Magic Circle is not on the parent magic circle.  Can't remove it " + mc.mcType);
         return(false);
     }
 }
    void FixedUpdate()
    {
        if (source != null && destination != null && source.IsMagicCircle() && destination.IsMagicCircle())
        {
            MagicCircle mcSource      = (MagicCircle)source;
            MagicCircle mcDestination = (MagicCircle)destination;
            if (mcSource.isActive != wasActivated)
            {
                wasActivated = mcSource.isActive;
                PendingOperation operation = mcSource.isActive ? PendingOperation.Activate : PendingOperation.Deactivate;
                pendingOpList.Add(new PendingOperationContainer(operation, delayTime));
                // timeTillActivate = delayTime;
                // pendingOperation = mcSource.isActive ? PendingOperation.Activate : PendingOperation.Deactivate;
            }
            // Timer to count down until you activate the magic circle
            List <int> removePoc = new List <int>();
            for (int i = 0; i < pendingOpList.Count; i++)
            {
                if (pendingOpList[i].timeTillOp <= 0)
                {
                    // Activate the magic
                    if (pendingOpList[i].pendingOp == PendingOperation.Activate)
                    {
                        mcDestination.Activate();
                    }
                    // Only Deactivate the magic if it hasn't already been deactivated
                    else if (mcDestination.isActive && pendingOpList[i].pendingOp == PendingOperation.Deactivate)
                    {
                        mcDestination.Deactivate();
                    }
                    removePoc.Add(i);
                }
                // Keep decreasing the time until it reaches 0;
                else
                {
                    pendingOpList[i].timeTillOp -= Time.fixedDeltaTime;
                }
            }
            for (int i = removePoc.Count - 1; i >= 0; i--)
            {
                pendingOpList.RemoveAt(i);
            }

            // if( timeTillActivate <= 0 )
            // {
            //     // Only Activate the magic if it hasn't already been activated
            //     if( !mcDestination.isActive && pendingOperation == PendingOperation.Activate )
            //     {
            //         mcDestination.Activate();
            //     }
            //     // Only Deactivate the magic if it hasn't already been activated
            //     else if( mcDestination.isActive &&  pendingOperation == PendingOperation.Deactivate )
            //     {
            //         mcDestination.Deactivate();
            //     }
            // }
            // // Keep decreasing the time until it reaches 0;
            // else
            // {
            //     timeTillActivate -= Time.fixedDeltaTime;
            // }
        }
        else
        {
            timeTillActivate = 0;
        }
    }