public void GenerateContent()
 {
     if (aGo != null)
     {
         Destroy(aGo);
         aGo = null;
     }
     if (bGo != null)
     {
         Destroy(bGo);
         bGo = null;
     }
     if (operatorBlock.GetType() == typeof(OpEqual))
     {
         OpEqual ope = operatorBlock as OpEqual;
         if (ope.A != null)
         {
             aGo = MakeGameObjectBlock(ope.A, aTransform);
         }
         if (ope.B != null)
         {
             bGo = MakeGameObjectBlock(ope.B, bTransform);
         }
     }
     else if (operatorBlock.GetType() == typeof(OpInf))
     {
         OpInf ope = operatorBlock as OpInf;
         if (ope.A != null)
         {
             aGo = MakeGameObjectBlock(ope.A, aTransform);
         }
         if (ope.B != null)
         {
             bGo = MakeGameObjectBlock(ope.B, bTransform);
         }
     }
     else if (operatorBlock.GetType() == typeof(OpSup))
     {
         OpSup ope = operatorBlock as OpSup;
         if (ope.A != null)
         {
             aGo = MakeGameObjectBlock(ope.A, aTransform);
         }
         if (ope.B != null)
         {
             bGo = MakeGameObjectBlock(ope.B, bTransform);
         }
     }
 }
 public void DropOperator(int index)
 {
     if (operatorBlock.GetType() == typeof(OpEqual))
     {
         OpEqual ope = operatorBlock as OpEqual;
         if (index == 0 && ope.A == null)
         {
             ope.A = UIRobotProg.Instance.MakeBlock(ope);
         }
         if (index == 1 && ope.B == null)
         {
             ope.B = UIRobotProg.Instance.MakeBlock(ope);
         }
     }
     else if (operatorBlock.GetType() == typeof(OpInf))
     {
         OpInf ope = operatorBlock as OpInf;
         if (index == 0 && ope.A == null)
         {
             ope.A = UIRobotProg.Instance.MakeBlock(ope);
         }
         if (index == 1 && ope.B == null)
         {
             ope.B = UIRobotProg.Instance.MakeBlock(ope);
         }
     }
     else if (operatorBlock.GetType() == typeof(OpSup))
     {
         OpSup ope = operatorBlock as OpSup;
         if (index == 0 && ope.A == null)
         {
             ope.A = UIRobotProg.Instance.MakeBlock(ope);
         }
         if (index == 1 && ope.B == null)
         {
             ope.B = UIRobotProg.Instance.MakeBlock(ope);
         }
     }
     UIRobotProg.Instance.ChangeProgram();
 }
示例#3
0
    Operator MakeOpe()
    {
        Operator newOp = null;

        switch (UINewTool.ToolDragAndDrop)
        {
        case UINewTool.Tool.O_And:
            newOp = new OpAnd();
            break;

        case UINewTool.Tool.O_Or:
            newOp = new OpOr();
            break;

        case UINewTool.Tool.O_Equal:
            newOp = new OpEqual();
            break;

        case UINewTool.Tool.O_Inf:
            newOp = new OpInf();
            break;

        case UINewTool.Tool.O_Sup:
            newOp = new OpSup();
            break;

        case UINewTool.Tool.O_Not:
            newOp = new OpNot();
            break;

        case UINewTool.Tool.O_Is:
            newOp = new OpIs();
            break;
        }
        return(newOp);
    }