Esempio n. 1
0
 //实例化组件,加载资源
 void Start()
 {
     Director.getInstance().sceneController = this;
     patrol_factory = Singleton <PatrolFactory> .Instance;
     action_manager = (PatrolActionManager)gameObject.AddComponent <PatrolActionManager>();
     recorder       = Singleton <ScoreRecorder> .Instance;
     load();
 }
Esempio n. 2
0
    // Use this for initialization
    void Awake()
    {
        SSDirector director = SSDirector.GetInstance();

        director.CurrentSceneController = this;
        Factory        = Singleton <GameFactory> .Instance;
        action_manager = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
    }
Esempio n. 3
0
    void Start()
    {
        SSDirector director = SSDirector.GetInstance();

        director.currentSceneController = this;
        factory       = Singleton <PatroFactory> .GetInstance;
        actionManager = gameObject.AddComponent <PatrolActionManager> () as PatrolActionManager;
        LoadResources();
        recorder = Singleton <ScoreRecorder> .GetInstance;
    }
Esempio n. 4
0
 public void LoadResources()
 {
     Instantiate(Resources.Load <GameObject>("Prefabs/Maze"));
     action_manager = Singleton <PatrolActionManager> .Instance;
     patrol_factory = Singleton <PatrolFactory> .Instance;
     userGUI        = Singleton <UserGUI> .Instance;
     recorder       = Singleton <ScoreRecorder> .Instance;
     player         = Instantiate(Resources.Load("Prefabs/Player"), new Vector3(9, 9, -7), Quaternion.identity) as GameObject;
     patrols        = patrol_factory.GetPatrols();
 }
Esempio n. 5
0
 void Start(){
     SSDirector director = SSDirector.GetInstance();
     director.CurrentScenceController = this;
     patrol_factory = Singleton<PropFactory>.Instance;
     action_manager = gameObject.AddComponent<PatrolActionManager>() as PatrolActionManager;
     LoadResources();
     main_camera.GetComponent<CameraFlow>().follow = player;
     recorder = Singleton<ScoreRecorder>.Instance;
     player_speed *= 0.01f;
 }
Esempio n. 6
0
    void Start()
    {
        wall_sign = 1;
        SSDirector director = SSDirector.GetInstance();

        director.CurrentSceneController = this;
        patrol_factory = Singleton <PropFactory> .Instance;
        action_manager = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
        recorder = Singleton <ScoreRecorder> .Instance;
    }
    void Awake()
    {
        SSDirector director = SSDirector.GetInstance();

        director.CurrentScenceController = this;
        patrol_factory = Singleton <PropFactory> .Instance;
        action_manager = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
        //main_camera.GetComponent<CameraHelpness>().follow = player;
        recorder = Singleton <ScoreRecorder> .Instance;
    }
Esempio n. 8
0
    void Start()
    {
        SSDirector director = SSDirector.GetInstance();

        director.CurrentScenceController = this;
        _PatorlFactory       = Singleton <PatorlFactory> .Instance;
        _PatrolActionManager = Singleton <PatrolActionManager> .Instance;

        LoadResources();
        _ScoreRecorder = Singleton <ScoreRecorder> .Instance;
    }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        SSDirector director = SSDirector.getInstance();

        director.currentSceneController = this;
        patrolFactory  = Singleton <PatrolFactory> .Instance;
        crystalFactory = Singleton <CrystalFactory> .Instance;
        actionManager  = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        LoadResources();
        mainCamera.GetComponent <CameraMan>().target = player;
        scoreController = Singleton <ScoreController> .Instance;
    }
Esempio n. 10
0
    void Awake()
    {
        Director director = Director.getInstance();

        director.currentSceneController = this;
        judger              = gameObject.AddComponent <Judger>();
        patrolFactory       = gameObject.AddComponent <PatrolFactory>();
        playerArea          = 5;
        patrolActionManager = gameObject.AddComponent <PatrolActionManager>();
        gameObject.AddComponent <GameEventManager>();
        ui = gameObject.AddComponent <UI>() as UI;
    }
Esempio n. 11
0
    public int coinNumberGet   = 0;                                      // 玩家已收集硬币数量

    private void Awake()
    {
        SSDirector director = SSDirector.GetInstance();

        director.CurrentSceneController = this;

        patrolsFactory = Singleton <PatrolFactory> .Instance;
        coinFactory    = Singleton <CoinFactory> .Instance;
        scoreRecorder  = Singleton <ScoreRecorder> .Instance;
        actionManager  = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
        userGUI        = gameObject.AddComponent <UserGUI>() as UserGUI;
        timeManager    = gameObject.AddComponent <TimeManager>() as TimeManager;

        director.CurrentSceneController.LoadResource();
        gameOver = false;
    }
Esempio n. 12
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]);
        }
    }
Esempio n. 13
0
 // Use this for initialization
 void Start()
 {
     director        = Director.getInstance();
     factory         = Singleton <PatrolFactory> .Instance;
     board           = Singleton <ScoreBoard> .Instance;
     director.scence = this;
     manager         = gameObject.AddComponent <PatrolActionManager>() as PatrolActionManager;
     gameObject.GetComponent <PatrolActionManager> ().player = player;
     for (int i = 0; i < 10; i++)
     {
         GameObject monster = factory.getPatrol(i / 2);
         monsters.Add(monster);
         manager.beginPatrol(monster);
     }
     getLocations(5);
     reloadSource();
 }
Esempio n. 14
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]);
        }
    }
Esempio n. 15
0
    void Start()
    {
        //这一块注意一下,关于实例化,和实例化的查找
        //首先director是单例模式,所以用GetInstance方法,即使没有实例也会创建实例,有实例就确保只有一个实例
        //那么_PatorlFactory和_PatrolActionManager是怎么回事
        //首先看到代码可以这样写,用Singleton,这个是直接查找有没有这个类,没有就报错了
        //所以使用这个有个前提条件,就是必须已经存在了,所以在游戏开始之前必须把代码绑定到对应的物体上
        //如果不采用这种方法怎么办,可以手动添加,用AddComponent就相当于把手动添加的部分,用代码实现了,就是注释掉的部分
        SSDirector director = SSDirector.GetInstance();

        director.CurrentScenceController = this;
        _PatorlFactory       = Singleton <PatorlFactory> .Instance;
        _PatrolActionManager = Singleton <PatrolActionManager> .Instance;
        //_PatrolActionManager = gameObject.AddComponent<PatrolActionManager>() as PatrolActionManager;

        //ISceneController接口中函数的实现
        LoadResources();
        //设置摄像机跟随的对象,也就是玩家,如果不用工厂模式的话,直接在场景中生成玩家,然后把玩家拖到摄像机的Targer就可以了
        //这一块也要注意,main_camera的位置必须在LoadResources之后,因为main_camera跟随的对象是player,如果player没有实例化就无法运行
        //所以如果一开始在场景中就有player的话,下面的代码位置就可以随便放。
        main_camera.GetComponent <CameraFlow>().follow = player;
        _ScoreRecorder = Singleton <ScoreRecorder> .Instance;
    }