Exemplo n.º 1
0
    /// <summary>
    ///     Remove a card from the pile.
    /// </summary>
    /// <param name="card"></param>
    public virtual void RemoveJewel(IUiJewel jewel)
    {
      if (jewel == null)
        throw new ArgumentNullException("Null is not a valid argument.");

      Jewels.Remove(jewel);

      NotifyPileChange();
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Add Jewel"))
        {
            jewels.Add();
        }

        foreach (var item in jewels.list)
        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(item.type.ToString()))
            {
                JewelTemplate.Init(item);
            }
            GUI.color = Color.red;
            if (GUILayout.Button("Remove"))
            {
                jewels.Remove(item);
                break;
            }
            GUILayout.EndHorizontal();
            GUI.color = Color.white;
        }
    }
Exemplo n.º 3
0
        public List <Node> nextNode()
        {
            List <Node> listNode = new List <Node>();

            foreach (EnumIA.Action action in actionsAvailable())
            {
                switch (action)
                {
                case EnumIA.Action.bas:
                    List <EnumIA.Action> tempBas = new List <EnumIA.Action>();
                    tempBas.AddRange(this.actions);
                    tempBas.Add(EnumIA.Action.bas);
                    listNode.Add(new Node(posAgent.move(EnumIA.Action.bas), Jewels, Dust,
                                          tempBas, calculHeuristic(action), this, null));
                    break;

                case EnumIA.Action.haut:
                    List <EnumIA.Action> tempHaut = new List <EnumIA.Action>();
                    tempHaut.AddRange(this.actions);
                    tempHaut.Add(EnumIA.Action.haut);
                    listNode.Add(new Node(posAgent.move(EnumIA.Action.haut), Jewels, Dust,
                                          tempHaut, calculHeuristic(action), this, null));
                    break;

                case EnumIA.Action.droite:
                    List <EnumIA.Action> tempDroite = new List <EnumIA.Action>();
                    tempDroite.AddRange(this.actions);
                    tempDroite.Add(EnumIA.Action.droite);
                    listNode.Add(new Node(posAgent.move(EnumIA.Action.droite), Jewels, Dust,
                                          tempDroite, calculHeuristic(action), this, null));

                    break;

                case EnumIA.Action.gauche:
                    List <EnumIA.Action> tempGauche = new List <EnumIA.Action>();
                    tempGauche.AddRange(this.actions);
                    tempGauche.Add(EnumIA.Action.gauche);
                    listNode.Add(new Node(posAgent.move(EnumIA.Action.gauche), Jewels, Dust,
                                          tempGauche, calculHeuristic(action), this, null));
                    break;

                case EnumIA.Action.aspirer:
                    Dust.Remove(posAgent);
                    List <EnumIA.Action> tempAspirer = new List <EnumIA.Action>();
                    tempAspirer.AddRange(this.actions);
                    tempAspirer.Add(EnumIA.Action.aspirer);
                    listNode.Add(new Node(posAgent, Jewels, posAgent.remove(Dust),
                                          tempAspirer, calculHeuristic(action), this, null));
                    break;

                case EnumIA.Action.recuperer:
                    Jewels.Remove(posAgent);
                    List <EnumIA.Action> tempRecuperer = new List <EnumIA.Action>();
                    tempRecuperer.AddRange(this.actions);
                    tempRecuperer.Add(EnumIA.Action.recuperer);
                    listNode.Add(new Node(posAgent, posAgent.remove(Jewels), Dust,
                                          tempRecuperer, calculHeuristic(action), this, null));
                    break;
                }
            }

            return(listNode);
        }