Beispiel #1
0
    public void loadResources()
    {
        GameObject river = Instantiate(Resources.Load("prefabs/river", typeof(GameObject)), riverPos, Quaternion.identity, null) as GameObject;

        river.name = "river";
        startLand  = new LandController("from");
        endLand    = new LandController("to");
        boat       = new BoatController();

        for (int i = 0; i < 3; i++)
        {
            chCtrl.CharacterController _ch = new chCtrl.CharacterController("priest");
            _ch.setName("priest[" + i + "]");
            _ch.setPosition(startLand.getEmptyPlace());
            _ch.getOnLand(startLand);
            startLand.addObj(_ch);
            ch[i] = _ch;
        }
        for (int i = 0; i < 3; i++)
        {
            chCtrl.CharacterController _ch = new chCtrl.CharacterController("devil");
            _ch.setName("devil[" + i + "]");
            _ch.setPosition(startLand.getEmptyPlace());
            _ch.getOnLand(startLand);
            startLand.addObj(_ch);
            ch[i + 3] = _ch;
        }
    }
Beispiel #2
0
 public chCtrl.CharacterController getOffBoat(string name)
 {
     for (int i = 0; i < passenger.Length; i++)
     {
         if (passenger[i] != null && passenger[i].getName() == name)
         {
             chCtrl.CharacterController ch = passenger[i];
             passenger[i] = null;
             return(ch);
         }
     }
     return(null);
 }
Beispiel #3
0
 public chCtrl.CharacterController removeObj(string name) //get off land
 {
     for (int i = 0; i < passenger.Length; i++)
     {
         if (passenger[i] != null && passenger[i].getName() == name)
         {
             chCtrl.CharacterController ch = passenger[i];
             passenger[i] = null;
             return(ch);
         }
     }
     return(null);
 }
Beispiel #4
0
 public void objectClicked(chCtrl.CharacterController _ch)
 {
     if (_ch.isOnBoat()) //obj is on boat
     {
         LandController land;
         if (boat.getState() == -1)
         {
             land = endLand;
         }
         else
         {
             land = startLand;
         }
         boat.getOffBoat(_ch.getName());
         _ch.movePos(land.getEmptyPlace());
         _ch.getOnLand(land);
         land.addObj(_ch);
     }
     else //obj is on land
     {
         LandController land = _ch.getLandController();
         if (boat.getEmptyNum() == -1)
         {
             return;                           //full boat
         }
         if (land.getState() != boat.getState())
         {
             return;                                     //different side
         }
         land.removeObj(_ch.getName());
         _ch.movePos(boat.getEmptyPlace());
         _ch.getOnBoat(boat);
         boat.getOnBoat(_ch);
     }
     userGUI.status = check();
 }
Beispiel #5
0
 public void setController(chCtrl.CharacterController _ch)
 {
     ch = _ch;
 }
Beispiel #6
0
    public void getOnBoat(chCtrl.CharacterController ch)
    {
        int index = getEmptyNum();

        passenger[index] = ch;
    }
Beispiel #7
0
    public void addObj(chCtrl.CharacterController ch) //get on land
    {
        int index = getEmptyNum();

        passenger[index] = ch;
    }