예제 #1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _sfxButtonPress     = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            _sfxHit             = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);
            _sfxScoreReached    = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);
            _spriteSheetTexture = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);


            _fadeInAnimation = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInAnimation.SetData(new Color[] { Color.White });


            _TRex           = new TRex(_spriteSheetTexture, new Vector2(Trexpos, TrexYpos - TRex.TrexHeiht), _sfxButtonPress);
            _TRex.DrewOrder = 10;


            _InputController = new ImputController(_TRex);

            _groundmanager = new GroundManager(_spriteSheetTexture, _entityManager, _TRex);

            _entityManager.AddEntity(_TRex);
            _entityManager.AddEntity(_groundmanager);

            _groundmanager.Initialize();
        }
예제 #2
0
    public void Start()
    {
        groundArrayCopy = new GroundManager.groundNode[32, 32, 32];

        groundManager = GameObject.Find("GameManager").GetComponent <GroundManager>();
        crabManager   = GameObject.Find("GameManager").GetComponent <CrabManager>();

        //get a copy of ground array for each crab
        for (int i = 0; i < 32; i++)
        {
            for (int j = 0; j < 32; j++)
            {
                for (int k = 0; k < 32; k++)
                {
                    groundArrayCopy[i, j, k] = groundManager.groundArray[i, j, k];
                }
            }
        }
        //addthis crab to the queue of crabs
        crabManager.crabs.Add(this);

        //mark current square as occupied
        Vector3 arrayPos = groundManager.worldToArray(parentSquare.transform.position);

        root            = groundArrayCopy[(int)arrayPos.x, (int)arrayPos.y, (int)arrayPos.z];
        root.square.tag = "Occupied";
    }
예제 #3
0
    public override bool onEnter()
    {
        m_key = new BuyChildKey();
        m_key.init(this);
        var _key = m_key as BuyChildKey;

        //if (m_key == null)
        //{
        //    m_key = new BasekeyState();
        //    m_key.init(gameObject);
        //    m_key.AddAllBtn(this.Ground.transform.Find("leftGround").gameObject);
        //}
        buttonMat = GameResourcesManager.GetMaterial("SelectButton");

        GroundManager.getMe().Init(this.Ground.transform.Find("AllGround").GetComponentsInChildren <Button>());
        for (int i = 0; i < GroundManager.getMe().leftBtns.Count; i++)
        {
            m_key.registerCallBack(GroundManager.getMe().leftBtns[i], btnOnClick);
            m_key.RegisterOnKeyChangedEvent(GroundManager.getMe().leftBtns[i], btnOnEnter, btnOnExit);
        }
        GroundManager.getMe().leftBtns[0].image.material = buttonMat;

        leftCard = this.Ground.transform.Find("leftCard");

        p      = BattleManager.Instance.leftPlayer;
        p.camp = eCamp.Left;

        textGold = this.UpData.transform.Find("NowGoldImage/nowGold").GetComponent <Text>();
        EventManager.getMe().GoldAdd(8);
        //NotificationCenter.DefaultCenter().AddObserver(this, "SetGold");
        return(true);
    }
    private IEnumerator IEStartMining(Vector2Int startPos, Vector2Int direction)
    {
        Vector2    playerStartPos = transform.position;
        Vector2Int targetPos      = startPos + direction;

        Vector2 targetPosFloats = targetPos;
        Vector2 diff            = targetPos - playerStartPos;
        float   totalDist       = diff.magnitude;
        Vector2 offset          = diff / totalDist;

        // Temorarilly disable player physics
        GetComponent <CircleCollider2D>().enabled = false;
        rb.isKinematic = true;

        // Enable dirt particle emmision
        horizontalDrillGO.transform.GetChild(0).GetComponent <ParticleSystem>().Play();
        downDrillGO.transform.GetChild(0).GetComponent <ParticleSystem>().Play();

        // Enable drill animation
        horizontalDrillAnim.SetTrigger("StartMining");
        downDrillAnim.SetTrigger("StartMining");

        // Play SFX
        float initialLength = digSource.clip.length;

        digSource.pitch = 1f / initialLength / 1.5f * (1f / diggingTime);
        digSource.Play();

        // Move the player
        float time = 0f;

        CameraShaker.Instance.ShakeOnce(0.35f, 3, diggingTime, diggingTime);
        while (time < diggingTime)
        {
            Vector2 newPos = Vector2.MoveTowards(transform.position, targetPos, Time.deltaTime * (1f / diggingTime));
            transform.position = new Vector3(newPos.x, newPos.y, -2);
            time += Time.deltaTime;
            yield return(null);
        }
        transform.position = targetPosFloats;

        // Destroy mined tile
        GroundManager.AddMinedTile(targetPos);
        GroundManager.DestroyTileInPosition(startPos + direction);

        // Reenable player physics
        GetComponent <CircleCollider2D>().enabled = true;
        rb.isKinematic = false;

        // Disable dirt particle emmision
        horizontalDrillGO.transform.GetChild(0).GetComponent <ParticleSystem>().Stop();
        downDrillGO.transform.GetChild(0).GetComponent <ParticleSystem>().Stop();

        // Enable drill animation
        horizontalDrillAnim.SetTrigger("StopMining");
        downDrillAnim.SetTrigger("StopMining");

        isInMiningState = false;
        UseHorizontalDrill();
    }
