示例#1
0
 public void setting(Vector3 target, float speed, ActionCallback monitor)
 {
     this.target  = target;
     this.speed   = speed;
     this.monitor = monitor;
     GameSceneController.GetInstance().setMoving(true);
 }
示例#2
0
    void Start()
    {
        GameSceneController my = GameSceneController.GetInstance();

        my.setBaseCode(this);
        gameRule = "Boat capacity is 2. One person must steer the boat from one side to the other side. Click 'on' buttons to move a person onto the boat and click the 'go' buttons to move the boat to the other side. If priests are outnumbered by devils on either side, they get killed by devils!    Sphere---Priest Cube---Devil";
    }
示例#3
0
    void Start()
    {
        GameSceneController my = GameSceneController.GetInstance();

        my.setBaseCode(this);
        gameName = "Priests and Devils";
        gameRule = "sphere -- Priest    Cube -- Devil";
    }
示例#4
0
    void Start()
    {
        GameSceneController my = GameSceneController.GetInstance();

        my.setBaseCode(this);
        gameName = "Priests and Devils";
        gameRule = "Priests and Devils is a puzzle game in which you will help the Priests and Devils to cross the river within the time limit. There are 3 priests and 3 devils at one side of the river. They all want to get to the other side of this river, but there is only one boat and this boat can only carry two persons each time. And there must be one person steering the boat from one side to the other side. In the flash game, you can click on them to move them and click the go button to move the boat to the other direction. If the priests are out numbered by the devils on either side of the river, they get killed and the game is over. You can try it in many ways. Keep all priests alive! Good luck!             Sphere -- Priest    Cube -- Devil";
    }
示例#5
0
    void Start()
    {
        GameSceneController my = GameSceneController.GetInstance();

        my.setBaseCode(this);
        gameName = "Priests and Devils";
        gameRule = "If the priests are out numbered by the devils on either side of the river, they get killed and the game is over. Keep all priests alive! \nGreen -- Priest    Red -- Devil";
    }
示例#6
0
    void Start()
    {
        my = GameSceneController.GetInstance();
        my.setGenGameObject(this);
        LoadResources();
        GameObject gameObject = GameObject.Find("MainCamera");

        mainCamera = gameObject.GetComponent <Camera>();
        mainCamera.transform.LookAt(Boat.transform);
    }
示例#7
0
 void Update()
 {
     if (obj.transform.position == target)
     {
         GameSceneController.GetInstance().setMoving(false);
         if (monitor != null)
         {
             monitor.OnActionCompleted(this);
         }
         Destroy(this);
     }
 }
示例#8
0
 private void Update()
 {
     if (obj.transform.position == target)
     {
         // 完成动作后destroy
         GameSceneController.GetInstance().setMoving(false);
         if (monitor != null)
         {
             monitor.OnActionDone(this);
         }
         Destroy(this);
     }
 }
示例#9
0
        private void Update()
        {
            transform.position = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);

            // Destroy after done
            if (transform.position == target)
            {
                GameSceneController.GetInstance().setMoving(false);
                if (monitor != null)
                {
                    monitor.OnActionDone(this);
                }
                Destroy(this);
            }
        }
示例#10
0
    // Update is called once per frame
    void Update()
    {
        float step = speed * Time.deltaTime;

        transform.position = Vector3.MoveTowards(transform.position, target, step);
        if (transform.position == target)
        {
            GameSceneController.GetInstance().setMoving(false);
            if (monitor != null)
            {
                monitor.OnActionCompleted(this);
            }
            Destroy(this);
        }
    }
示例#11
0
 void Start()
 {
     GameSceneController.GetInstance().setGenGameObject(this);
     Instantiate(Resources.Load("Prefabs/Directional Light"));
     Instantiate(Resources.Load("Prefabs/Shore"), shoreStartPos, Quaternion.identity);
     Instantiate(Resources.Load("Prefabs/Shore"), shoreEndPos, Quaternion.identity);
     boat_obj = Instantiate(Resources.Load("Prefabs/Boat"), boatStartPos, Quaternion.identity) as GameObject;
     for (int i = 0; i < 3; ++i)
     {
         GameObject priest = Instantiate(Resources.Load("Prefabs/Priest")) as GameObject;
         priest.transform.position = getCharacterPosition(priestStartPos, i);
         priests_start.Push(priest);
         GameObject devil = Instantiate(Resources.Load("Prefabs/Devil")) as GameObject;
         devil.transform.position = getCharacterPosition(devilStartPos, i);
         devils_start.Push(devil);
     }
 }
示例#12
0
    public void RunAction(GameObject obj, Vector3 target, float speed, ISSActionCallback monitor)
    {
        this.obj     = obj;
        this.target  = target;
        this.speed   = speed;
        this.monitor = monitor;
        GameSceneController.GetInstance().setMoving(true);

        if (target.y < obj.transform.position.y)
        {
            Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z);
            SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetZ, speed, this);
        }
        else
        {
            Vector3 targetY = new Vector3(target.x, target.y, obj.transform.position.z);
            SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetY, speed, this);
        }
    }
    //检查游戏状态
    void check()
    {
        GameSceneController scene = GameSceneController.GetInstance();
        int p_on_Bank = 0, d_on_Bank = 0;
        int p_s = 0, d_s = 0, p_e = 0, d_e = 0;

        if (p_end.Count == 3 && d_end.Count == 3)
        {
            scene.Set_message("Win!");
            return;
        }

        for (int i = 0; i < 2; ++i)
        {
            if (boat[i] != null && boat[i].tag == "Priest")
            {
                p_on_Bank++; //给牧师和恶魔添加Tag,以区分
            }
            else if (boat[i] != null && boat[i].tag == "Devil")
            {
                d_on_Bank++;
            }
        }
        if (side == 1)
        {
            p_e = p_end.Count;
            d_e = d_end.Count;
            p_s = p_start.Count + p_on_Bank;
            d_s = d_start.Count + d_on_Bank;
        }
        else if (side == 2)
        {
            p_e = p_on_Bank + p_end.Count;
            d_e = d_on_Bank + d_end.Count;
            p_s = p_start.Count;
            d_s = d_start.Count;
        }
        if ((p_e < d_e && p_e != 0) || (p_s < d_s && p_s != 0))
        {
            scene.Set_message("Lose!");
        }
    }
