public void loadResources()
    {
        leftCoast  = new CoastController("left");
        rightCoast = new CoastController("right");
        boat       = new BoatController();

        for (int i = 0; i < 3; i++)
        {
            zyzCharacterController newPriest = new zyzCharacterController("priest");
            newPriest.setName("priest" + i);
            newPriest.setPosition(leftCoast.getEmptyPosition());
            newPriest.toCoast(leftCoast);
            leftCoast.toCoast(newPriest);

            characters[i] = newPriest;
        }

        for (int i = 0; i < 3; i++)
        {
            zyzCharacterController newDevil = new zyzCharacterController("devil");
            newDevil.setName("devil" + i);
            newDevil.setPosition(leftCoast.getEmptyPosition());
            newDevil.toCoast(leftCoast);
            leftCoast.toCoast(newDevil);

            characters[i + 3] = newDevil;
        }
    }
    public void loadResources()
    {
        GameObject water = Instantiate(Resources.Load("Prefabs/Water", typeof(GameObject)), waterPosititon, Quaternion.identity, null) as GameObject;

        water.name = "water";

        leftCoast  = new CoastController("left");
        rightCoast = new CoastController("right");
        boat       = new BoatController();



        for (int i = 0; i < 3; i++)
        {
            zyzCharacterController newPriest = new zyzCharacterController("priest");
            newPriest.setName("priest" + i);
            newPriest.setPosition(leftCoast.getEmptyPosition());
            newPriest.toCoast(leftCoast);
            leftCoast.toCoast(newPriest);

            characters[i] = newPriest;
        }

        for (int i = 0; i < 3; i++)
        {
            zyzCharacterController newDevil = new zyzCharacterController("devil");
            newDevil.setName("devil" + i);
            newDevil.setPosition(leftCoast.getEmptyPosition());
            newDevil.toCoast(leftCoast);
            leftCoast.toCoast(newDevil);

            characters[i + 3] = newDevil;
        }
    }
Exemple #3
0
        public void moveCharacter(zyzCharacterController characterController, Vector3 dest)
        {
            Vector3 curPos = characterController.getPosition();
            Vector3 midPos = curPos;

            if (dest.y > curPos.y)
            {
                midPos.y = dest.y;
            }
            else
            {
                midPos.x = dest.x;
            }
            SSAction action1   = CCMoveToAction.GetSSAction(midPos, characterController.speed);
            SSAction action2   = CCMoveToAction.GetSSAction(dest, characterController.speed);
            SSAction seqAction = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> {
                action1, action2
            });

            this.RunAction(characterController.getGameObject(), seqAction, this);
        }
    public void characterBeClicked(zyzCharacterController _characterController)
    {
        if (_characterController.isOnBoat())
        {
            CoastController theCoast;
            if (boat.getLeftRight() == false)
            {
                theCoast = rightCoast;
            }
            else
            {
                theCoast = leftCoast;
            }

            boat.offBoat(_characterController.getName());
            actionManager.moveCharacter(_characterController, theCoast.getEmptyPosition());
            _characterController.toCoast(theCoast);
            theCoast.toCoast(_characterController);
        }
        else
        {
            CoastController theCoast = _characterController.getCoastController();

            if (boat.getEmptyIndex() == -1)
            {
                return;
            }

            if (theCoast.getLeftRight() != boat.getLeftRight())
            {
                return;
            }

            theCoast.offCoast(_characterController.getName());
            actionManager.moveCharacter(_characterController, boat.getEmptyPosition());
            _characterController.toBoat(boat);
            boat.toBoat(_characterController);
        }
        userGUI.status = judge();
    }
 public void setController(zyzCharacterController _characterController)
 {
     chaController = _characterController;
 }