예제 #5
0
 // Needs to be awake
 // Otherwise highLight will instaniated as null
 void Awake()
 {
     modelManager  = gameObject.GetComponent <ModelManager> ();
     nodeManager   = gameObject.GetComponent <NodeManager> ();
     groundManager = gameObject.GetComponent <GroundManager>();
     toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #7
0
 private void OnEnable()
 {
     thisTransform = base.transform;
     thisBody      = GetComponent <Rigidbody>();
     grabManager   = GetComponentInParent <GrabManager>();
     groundManager = GetComponentInParent <GroundManager>();
     human         = GetComponentInParent <Human>();
 }
예제 #8
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance = this;
 }
예제 #9
0
    /// <summary>
    /// 把当前僵尸焦点到下一层的地板焦点
    /// </summary>
    void MoveZombieNodeToGround(ZombieInfo zombie)
    {
        //var ground = GroundManager.getMe().GetGround(Intercept.getMe().GetPosForCardName(zombieControl.gameObject.name));
        var ground = GroundManager.getMe().GetGround(zombie.pos);

        BattleWndUIController.getMe().GetBasekeyState().setCurKey(ground);
        ground.interactable = true;
    }
예제 #10
0
    void Start()
    {
        GameEventManager.GameStart += GameStart;
        GameEventManager.GameOver += GameOver;

        groundManager = (GroundManager)Instantiate(groundBehaviourPrefab);
        GamePlaying = false;
        GameEnded = false;
    }
예제 #11
0
 private void Start()
 {
     instance = this;
     for (int i = 0; i < 3; i++)
     {
         SpawnGround();
     }
     StartCoroutine(LevelUp());
 }
예제 #12
0
 /// <summary>
 /// 设置焦点为第一个btn
 /// </summary>
 public void SetFirstBtnOnNode()
 {
     m_key.setCurKey(GroundManager.getMe().leftBtns[0], false);
     for (int i = 0; i < GroundManager.getMe().leftBtns.Count; i++)
     {
         GroundManager.getMe().leftBtns[i].image.material = null;
     }
     GroundManager.getMe().leftBtns[0].image.material = buttonMat;
 }
예제 #13
0
 private void OnEnable()
 {
     all.Add(this);
     instance       = this;
     grabManager    = GetComponent <GrabManager>();
     groundManager  = GetComponent <GroundManager>();
     motionControl2 = GetComponent <HumanMotion2>();
     controls       = GetComponentInParent <HumanControls>();
 }
예제 #14
0
 private void OnSceneUnloaded(Scene scene)
 {
     Debug.Log("OnSceneUnloaded: " + scene.name);
     if (NetGame.isServer && NetGame.currentLevelInstanceID != NetGame.nextLevelInstanceID)
     {
         NetGame.currentLevelInstanceID = 0;
     }
     GroundManager.ResetOnSceneUnload();
 }
예제 #15
0
    // Use this for initialization
    void Start()
    {
        MyGroundManager = GameObject.Find("GroundManager").GetComponent <GroundManager>();
        MyGroundManager.OrderNextGround();
        MyGroundManager.OrderNextGround();
        heroModel = GameObject.Find("Hero").transform.FindChild("Model").gameObject;
        heroModel.renderer.material.mainTextureScale = new Vector2(1f / animationTilesAmount, 1);

        Time.timeScale = 1;
    }
