Esempio n. 1
0
    public void genGameObjects()
    {
        characters = new ICharacterController[6];
        boat       = new BoatController();
        leftLand   = new LandController(-1);
        rightLand  = new LandController(1);

        for (int i = 0; i < 3; i++)
        {
            ICharacterController priest = new ICharacterController(0, "priest" + i);
            priest.setPosition(rightLand.getEmptyPosition());
            priest.getOnLand(rightLand);
            rightLand.getOnLand(priest);
            characters[i] = priest;
        }

        for (int i = 0; i < 3; i++)
        {
            ICharacterController demon = new ICharacterController(1, "demon" + i);
            demon.setPosition(rightLand.getEmptyPosition());
            demon.getOnLand(rightLand);
            rightLand.getOnLand(demon);
            characters[i + 3] = demon;
        }
    }
Esempio n. 2
0
    public void LoadResources()
    {
        characters = new ICharacterController[6];
        GameObject river = Instantiate(Resources.Load("Prefabs/River", typeof(GameObject)), new Vector3(0, -0.25f, 0), Quaternion.identity, null) as GameObject;

        river.name = "river";

        boat      = new BoatController();
        leftLand  = new LandController(-1);
        rightLand = new LandController(1);

        for (int i = 0; i < 3; ++i)
        {
            ICharacterController priest = new ICharacterController(0, "priest" + i);
            priest.setPosition(rightLand.getEmptyPosition());
            priest.getOnLand(rightLand);
            rightLand.getOnLand(priest);
            characters[i] = priest;
        }

        for (int i = 0; i < 3; ++i)
        {
            ICharacterController devil = new ICharacterController(1, "devil" + i);
            devil.setPosition(rightLand.getEmptyPosition());
            devil.getOnLand(rightLand);
            rightLand.getOnLand(devil);
            characters[i + 3] = devil;
        }
    }
Esempio n. 3
0
    //导入各种预制体资源
    public void LoadResources()
    {
        //背景设置(其实就是一个方块加点贴图。能力限制,就这么弄了)
        background             = Instantiate <Transform>(Resources.Load <Transform>("Prefabs/backGround"), new Vector3(0, 6, 3), Quaternion.identity);
        background.name        = "background";
        background.localScale += new Vector3(35, 20, 2);
        background.Rotate(new Vector3(10, 0, 180));

        //导入陆地、河流和船
        GameObject river = createObject("River", new Vector3(0, 0, -2));

        river.name = "river";

        GameObject leftLand = createObject("Land", new Vector3(-10, 0.5f, -2));

        leftLand.name = "leftLand";

        GameObject rightLand = createObject("Land", new Vector3(10, 0.5f, -2));

        rightLand.name = "rightLand";

        GameObject t_boat = createObject("Boat", new Vector3(5, 1.15f, -2.5f));

        t_boat.name = "boat";

        //设置控制器
        fromLand = new LandController(rightLand, 1);
        toLand   = new LandController(leftLand, -1);
        boat     = new BoatController(t_boat);
        //导入游戏人物对象并设置控制器
        for (int i = 0; i < 3; i++)
        {
            GameObject    temp = createObject("devil", Vector3.zero);
            ChaController cha  = new ChaController(temp, 1);
            cha.setName("devil" + i);
            cha.setPosition(fromLand.getEmptyPosition());
            cha.getOnLand(fromLand);
            fromLand.getOnLand(cha);

            people[i] = cha;
        }

        for (int i = 0; i < 3; i++)
        {
            GameObject    temp = createObject("Priests", Vector3.zero);
            ChaController cha  = new ChaController(temp, 0);

            cha.setName("priest" + i);
            cha.setPosition(fromLand.getEmptyPosition());
            cha.getOnLand(fromLand);
            fromLand.getOnLand(cha);

            people[i + 3] = cha;
        }
    }
 public void reset()
 {
     landController = (GameDirector.getInstance().currentSceneController as FirstController).rightLand;
     getOnLand(landController);
     setPosition(landController.getEmptyPosition());
     landController.getOnLand(this);
 }
Esempio n. 5
0
 //重置
 public void Reset()
 {
     moveable.Reset();
     landController = (Director.getInstance().currentSceneController as FirstController).fromLand;
     getOnLand(landController);
     setPosition(landController.getEmptyPosition());
     landController.getOnLand(this);
 }
Esempio n. 6
0
    private void loadCharacter()
    {
        for (int i = 0; i < 3; i++)
        {
            MyCharacterController cha = new MyCharacterController("priest");
            cha.setName("priest" + i);
            cha.setPosition(fromCoast.getEmptyPosition());
            cha.getOnCoast(fromCoast);
            fromCoast.getOnLand(cha);

            characters[i] = cha;
        }

        for (int i = 0; i < 3; i++)
        {
            MyCharacterController cha = new MyCharacterController("devil");
            cha.setName("devil" + i);
            cha.setPosition(fromCoast.getEmptyPosition());
            cha.getOnCoast(fromCoast);
            fromCoast.getOnLand(cha);

            characters[i + 3] = cha;
        }
    }