Пример #1
0
    // Use this for initialization
    void InitGame()
    {
        gameTouchController = new GameTouchController();

        //创建角色
        GameObject roleObj = Resources.Load("Prefabs/MapObj/InGameRole") as GameObject;

        roleObj = Instantiate(roleObj);
        role    = roleObj.GetComponent <InGameRole>();

        roleObj.transform.position = new Vector3(0, GetGameRect().y + 5, 0);

        gameEffectManager = new GameEffectManager();

        //
        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();

        inGameUIManager = new InGameUIManager();
        inGameUIManager.Init();

        int selmodel = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL, 0);

        modelManager = InGameBaseModel.Create(selmodel);
        modelManager.Init();

        inGameColorManager = new InGameColorManager();
        inGameColorManager.Init();

        gameState = enGameState.playing;
    }
Пример #2
0
    // ------------------------------------------------------------------------------------ //
    public void onTouchBegan(GameTouchController gameTouchController, GameTouchParams gameTouchParams)
    {
        // Check active unit
        if (gameTouchParams.touchGameObject.tag.Equals(UnitBase.UNIT_TAG))
        {
            UnitBase unit = gameTouchParams.touchGameObject.GetComponent<UnitBase>();
            if (unit != null && unit.isUnitMaster())
            {
                if (activeUnit != null && activeUnit.Equals(unit))
                {
                    activeUnit.setActive(false);
                    activeUnit = null;
                }
                else
                {
                    setNewActiveUnit(unit);
                }

                return;
            }
        }

        // Move active unit if not return
        if (activeUnit != null) {
            ((UnitMasterBase) activeUnit).moveAtPosition(gameTouchParams.touchPosition);
        }
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        gameTouchController = new GameTouchController();

        //创建角色
        GameObject roleObj = Resources.Load("Prefabs/MapObj/InGameRole") as GameObject;

        roleObj = Instantiate(roleObj);
        role    = roleObj.GetComponent <InGameRole>();

        //地面
        GameObject touchPlaneObj = Resources.Load("Prefabs/MapObj/TouchPlane") as GameObject;

        touchPlane = Instantiate(touchPlaneObj);


        GameObject groundPlaneObj = Resources.Load("Prefabs/MapObj/GroundPlane") as GameObject;

        groundPlane = Instantiate(groundPlaneObj);
        //
        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();

        inGameUIManager = new InGameUIManager();
        inGameUIManager.Init();

        int selmodel = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL, 0);

        modelManager = InGameBaseModel.Create(selmodel);
        modelManager.Init();

        gameState = enGameState.playing;
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        gameTouchController = new GameTouchController();
        touchManager        = new TouchManager();

        gameEffectManager = new GameEffectManager();

        inGameObjectManager = new InGameObjectManager();
        inGameObjectManager.Init();
        inGamePlayerManager = new InGamePlayerManager();
        inGamePlayerManager.Init();
        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();
        inGameMapManager = new InGameMapManager();
        inGameMapManager.Init();
    }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        //初始化事件管理器
        EventManager em = gameObject.AddComponent <EventManager>();

        EventManager.Register(this,
                              EventID.EVENT_TOUCH_SWEEP,
                              EventID.EVENT_TOUCH_UP);



        GameObject obj = GameObject.Find("Girl1");

        girl1 = obj.transform.GetComponent <InGameBaseCharacter>();
        girl1.Init(1, 1, enMSCamp.en_camp_player);
        gameTouchController = new GameTouchController();
    }
Пример #6
0
    public void initialize()
    {
        gameCamera = GameCamera.createNewInstance();
        gameCamera.setPosition(new Vector3 (0,10.0f,0));
        gameCamera.setRotation(Quaternion.Euler(90.0f,0,0));

        gameTouchController = GameTouchController.createNewInstance(gameObject);
        gameTouchController.addCamera(gameCamera.getCamera());

        gameTimer = GameTimer.createNewInstance(gameObject);
        gameTimer.registerObserver((IGameTimerObserver) this);

        gameUI = GameUI.createNewInstance(gameObject);
        gameUI.setTimerText(gameTimer.getTime());
        gameUI.setHealth(healthCount);

        gameBombsUI = gameUI.getGameBombsUI();
        gameBombsUI.setBombs(bombsCount);
        gameBombsUI.registerObserver((IGameBombsUIObserver) this);
    }