예제 #16
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            var ballTexture = Content.Load <Texture2D>(ASSET_NAME_BALL);

            _ball = new BallEntity(ballTexture, new Vector2(BALL_POS_X, BALL_POS_Y));

            _ballManager = new BallManager(_ball);

            var groundTexture = Content.Load <Texture2D>(ASSET_NAME_GROUND);

            _groundManager = new GroundManager(groundTexture, _ball, _entityManager);

            _ballInputController = new BallInputController(_ball);

            _scoreBoardFont = Content.Load <SpriteFont>(ASSET_NAME_SCORE_BOARD_FONT);
            _scoreBoard     = new ScoreBoardEntity(_scoreBoardFont, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _ball);

            var wallTexture = Content.Load <Texture2D>(ASSET_NAME_WALL);

            _wallManager = new WallManager(wallTexture, _ball, _scoreBoard, _entityManager);

            _coinPickupSoundEffect = Content.Load <SoundEffect>(ASSET_NAME_COIN_PICKUP);

            _rotatingCoinAnimation = new TextureAnimation();

            _coin0 = Content.Load <Texture2D>(ASSET_NAME_COIN_0);
            _coin1 = Content.Load <Texture2D>(ASSET_NAME_COIN_1);
            _coin2 = Content.Load <Texture2D>(ASSET_NAME_COIN_2);
            _coin3 = Content.Load <Texture2D>(ASSET_NAME_COIN_3);
            _coin4 = Content.Load <Texture2D>(ASSET_NAME_COIN_4);

            _rotatingCoinAnimation.AddFrame(_coin0, ROTATING_COIN_ANIMATION_FRAME_DURATION);
            _rotatingCoinAnimation.AddFrame(_coin1, ROTATING_COIN_ANIMATION_FRAME_DURATION * 2);
            _rotatingCoinAnimation.AddFrame(_coin2, ROTATING_COIN_ANIMATION_FRAME_DURATION * 3);
            _rotatingCoinAnimation.AddFrame(_coin3, ROTATING_COIN_ANIMATION_FRAME_DURATION * 4);
            _rotatingCoinAnimation.AddFrame(_coin4, ROTATING_COIN_ANIMATION_FRAME_DURATION * 5);

            _rotatingCoinAnimation.Play();

            _coinManager = new CoinManager(_coin0, _ball, _scoreBoard, _entityManager, _coinPickupSoundEffect,
                                           _rotatingCoinAnimation);



            _entityManager.AddEntity(_ball);
            _entityManager.AddEntity(_ballManager);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_wallManager);
            _entityManager.AddEntity(_coinManager);

            _groundManager.Initialize();
        }
예제 #17
0
 private void Update()
 {
     if (GroundManager.IsStandingAny(base.gameObject))
     {
         joint.targetRotation = Quaternion.Euler(rotationStepped);
     }
     else
     {
         joint.targetRotation = Quaternion.Euler(rotationNotStepped);
     }
 }
예제 #18
0
    private void UpdateFire()
    {
        if (fired)
        {
            if (!GrabManager.IsGrabbedAny(release.gameObject))
            {
                if (timeFired > 1f)
                {
                    SetState(CatapultState.Idle);
                    return;
                }
                PullDownTrigger();
                timeFired += Time.fixedDeltaTime;
            }
            else
            {
                timeFired = 0f;
            }
            WriteArm();
            WriteWindlass();
            return;
        }
        timeFired = 0f;
        bool flag = GrabManager.IsGrabbedAny(arm.gameObject) || GroundManager.IsStandingAny(arm.gameObject);

        speed         += acceleration * Time.fixedDeltaTime * ((!flag) ? 1f : 0.9f);
        windlassAngle -= speed * Time.fixedDeltaTime;
        if (windlassAngle > topWindlassAngle)
        {
            currentTooth = (windlassAngle = topWindlassAngle);
        }
        WriteArm();
        WriteWindlass();
        if (windlassAngle != topWindlassAngle)
        {
            return;
        }
        for (int i = 0; i < Human.all.Count; i++)
        {
            Human human = Human.all[i];
            if (human.ragdoll.partLeftHand.sensor.grabBody == arm.GetComponent <Rigidbody>())
            {
                human.ragdoll.partLeftHand.sensor.ReleaseGrab(0.1f);
            }
            if (human.ragdoll.partRightHand.sensor.grabBody == arm.GetComponent <Rigidbody>())
            {
                human.ragdoll.partRightHand.sensor.ReleaseGrab(0.1f);
            }
            human.ragdoll.ReleaseHeavyArms();
        }
        fired = true;
    }