示例#14
0
    void check()
    {
        GameSceneController scene = GameSceneController.GetInstance();
        int pOnb = 0, dOnb = 0;
        int priests_s = 0, devils_s = 0, priests_e = 0, devils_e = 0;

        if (priests_end.Count == 3 && devils_end.Count == 3)
        {
            scene.setMessage("Win!");
            return;
        }

        for (int i = 0; i < 2; ++i)
        {
            if (boat[i] != null && boat[i].tag == "Priest")
            {
                pOnb++;
            }
            else if (boat[i] != null && boat[i].tag == "Devil")
            {
                dOnb++;
            }
        }
        if (side == 1)
        {
            priests_s = priests_start.Count + pOnb;
            devils_s  = devils_start.Count + dOnb;
            priests_e = priests_end.Count;
            devils_e  = devils_end.Count;
        }
        else if (side == 2)
        {
            priests_s = priests_start.Count;
            devils_s  = devils_start.Count;
            priests_e = priests_end.Count + pOnb;
            devils_e  = devils_end.Count + dOnb;
        }
        if ((priests_s != 0 && priests_s < devils_s) || (priests_e != 0 && priests_e < devils_e))
        {
            scene.setMessage("Lose!");
        }
    }
示例#15
0
        public void setting(GameObject obj, Vector3 target, float speed, ActionCallback monitor)
        {
            this.obj     = obj;
            this.target  = target;
            this.speed   = speed;
            this.monitor = monitor;
            GameSceneController.GetInstance().setMoving(true);

            if (target.y < obj.transform.position.y)
            {
                // 下船
                Vector3 DirecX = new Vector3(target.x, obj.transform.position.y, target.z);
                //ActionManager.GetInstance().ApplyMoveToAction(obj, DirecX, speed, this.monitor);
                ActionManager.GetInstance().ApplyMoveToAction(obj, target, speed, this.monitor);
            }
            else
            {
                Vector3 DirecY = new Vector3(obj.transform.position.x, target.y, target.z);
                //ActionManager.GetInstance().ApplyMoveToAction(obj, DirecY, speed, this.monitor);
                ActionManager.GetInstance().ApplyMoveToAction(obj, target, speed, this.monitor);
            }
        }
示例#16
0
        public void setting(GameObject obj, Vector3 target, float speed, IU3dActionCompleted monitor)
        {
            this.obj     = obj;
            this.target  = target;
            this.speed   = speed;
            this.monitor = monitor;
            GameSceneController.GetInstance().setMoving(true);

            /* If obj is higher than target, move to target.z first, then move to target.y
             * If obj is lower than target, move to target.y first, then move to target.z
             * The turn is implemented through callback function
             */
            if (target.y < obj.transform.position.y)
            {
                Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z);
                ActionManager.GetInstance().ApplyMoveToAction(obj, targetZ, speed, this);
            }
            else
            {
                Vector3 targetY = new Vector3(obj.transform.position.x, target.y, target.z);
                ActionManager.GetInstance().ApplyMoveToAction(obj, targetY, speed, this);
            }
        }
示例#17
0
 void Start()
 {
     Inst = GameSceneController.GetInstance();
     Inst.setGenGameObject(this);
     loadSrc();
 }
示例#18
0
 void Start()
 {
     Inst   = GameSceneController.GetInstance();
     action = GameSceneController.GetInstance() as IUserActions;
 }
示例#19
0
 void Start()
 {
     scene  = GameSceneController.GetInstance();
     state  = GameSceneController.GetInstance() as QueryGameStatus;
     action = GameSceneController.GetInstance() as UserActions;
 }
示例#20
0
 // 游戏开始时
 private void Start()
 {
     my = GameSceneController.GetInstance();
     my.setGenGameObject(this);
     LoadSrc();
 }
示例#21
0
    void Start()
    {
        GameSceneController controller = GameSceneController.GetInstance();

        controller.setBaseCode(this);
    }
示例#22
0
 void Start()
 {
     GameSceneController my = GameSceneController.GetInstance();
 }
示例#23
0
 void Start()
 {
     GameSceneController.GetInstance().setModel(this);
     loadSrc();
 }
 void Start()
 {
     my = GameSceneController.GetInstance();
     my.setGenGameObject(this);
     Screen();
 }
示例#25
0
 void Start()
 {
     my    = GameSceneController.GetInstance();
     act   = GameSceneController.GetInstance() as IUserAction;
     state = GameSceneController.GetInstance() as Judgement;
 }
示例#26
0
文件: main.cs 项目: linqy71/Unity3d
 // Use this for initialization
 void Start()
 {
     GameSceneController my = GameSceneController.GetInstance();
     //my.setBaseCode(this);
 }
示例#27
0
 private void Start()
 {
     my     = GameSceneController.GetInstance();
     action = GameSceneController.GetInstance() as IUact;
     state  = GameSceneController.GetInstance() as GameState;
 }