Exemple #1
0
    private void OnEnable()
    {
        changeElement = (ChangeElement)target;//NOTA:FOI NECESSARIO CRIAR changeElement, POIS NAO FOI POSSIVEL OBTER O COMPONENTE RENDERER ATRAVES DE subObjectsWithMaterial NO METODO SetSizeNewMaterialsVector().

        marker1 = serializedObject.FindProperty("marker1");
        marker2 = serializedObject.FindProperty("marker2");
        subObjectsWithMaterial  = serializedObject.FindProperty("subObjectsWithMaterial");//NOTA-SE QUE SE ESTA ACESSANDO AO CAMPO subObjectsWithMaterial E NAO A PROPRIEDADE SubObjectsWithMaterial
        subObjectsWithMaterialO = serializedObject.FindProperty("subObjectsWithMaterialO");
        myObject        = serializedObject.FindProperty("myObject");
        typeOfChange    = serializedObject.FindProperty("typeOfChange");
        changeScale     = serializedObject.FindProperty("changeScale");
        changeRotation  = serializedObject.FindProperty("changeRotation");
        changeMaterials = serializedObject.FindProperty("changeMaterials");
        newScale        = serializedObject.FindProperty("newScale");
        newRotation     = serializedObject.FindProperty("newRotation");
        newObject       = serializedObject.FindProperty("newObject");
    }
    //Individual Behaviours to be stored in the following.
    void ActOnTile()
    {
        if (istiletaken == false)
        {
            //move and keep moving i	f theres nothing but ice
            Count();
            currenttile = tiletotest;
        }
        else
        {
            if (outofmap == true)
            {
                canmove  = false;
                outofmap = false;
            }
            else if (tilescript.myTaker.tag == "Wall")
            {
                //the desired tile is the previous one and u stop looking for next tiles.
                canmove = false;
                Count();
            }
            else if (tilescript.myTaker.tag == "Outerwall")
            {
                //the desired tile is the previous one and u stop looking for next tiles.
                walltoturnoff     = tilescript.myTaker;
                walltoturnoff.tag = "Wall";
                elementchanger    = walltoturnoff.GetComponent <ChangeElement> ();
                //elementchanger.RemoveElement ();
                //readytoturnoff = true;
                canmove = false;
                Count();
                nextaction = ("Outerwall_Action");
            }
            else if (tilescript.myTaker.tag == "Goal")
            {
                //you'll stop in the tile you checked and stop moving.

                /*if (TurnCounter.turncount == 0) {
                 *      canmove = false;
                 * } else {*/
                Count();
                currenttile = tiletotest;
                canmove     = false;
                //Qeue up an action when reaching the tile
                nextaction = "Goal_Action";
            }
            else if (tilescript.myTaker.tag == "Hole")
            {
                //you'll stop in the tile you checked and stop moving.
                currenttile = tiletotest;
                canmove     = false;
                //Qeue up an action when reaching the tile
                nextaction = "Hole_Action";
            }
            else if (tilescript.myTaker.tag == "Wood")
            {
                Count();
                currenttile = tiletotest;
                Debug.Log("Pink");
                //canmove = true;
            }
            else if (tilescript.myTaker.tag == "Left")
            {
                Count();
                currenttile = tiletotest;
                canmove     = false;
                nextaction  = "Left_Action";
                isspeeding  = true;
            }
            else if (tilescript.myTaker.tag == "Right")
            {
                Count();
                currenttile = tiletotest;
                canmove     = false;
                nextaction  = "Right_Action";
                isspeeding  = true;
            }
            else if (tilescript.myTaker.tag == "Up")
            {
                Count();
                currenttile = tiletotest;
                canmove     = false;
                nextaction  = "Up_Action";
                isspeeding  = true;
            }
            else if (tilescript.myTaker.tag == "Down")
            {
                Count();
                currenttile = tiletotest;
                canmove     = false;
                nextaction  = "Down_Action";
                isspeeding  = true;
            }
            else if (tilescript.myTaker.tag == "Fragile")
            {
                Count();
                currenttile            = tiletotest;
                lastFragile            = tilescript.myTaker;
                tilescript.myTaker.tag = "Hole";
            }
            else if (tilescript.myTaker.tag == "Quicksand")
            {
                currenttile = tiletotest;
                lastFragile = tilescript.myTaker;
                Count();
                if (isspeeding == false)
                {
                    currenttile = tiletotest;
                    canmove     = false;
                    nextaction  = "Hole_action";
                }
            }
            else if (tilescript.myTaker.tag == "Seed")
            {
                currenttile = tiletotest;
                lastSeed    = tilescript.myTaker;
                //myseedbehaviour = lastSeed.GetComponent<Seed_Behaviour> ();
                //myseedbehaviour.Unseed ();
            }
            else if (tilescript.myTaker.tag == "Boss")
            {
                currenttile = tiletotest;
                canmove     = false;

                /*if (character_direction == "Up") {
                 *      Boss_Behaviour.bosstile.y++;
                 * }
                 * if (character_direction == "Right") {
                 *      Boss_Behaviour.bosstile.x++;
                 * }
                 * if (character_direction == "Left") {
                 *      Boss_Behaviour.bosstile.x--;
                 * }
                 * if (character_direction == "Down") {
                 *      Boss_Behaviour.bosstile.y--;
                 * }*/
            }
            else
            {
                Debug.Log("Dong");
                canmove = false;
            }
            Count();
        }
    }
 protected virtual void OnChangeElement(int row, int column, T previousValue, T newValue)
 {
     ChangeElement?.Invoke(this, new ElementChangingEventArgs(row, column, previousValue, newValue));
 }