예제 #19
0
    private void Awake()
    {
        if (PlayerPrefs.GetInt("Level") == 0)
        {
            PlayerPrefs.SetInt("Level", 1);
        }
        groundManager = GroundManager.Instance;
        uiManager     = UIManager.Instance;
        player        = Player.getInstance();


        currentLevel = PlayerPrefs.GetInt("Level");
    }
예제 #20
0
    private void Start()
    {
        groundManager = GameObject.Find("GameManager").GetComponent <GroundManager>();

        startPoint  = this.transform;
        nodeManager = GameObject.Find("GameManager").GetComponent <NodeManager>();
        roundSystem = GameObject.Find("GameManager").GetComponent <RoundSystem>();

        arrayPos = nodeManager.worldToArray(this.transform.parent.position + new Vector3(0, 3, 0));
        checkPipe(arrayPos);

        dropValue = Random.Range(dropMin, dropMax);
        x         = Random.Range(1.0f, 5.0f);
    }
예제 #21
0
    private void Awake()
    {
        player          = Player.getInstance();
        stageManager    = StageManager.Instance;
        groundManager   = GroundManager.Instance;
        uiManager       = UIManager.Instance;
        particleManager = ParticleManager.Instance;

        defaultPosition = transform.position;

        currentLine = 1;

        player.setCurrentLine(currentLine);
    }
예제 #22
0
 /// <summary>
 /// 清除所有僵尸
 /// </summary>
 public void ClearAllZombie()
 {
     foreach (var item in p._ZombieMgr.GetAllZombieController())
     {
         m_key.unregBut(item.Value._Button);
         Destroy(item.Value.gameObject);
     }
     //for (int i = 0; i < zombies.Length; i++)
     //{
     //    m_key.unregBut(zombies[i].transform.Find("Button").GetComponent<Button>());
     //    Destroy(zombies[i].gameObject);
     //}
     GroundManager.getMe().ResetGround();
 }
    private void Update()
    {
        if (UpgradesStation.IsShopOpen() || inventory.IsOpen())
        {
            return;
        }

        // Check for fuel consumption
        if (isInMiningState || Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
        {
            fuelManager.DecreaseFuel(Time.deltaTime / 3);
        }

        if (!isFlying && IsTouchingGround() && (isInMiningState || rb.velocity.magnitude > 0.5f))
        {
            movingAnim.SetBool("isMoving", true);
        }
        else
        {
            movingAnim.SetBool("isMoving", false);
        }

        if (isFlying && IsTouchingGround())
        {
            isFlying = false;
            UseHorizontalDrill();
        }

        // Check for mining state
        if (!isInMiningState && !isFlying && rb.velocity.magnitude == 0)
        {
            // Get player tile position
            Vector2Int pos = new Vector2Int(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y));

            // Get direction to see if player wants to mine
            if (Input.GetKey(KeyCode.A) && isDirLeft && GroundManager.ExistsTileInPosition(pos + new Vector2Int(-1, 0)))
            {
                StartMining(pos, Vector2Int.left);
            }
            if (Input.GetKey(KeyCode.D) && !isDirLeft && GroundManager.ExistsTileInPosition(pos + new Vector2Int(1, 0)))
            {
                StartMining(pos, Vector2Int.right);
            }
            if (Input.GetKey(KeyCode.S) && GroundManager.ExistsTileInPosition(pos + new Vector2Int(0, -1)))
            {
                StartMining(pos, Vector2Int.down);
            }
        }
    }
    private void StartMining(Vector2Int startPos, Vector2Int direction)
    {
        if (isInMiningState || GroundManager.IsTileIndestructable(startPos + direction))
        {
            return;
        }

        isInMiningState = true;
        if (direction == Vector2Int.down)
        {
            UseDownDrill();
        }

        StartCoroutine(IEStartMining(startPos, direction));
    }
