コード例 #1
0
    public void LoadResources()
    {
        //Load some landscaping static resources
        groundLeft       = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(-3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundLeft.name  = "GroundLeft";
        groundRight      = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundRight.name = "GroundRight";
        river            = Object.Instantiate(Resources.Load("Prefabs/River"), new Vector3(0, -0.81f, -5.5f), Quaternion.identity) as GameObject;
        river.name       = "River";

        //Load important game objects
        boat = new Boat(1);
        Vector3[] priestLandPos = new Vector3[3] {
            new Vector3(-2.9f, 1.1f, -5.5f), new Vector3(-3.4f, 1.1f, -5.5f), new Vector3(-3.9f, 1.1f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objPriest[i] = new Priest(i, priestLandPos[i]);
        }
        Vector3[] devilLandPos = new Vector3[3] {
            new Vector3(-4.4f, 1.0f, -5.5f), new Vector3(-4.9f, 1.0f, -5.5f), new Vector3(-5.4f, 1.0f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objDevil[i] = new Devil(i, devilLandPos[i]);
        }
        judgement.startTimer();
        //StartCoroutine(waitForOneSecond());
        aimove = new AutoMove(objPriest, objDevil, boat);
        tips   = aimove.AIMove();
    }
コード例 #2
0
 public void checkMove(Character.Type objType, int id)
 {
     if (objType == Character.Type.classBoat)
     {
         if (boat.canMove())
         {
             boat.Move();
             actionManager.MoveBoat(boat);
             for (int i = 0; i < 3; i++)
             {
                 if (objPriest[i].position == Character.Status.leftBoat || objPriest[i].position == Character.Status.rightBoat)
                 {
                     objPriest[i].moveOnBoat(boat.isLeft);
                     actionManager.MovePriest(objPriest[i]);
                 }
             }
             for (int i = 0; i < 3; i++)
             {
                 if (objDevil[i].position == Character.Status.leftBoat || objDevil[i].position == Character.Status.rightBoat)
                 {
                     objDevil[i].moveOnBoat(boat.isLeft);
                 }
                 actionManager.MoveDevil(objDevil[i]);
             }
             judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
         }
         tips = aimove.AIMove();
     }
     else if (objType == Character.Type.classPriest)
     {
         if (objPriest[id].position == Character.Status.leftLand || objPriest[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objPriest[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 actionManager.MovePriest(objPriest[id]);
                 boat.add(objPriest[id].boatSeat);
             }
         }
         else
         {
             objPriest[id].Move(boat.isLeft, boat.getCapacity(), 0);
             actionManager.MovePriest(objPriest[id]);
             boat.remove(objPriest[id].boatSeat);
         }
         judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
     }
     else if (objType == Character.Type.classDevil)
     {
         if (objDevil[id].position == Character.Status.leftLand || objDevil[id].position == Character.Status.rightLand)
         {
             if (boat.getCapacity() > 0)
             {
                 objDevil[id].Move(boat.isLeft, boat.getCapacity(), boat.assignSeat());
                 actionManager.MoveDevil(objDevil[id]);
                 boat.add(objDevil[id].boatSeat);
             }
         }
         else
         {
             objDevil[id].Move(boat.isLeft, boat.getCapacity(), 0);
             actionManager.MoveDevil(objDevil[id]);
             boat.remove(objDevil[id].boatSeat);
         }
         judgement.checkWinOrLose(getPriestNum(Character.Status.leftLand) + getPriestNum(Character.Status.leftBoat), getPriestNum(Character.Status.rightLand) + getPriestNum(Character.Status.rightBoat), getDevilNum(Character.Status.leftLand) + getDevilNum(Character.Status.leftBoat), getDevilNum(Character.Status.rightLand) + getDevilNum(Character.Status.rightBoat));
     }
 }