Exemple #4
0
 protected void OnChange(int index1, int index2)
 {
     ChangeElement?.Invoke(this, new ChangeEventArgs(index1, index2));
 }
Exemple #5
0
        public void ThreeWayDiff(XElement baseFile, XElement left, XElement right)
        {
            var baseList  = GetKeys(baseFile.Elements());
            var leftList  = GetKeys(left.Elements());
            var rightList = GetKeys(right.Elements());

            var basePtr  = 0;
            var leftPtr  = 0;
            var rightPtr = 0;

            var            result = new List <ChangeElement>();
            ChangeElement  changeElem;
            ThreeWayStatus status;

            while (basePtr <= baseList.Count &&
                   leftPtr <= leftList.Count &&
                   rightPtr <= rightList.Count)
            {
                changeElem = new ChangeElement();
                status     = (ThreeWayStatus)((baseList[basePtr].Item1.CompareTo(leftList[leftPtr].Item1) + 1) << 4
                                          + (baseList[basePtr].Item1.CompareTo(rightList[rightPtr].Item1) + 1));

                switch (status)
                {
                case ThreeWayStatus.LeftAddRightAdd:
                    if (leftList[leftPtr].Item1 == rightList[rightPtr].Item1)
                    {
                        changeElem.Left        = leftList[leftPtr].Item2;
                        changeElem.LeftChange  = Change.Add;
                        changeElem.Right       = rightList[rightPtr].Item2;
                        changeElem.RightChange = Change.Add;
                    }
                    else
                    {
                        changeElem.Left       = leftList[leftPtr].Item2;
                        changeElem.LeftChange = Change.Add;
                        result.Add(changeElem);
                        changeElem             = new ChangeElement();
                        changeElem.Right       = rightList[rightPtr].Item2;
                        changeElem.RightChange = Change.Add;
                    }
                    leftPtr++;
                    rightPtr++;
                    break;

                case ThreeWayStatus.LeftAddRightDelete:
                case ThreeWayStatus.LeftAddRightEqual:
                    changeElem.Left       = leftList[leftPtr].Item2;
                    changeElem.LeftChange = Change.Add;
                    leftPtr++;
                    break;

                case ThreeWayStatus.LeftDeleteRightAdd:
                case ThreeWayStatus.LeftEqualRightAdd:
                    changeElem.Right       = rightList[rightPtr].Item2;
                    changeElem.RightChange = Change.Add;
                    rightPtr++;
                    break;

                case ThreeWayStatus.LeftDeleteRightDelete:
                    changeElem.Base        = baseList[basePtr].Item2;
                    changeElem.LeftChange  = Change.Delete;
                    changeElem.RightChange = Change.Delete;
                    basePtr++;
                    break;

                case ThreeWayStatus.LeftDeleteRightEqual:
                    changeElem.Base        = baseList[basePtr].Item2;
                    changeElem.Right       = rightList[rightPtr].Item2;
                    changeElem.LeftChange  = Change.Delete;
                    changeElem.RightChange = Change.NoChange;
                    basePtr++;
                    rightPtr++;
                    break;

                case ThreeWayStatus.LeftEqualRightDelete:
                    changeElem.Base        = baseList[basePtr].Item2;
                    changeElem.Left        = leftList[leftPtr].Item2;
                    changeElem.RightChange = Change.Delete;
                    changeElem.LeftChange  = Change.NoChange;
                    basePtr++;
                    leftPtr++;
                    break;

                default: // ThreeWayStatus.LeftEqualRightEqual
                    changeElem.Base  = baseList[basePtr].Item2;
                    changeElem.Left  = leftList[leftPtr].Item2;
                    changeElem.Right = rightList[rightPtr].Item2;
                    basePtr++;
                    leftPtr++;
                    rightPtr++;
                    break;
                }
            }
        }
    public void ThreeWayDiff(XElement baseFile, XElement left, XElement right)
    {
      var baseList = GetKeys(baseFile.Elements());
      var leftList = GetKeys(left.Elements());
      var rightList = GetKeys(right.Elements());

      var basePtr = 0;
      var leftPtr = 0;
      var rightPtr = 0;

      var result = new List<ChangeElement>();
      ChangeElement changeElem;
      ThreeWayStatus status;

      while (basePtr <= baseList.Count
        && leftPtr <= leftList.Count
        && rightPtr <= rightList.Count)
      {
        changeElem = new ChangeElement();
        status = (ThreeWayStatus)((baseList[basePtr].Item1.CompareTo(leftList[leftPtr].Item1) + 1) << 4
         + (baseList[basePtr].Item1.CompareTo(rightList[rightPtr].Item1) + 1));

        switch (status)
        {
          case ThreeWayStatus.LeftAddRightAdd:
            if (leftList[leftPtr].Item1 == rightList[rightPtr].Item1)
            {
              changeElem.Left = leftList[leftPtr].Item2;
              changeElem.LeftChange = Change.Add;
              changeElem.Right = rightList[rightPtr].Item2;
              changeElem.RightChange = Change.Add;
            }
            else
            {
              changeElem.Left = leftList[leftPtr].Item2;
              changeElem.LeftChange = Change.Add;
              result.Add(changeElem);
              changeElem = new ChangeElement();
              changeElem.Right = rightList[rightPtr].Item2;
              changeElem.RightChange = Change.Add;
            }
            leftPtr++;
            rightPtr++;
            break;
          case ThreeWayStatus.LeftAddRightDelete:
          case ThreeWayStatus.LeftAddRightEqual:
            changeElem.Left = leftList[leftPtr].Item2;
            changeElem.LeftChange = Change.Add;
            leftPtr++;
            break;
          case ThreeWayStatus.LeftDeleteRightAdd:
          case ThreeWayStatus.LeftEqualRightAdd:
            changeElem.Right = rightList[rightPtr].Item2;
            changeElem.RightChange = Change.Add;
            rightPtr++;
            break;
          case ThreeWayStatus.LeftDeleteRightDelete:
            changeElem.Base = baseList[basePtr].Item2;
            changeElem.LeftChange = Change.Delete;
            changeElem.RightChange = Change.Delete;
            basePtr++;
            break;
          case ThreeWayStatus.LeftDeleteRightEqual:
            changeElem.Base = baseList[basePtr].Item2;
            changeElem.Right = rightList[rightPtr].Item2;
            changeElem.LeftChange = Change.Delete;
            changeElem.RightChange = Change.NoChange;
            basePtr++;
            rightPtr++;
            break;
          case ThreeWayStatus.LeftEqualRightDelete:
            changeElem.Base = baseList[basePtr].Item2;
            changeElem.Left = leftList[leftPtr].Item2;
            changeElem.RightChange = Change.Delete;
            changeElem.LeftChange = Change.NoChange;
            basePtr++;
            leftPtr++;
            break;
          default: // ThreeWayStatus.LeftEqualRightEqual
            changeElem.Base = baseList[basePtr].Item2;
            changeElem.Left = leftList[leftPtr].Item2;
            changeElem.Right = rightList[rightPtr].Item2;
            basePtr++;
            leftPtr++;
            rightPtr++;
            break;
        }


      }
    }