Пример #7
0
    public void initialize()
    {
        gameCamera = GameCamera.createNewInstance();
        gameCamera.setPosition(new Vector3 (0,10.0f,0));
        gameCamera.setRotation(Quaternion.Euler(90.0f,0,0));

        gameTouchController = GameTouchController.createNewInstance(gameObject);
        gameTouchController.addCamera(gameCamera.getCamera());

        gameTimer = GameTimer.createNewInstance(gameObject);
        gameTimer.registerObserver((IGameTimerObserver) this);

        gameUI = GameUI.createNewInstance(gameObject);
        gameUI.setTimerText(gameTimer.getTime());
        gameUI.setStarsText(starsCount);

        activeUnitController = ActiveUnitController.createNewInstance(gameObject);
        gameTouchController.registerObserver((IGameTouchObserver) activeUnitController);

        fenceController = FenceController.createNewInstance(gameObject);

        // create ponys
        for (int i=0; i<6; i++)
        {
            for (int j=0; j<2; j++)
            {
                UnitSlaveBase unitSlave = (UnitSlaveBase) UnitFactory.createNewUnit(UnitType.Pony);
                unitSlave.UnitPosition = new Vector3 ((i-2.5f)*2.0f, 0.0f, j*3.0f);
                unitSlave.registerObserver((IUnitBehindFenceObserver) this);

                slaveUnits.Add(unitSlave);
            }
        }

        // create dogs
        for (int j=0; j<3; j++)
        {
            UnitBase unit = UnitFactory.createNewUnit(UnitType.Dog);
            unit.UnitPosition = new Vector3 ((j-1.0f)*5.0f, 0.0f, -3.0f);
        }
    }
Пример #8
0
    // Use this for initialization
    void InitGame()
    {
        gameTouchController = new GameTouchController();

        //创建角色
        GameObject roleObj = Resources.Load("Prefabs/MapObj/InGameRole") as GameObject;

        roleObj = Instantiate(roleObj);
        role    = roleObj.GetComponent <InGameRole>();

        roleObj.transform.position = new Vector3(0, GetGameRect().y + 5, 0);

        gameEffectManager = new GameEffectManager();

        //
        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();

        inGameUIManager = new InGameUIManager();
        inGameUIManager.Init();

        int selmodel = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL, 0);

        modelManager = InGameBaseModel.Create(selmodel);
        modelManager.Init();

        InGameColorManager.GetInstance().Init();
        inGameUIManager.gamePadManager.scoreslabel.SetColor(InGameColorManager.GetInstance().bgColor);

        gameState = enGameState.playing;

        int teachCount = PlayerPrefs.GetInt("teachcount", 0);

        if (teachCount < 2)
        {
            GameObject teachObj = Resources.Load("Prefabs/UI/TeachLayer") as GameObject;
            teachObj = Instantiate(teachObj);
            PlayerPrefs.SetInt("teachcount", teachCount + 1);
        }
    }
Пример #9
0
    // Use this for initialization
    void InitGame()
    {
        gameTouchController = new GameTouchController();

        //创建角色
        GameObject roleObj = Resources.Load("Prefabs/MapObj/InGameRole") as GameObject;

        roleObj = Instantiate(roleObj);
        role    = roleObj.GetComponent <InGameRole>();
        role.Init();

        role.transform.position = new Vector3(0, 0.5f, 0);
        //role.Jump(new Vector3(0f, 1f));

        role.SetCameraPos();

        //gameEffectManager = new GameEffectManager();

        //
        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();

        inGameUIManager = new InGameUIManager();
        inGameUIManager.Init();

        int selmodel = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL, 0);

        modelManager = InGameBaseModel.Create(selmodel);
        modelManager.Init();

        inGameColorManager = new InGameColorManager();
        inGameColorManager.Init();

        //gameState = enGameState.playing;

        GameObject teachObj = Resources.Load("Prefabs/UI/TeachLayer") as GameObject;

        teachObj = Instantiate(teachObj);
    }
Пример #10
0
    // Use this for initialization
    void GameInit()
    {
        gameTouchController = new GameTouchController();

        inGameUIManager = new InGameUIManager();
        inGameUIManager.Init();

        inGameCameraManager = new InGameCameraManager();
        inGameCameraManager.Init();

        inGameObjManager = new InGameObjManager();
        inGameObjManager.Init();

        playerCtrlManager = new PlayerCtrlManager();
        playerCtrlManager.Init();

        inGameLevelManager = new InGameLevelManager();
        inGameLevelManager.Init();

        inGamePlayerManager = new InGamePlayerManager();
        inGamePlayerManager.Init();

        gameState = enGameState.playing;
    }
Пример #11
0
    private void Awake()
    {
        instance = this;

        mGameTouchController = GetComponent <GameTouchController>();
    }
Пример #12
0
 // ------------------------------------------------------------------------------------ //
 public virtual void onTouchBegan(GameTouchController gameTouchController)
 {
     notifyUnitDeadObservers();
     setStateDead();
 }