예제 #1
0
 private void Start()
 {
     loadResources();
     patrolFactory.StartPatrol();
     for (int i = 0; i < patrols.Count; i++)
     {
         patrolActionManager.Patrol(patrols[i]);
     }
     moveWall = GameObject.FindGameObjectWithTag("move");
 }
예제 #2
0
    void Update()
    {
        GameObject tmp1 = null;
        GameObject tmp2 = null;

        foreach (GameObject patrol in patroling)
        {
            if (Vector3.Distance(patrol.transform.position, player.transform.position) <= 5)
            {
                tmp1 = patrol;
                patrolActionManager.CatchPlayer(patrol);
            }
        }
        if (tmp1 != null)
        {
            catching.Add(tmp1);
            patroling.Remove(tmp1);
        }
        foreach (GameObject patrol in catching)
        {
            if (Vector3.Distance(patrol.transform.position, player.transform.position) <= 1)
            {
                gameover = true;
            }
            if (Vector3.Distance(patrol.transform.position, player.transform.position) > 5)
            {
                tmp2 = patrol;
                patrolActionManager.Patrol(patrol);
                scoreRecorder.addScore();
            }
        }
        if (tmp2 != null)
        {
            patroling.Add(tmp2);
            catching.Remove(tmp2);
        }
    }
예제 #3
0
    //public Camera cameraMain;

    void Start()
    {
        SSDirector director = SSDirector.getInstance();

        director.CurrentSceneController = this;
        scoreRecorder       = Singleton <ScoreRecorder> .Instance;
        patrolFactory       = Singleton <PatrolFactory> .Instance;
        playerRegion        = 4;
        patrolActionManager = gameObject.AddComponent <PatrolActionManager>();
        userGUI             = gameObject.AddComponent <UserGUI>() as UserGUI;
        LoadResources();
        for (int i = 0; i < patrols.Count; ++i)
        {
            patrolActionManager.Patrol(patrols[i]);
        }
    }
예제 #4
0
    private List <GameObject> patrols;                             // 场景中巡逻兵列表

    // 场景初始化
    void Start()
    {
        Director director = Director.GetInstance();

        director.CurrentSceneController = this;
        patrolFactory       = Singleton <PatrolFactory> .Instance;
        playerRegion        = 5;
        patrolActionManager = gameObject.AddComponent <PatrolActionManager>();
        userGUI             = gameObject.AddComponent <UserGUI>() as UserGUI;
        director.SetFPS(30);
        director.leaveSeconds = 60;
        LoadResources();
        // 巡逻兵开始巡逻
        for (int i = 0; i < patrols.Count; i++)
        {
            patrolActionManager.Patrol(patrols[i]);
        }
    }
예제 #5
0
 // 失去目标,巡逻兵放弃追击
 public void OnGoalLost(GameObject patrol)
 {
     patrolActionManager.Patrol(patrol);
     scoreRecorder.Record();
 }
예제 #6
0
 // 失去目标,巡逻兵放弃追击
 public void OnGoalLost(GameObject patrol)
 {
     patrolActionManager.Patrol(patrol);
 }