예제 #25
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            sfxButtonPress  = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);
            sfxHit          = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);

            _font = Content.Load <SpriteFont>("MyFont");

            spriteSheetTexture = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);

            _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInTexture.SetData(new Color[] { Color.White });

            trex           = new Trex(spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - Trex.TREX_DEF_SPRITE_HEIGHT), sfxButtonPress, GraphicsDevice);
            trex.DrawOrder = 10;

            trex.JumpComplete += TrexJumpComplete;
            trex.Died         += TrexDied;

            _scoreBoard = new ScoreBoard(spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), trex, sfxScoreReached);

            _inputController = new InputController(trex);

            _groundManager = new GroundManager(spriteSheetTexture, _entityManager, trex);

            _obstacleManager = new ObstacleManager(_entityManager, trex, _scoreBoard, spriteSheetTexture, GraphicsDevice);

            _backroundManager = new BackGroundManager(spriteSheetTexture, _entityManager, trex);

            _gameOverScreen = new GameOverScreen(
                spriteSheetTexture,
                new Vector2(
                    (WINDOW_WIDTH - GameOverScreen.GAME_OVER_TEXTURE_WIDTH) / 2,
                    (WINDOW_HEIGHT - GameOverScreen.GAME_OVER_TEXTURE_HEIGHT) / 3
                    ),
                this
                );

            _entityManager.AddEntity(trex);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_obstacleManager);
            _entityManager.AddEntity(_gameOverScreen);
            _entityManager.AddEntity(_backroundManager);
        }
    void OnTriggerExit2D(Collider2D collider)
    {
        GroundManager groundManager = GroundManager.instance;

        if (null == groundManager)
        {
            //-- Need the ground manager to loop the tile
            return;
        }

        if (collider.gameObject.CompareTag("GameArea"))
        {
            //-- Loop the tile when it leaves the game area
            groundManager.ReEnqueue(gameObject);
        }
    }
예제 #27
0
    // Use this for initialization
    void Awake()
    {
        pipeManager = GameObject.Find("GameManager").GetComponent <PipeManager> ();
        highLight   = GameObject.Find("GameManager").GetComponent <Highlight> ();
        toolManager = GameObject.Find("GameManager").GetComponent <ToolManager> ();

        modelManager  = GetComponent <ModelManager> ();
        roundManager  = GetComponent <RoundSystem> ();
        nodeManager   = GetComponent <NodeManager> ();
        groundManager = GetComponent <GroundManager>();
        toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();

        sounds = GameObject.Find("AudioManager").GetComponent <Sounds> ();

        Bank = GetComponent <CashManager> ();
    }
예제 #28
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _sfxButtonPress  = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            _sfxHit          = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);
            _sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);

            _spriteSheetTexture  = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);
            _invertedSpriteSheet = _spriteSheetTexture.InvertColors(Color.Transparent);

            _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInTexture.SetData(new Color[] { Color.White });

            _trex               = new Trex(_spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - Trex.TREX_DEFAULT_SPRITE_HEIGHT), _sfxButtonPress);
            _trex.DrawOrder     = 100;
            _trex.JumpComplete += trex_JumpComplete;
            _trex.Died         += trex_Died;

            _scoreBoard = new ScoreBoard(_spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _trex, _sfxScoreReached);
            //_scoreBoard.Score = 498;
            //_scoreBoard.HighScore = 12345;

            _inputController = new InputController(_trex);

            _groundManager   = new GroundManager(_spriteSheetTexture, _entityManager, _trex);
            _obstacleManager = new ObstacleManager(_entityManager, _trex, _scoreBoard, _spriteSheetTexture);
            _skyManager      = new SkyManager(_trex, _spriteSheetTexture, _invertedSpriteSheet, _entityManager, _scoreBoard);

            _gameOverScreen          = new GameOverScreen(_spriteSheetTexture, this);
            _gameOverScreen.Position = new Vector2(WINDOW_WIDTH / 2 - GameOverScreen.GAME_OVER_SPRITE_WIDTH / 2, WINDOW_HEIGHT / 2 - 30);

            _entityManager.AddEntity(_trex);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_obstacleManager);
            _entityManager.AddEntity(_gameOverScreen);
            _entityManager.AddEntity(_skyManager);

            _groundManager.Initialize();

            LoadSaveState();
        }
