Example #1
0
    public void MoveRole(RoleModel role)    //移动角色
    {
        if (user_gui.sign != 0)
        {
            return;
        }
        if (role.IsOnBoat())
        {
            LandModel land;
            if (boat.GetBoatSign() == -1)
            {
                land = end_land;
            }
            else
            {
                land = start_land;
            }
            boat.DeleteRoleByName(role.GetName());

            Vector3 end_pos    = land.GetEmptyPosition();                                                      //动作分离版本改变
            Vector3 middle_pos = new Vector3(role.getGameObject().transform.position.x, end_pos.y, end_pos.z); //动作分离版本改变
            actionManager.moveRole(role.getGameObject(), middle_pos, end_pos, role.move_speed);                //动作分离版本改变

            role.GoLand(land);
            land.AddRole(role);
        }
        else
        {
            LandModel land = role.GetLandModel();
            if (boat.GetEmptyNumber() == -1 || land.GetLandSign() != boat.GetBoatSign())
            {
                return;                                                                            //船没有空位,也不是船停靠的陆地,就不上船
            }
            land.DeleteRoleByName(role.GetName());

            Vector3 end_pos    = boat.GetEmptyPosition();                                                      //动作分离版本改变
            Vector3 middle_pos = new Vector3(end_pos.x, role.getGameObject().transform.position.y, end_pos.z); //动作分离版本改变
            actionManager.moveRole(role.getGameObject(), middle_pos, end_pos, role.move_speed);                //动作分离版本改变

            role.GoBoat(boat);
            boat.AddRole(role);
        }
        user_gui.sign = Check();

        /*if (user_gui.sign == 1)
         * {
         *  for (int i = 0; i < 3; i++)
         *  {
         *      roles[i].PlayGameOver();
         *      roles[i + 3].PlayGameOver();
         *  }
         * }*///f**k
    }
    public void isClickChar(MyCharacterController tem_char)
    {
        if (Director.cn_move == 1)
        {
            return;
        }
        if (tem_char._isOnBoat())
        {
            CoastController tem_coast;
            if (boat.getTFflag() == -1)
            {
                tem_coast = toCoast;
            }
            else
            {
                tem_coast = fromCoast;
            }
            boat.getOffBoat(tem_char.getName());

            Vector3 end_pos    = tem_coast.getEmptyPosition();                                                     //动作分离版本改变
            Vector3 middle_pos = new Vector3(tem_char.getGameObject().transform.position.x, end_pos.y, end_pos.z); //动作分离版本改变
            actionManager.moveRole(tem_char.getGameObject(), middle_pos, end_pos, 50);                             //动作分离版本改变

            tem_char.getOnCoast(tem_coast);
            tem_coast.getOnCoast(tem_char);
        }
        else
        {
            CoastController tem_coast2 = tem_char.getCoastController();
            if (boat.getEmptyIndex() == -1)
            {
                return;
            }
            if (boat.getTFflag() != tem_coast2.getTFflag())
            {
                return;
            }
            tem_coast2.getOffCoast(tem_char.getName());

            Vector3 end_pos    = boat.getEmptyPosition();                                                          //动作分离版本改变
            Vector3 middle_pos = new Vector3(end_pos.x, tem_char.getGameObject().transform.position.y, end_pos.z); //动作分离版本改变
            actionManager.moveRole(tem_char.getGameObject(), middle_pos, end_pos, 50);                             //动作分离版本改变


            tem_char.getOnBoat(boat);
            boat.getOnBoat(tem_char);
        }
        //check whether game over;
        user.if_win_or_not = checkGameOver();
    }
Example #3
0
 //change in v2
 public void moveRole(roleModel role)
 {
     if (role.isOnBoat())            // from boat to land
     {
         landModel land;
         if (boat.getBoatFlag() == 1)
         {
             land = startLand;
         }
         else
         {
             land = endLand;
         }
         boat.deleteRole(role.getName());
         //action
         Vector3 startPos  = role.getPosition();
         Vector3 endPos    = land.getEmptyPosition();
         Vector3 middlePos = new Vector3(startPos.x, endPos.y, startPos.z);
         actionManager.moveRole(role.getRole(), middlePos, endPos, 100 * Time.deltaTime);
         land.addRole(role);
         role.getOnLand(land);
     }
     else if (!role.isOnBoat())                                              //from land to boat
     {
         landModel land = role.getLand();
         if (boat.getEmptyPosIndex() == -1 || boat.getBoatFlag() != land.getLandFlag())
         {
             return;
         }
         land.deleteRole(role.getName());
         //action
         Vector3 startPos  = role.getPosition();
         Vector3 endPos    = boat.getEmptyPosition();
         Vector3 middlePos = new Vector3(endPos.x, startPos.y, startPos.z);
         actionManager.moveRole(role.getRole(), middlePos, endPos, 100 * Time.deltaTime);
         boat.addRole(role);
         role.getOnBoat(boat);
     }
 }
 public void MoveRole(RoleModel role)
 {
     if (user_gui.sign != 0)
     {
         return;
     }
     if (role.IsOnBoat())
     {
         LandModel land;
         if (boat.GetBoatSign() == -1)
         {
             land = end_land;
         }
         else
         {
             land = start_land;
         }
         boat.DeleteRoleByName(role.GetName());
         actionManager.moveRole(role.getGameObject(), new Vector3(role.getGameObject().transform.position.x, land.GetEmptyPosition().y, land.GetEmptyPosition().z), land.GetEmptyPosition(), role.move_speed);
         role.GoLand(land);
         land.AddRole(role);
     }
     else
     {
         LandModel land = role.GetLandModel();
         if (boat.GetEmptyNumber() == -1 || land.GetLandSign() != boat.GetBoatSign())
         {
             return;
         }
         land.DeleteRoleByName(role.GetName());
         actionManager.moveRole(role.getGameObject(), new Vector3(boat.GetEmptyPosition().x, role.getGameObject().transform.position.y, boat.GetEmptyPosition().z), boat.GetEmptyPosition(), role.move_speed);
         role.GoBoat(boat);
         boat.AddRole(role);
     }
     user_gui.sign = judge.Check();
 }
    public void MoveRole(RoleModel role)//移动角色
    {
        if (user_gui.sign != 0)
        {
            return;
        }
        if (role.IsOnBoat())
        {
            BankModel land;
            if (boat.GetBoatSign() == -1)
            {
                land = end_land;
            }
            else
            {
                land = start_land;
            }
            boat.DeleteRoleByName(role.GetName());
            Debug.Log("DeleteRoleByName");
            Debug.Log(role.GetName());

            //role.Move(land.GetEmptyPosition());
            //动作分离版本改变
            Debug.Log(land.GetBankSign());
            Vector3 end_pos = land.GetEmptyPosition();
            Debug.Log(end_pos);
            Vector3 middle_pos = new Vector3(role.getGameObject().transform.position.x, end_pos.y, end_pos.z);
            Debug.Log(middle_pos);
            actionManager.moveRole(role.getGameObject(), middle_pos, end_pos, role.move_speed);


            role.GoLand(land);
            land.AddRole(role);
        }
        else
        {
            BankModel land = role.GetBankModel();
            ///船没有空位,也不是停靠的陆地,就不上船
            if (boat.GetEmptyNumber() == -1 || land.GetBankSign() != boat.GetBoatSign())
            {
                return;
            }

            land.DeleteRoleByName(role.GetName());

            //role.Move(boat.GetEmptyPosition());
            //动作分离版本改变
            Vector3 end_pos = boat.GetEmptyPosition();
            Debug.Log("?????");
            Vector3 middle_pos = new Vector3(end_pos.x, role.getGameObject().transform.position.y, end_pos.z);
            actionManager.moveRole(role.getGameObject(), middle_pos, end_pos, role.move_speed);


            role.GoBoat(boat);
            boat.AddRole(role);
        }
        user_gui.sign = judge.Check((start_land.GetRoleNum())[0], (start_land.GetRoleNum())[1], (end_land.GetRoleNum())[0], (end_land.GetRoleNum())[1]);
        if (user_gui.sign == 1)
        {
            for (int i = 0; i < RoleAmount; i++)
            {
                roles[i].PlayGameOver();
                roles[i + RoleAmount].PlayGameOver();
            }
        }
    }