예제 #29
0
    private void Start()
    {
        NewPlayer += new SetPlayer(NewPlayerFinish);
        GameOver  += new PlayerFinish(FinishGame);

        // Get first checkpoint
        GameObject tmp = Utils.FilterTaggedObjectByParentAndName("Checkpoint", "Checkpoints", transform.parent.name);

        foreach (Transform child in tmp.transform)
        {
            Checkpoint checkpoint = child.GetComponent <Checkpoint>();
            if (checkpoint != null)
            {
                checkpoint.SetPlayerManager(this);
            }

            if (child.name == "Checkpoint 0")
            {
                _checkpoint = checkpoint;
            }
        }
        if (_checkpoint == null)
        {
            Debug.LogError("Checkpoint null");
        }

        // Get ground root object
        GameObject    groundRoot = GameObject.Find("Ground Root");
        GroundManager gManager   = groundRoot.GetComponent <GroundManager>();

        if (transform.parent.name == "Player 1")
        {
            NewPlayer += new SetPlayer(gManager.SetPlayerOneObject);
        }
        else
        {
            NewPlayer += new SetPlayer(gManager.SetPlayerTwoObject);
        }

        Restart();
    }
예제 #30
0
    void nextStage()
    {
        GroundManager g = GameObject.Find("GroundManager").GetComponent <GroundManager>();

        switch (g.stageNum)
        {
        case 0:
            SceneManager.LoadScene("Scene_01");
            break;

        case 1:
            SceneManager.LoadScene("Scene_02");
            break;

        case 2:
            SceneManager.LoadScene("Scene_03");
            break;

        case 3:
            SceneManager.LoadScene("Scene_End");
            break;
        }
    }
예제 #31
0
    //private void btnOnEnter(Button btn)
    //{
    //    btn.image.color = Color.white;
    //}

    //private void btnOnExit(Button btn)
    //{
    //    btn.image.color = Color.grey;
    //}

    //单机模式
    private void btnSingleOnClick()
    {
        GroundManager.getMe().ClearNum();
        BattleManager.Instance.leftPlayer.Init();
        if (uiMgr.getMe().FindUI(MenuWndUIController.ui_name) != null)
        {
            MenuWndUIController.getMe().isPingpong = false;
        }


        if (uiMgr.getMe().FindUI(BagWndUIController.ui_name) != null)
        {
            BagWndUIController.getMe().gameObject.SetActive(true);
            BagWndUIController.getMe().Notify();
            uiMgr.getMe().setTopUI(BagWndUIController.ui_name);
        }
        BagWndUIController.ShowOrHide(true);

        if (uiMgr.getMe().FindUI(BattleWndUIController.ui_name) != null)
        {
            BattleWndUIController.getMe().gameObject.SetActive(true);
            BattleWndUIController.getMe().SetFirstBtnOnNode();
            EventManager.getMe().GoldAdd(8);
        }

        BattleWndUIController.ShowOrHide(true);

        if (uiMgr.getMe().FindUI(BuyWndUIController.ui_name) != null)
        {
            BuyWndUIController.getMe().gameObject.SetActive(true);
            uiMgr.getMe().setTopUI(BuyWndUIController.ui_name);
            BuyWndUIController.getMe().Notify();
        }
        BuyWndUIController.ShowOrHide(true);

        StartWndUIController.ShowOrHide(false);
    }
예제 #32
0
    //Awake is always called before any Start functions
    void Awake()
    {
        SAVE_LOCATION = Application.persistentDataPath + "/gameInfo.dat";
        //Check if instance already exists
        if (instance == null)

            //if not, set instance to this
            instance = this;

        //If instance already exists and it's not this:
        else if (instance != this)

            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Get a component reference to the attached BoardManager script
        groundManager = GetComponent<GroundManager>();

        //Call the InitGame function to initialize the first level
        InitGame();
    }
예제 #33
0
	void Awake(){
		Instance=this;
	}
예제 #34
0
 void Awake()
 {
     _selfRef = this;
 }
예제 #35
0
    // Use this for initialization
    void Start()
    {
        MyGroundManager = GameObject.Find("GroundManager").GetComponent<GroundManager>();
        MyGroundManager.OrderNextGround();
        MyGroundManager.OrderNextGround();
        heroModel = GameObject.Find("Hero").transform.FindChild("Model").gameObject;
        heroModel.renderer.material.mainTextureScale = new Vector2(1f / animationTilesAmount, 1);

        Time.timeScale = 1;
    }