当前位置: 首页>>代码示例>>C#>>正文


C# Wave.waveWithPrefabParentLimits方法代码示例

本文整理汇总了C#中Wave.waveWithPrefabParentLimits方法的典型用法代码示例。如果您正苦于以下问题:C# Wave.waveWithPrefabParentLimits方法的具体用法?C# Wave.waveWithPrefabParentLimits怎么用?C# Wave.waveWithPrefabParentLimits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wave的用法示例。


在下文中一共展示了Wave.waveWithPrefabParentLimits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	//init
	void Start () {
        
        //debug
        debugOn = false; //default to off

        //properties
        currentLevel = 0; //initial level
        isGameOver = false; //initial flag

        //objects
        theCam = Camera.main; //main camera in scene
        theGame = GameObject.FindWithTag(TAG_GAME); //game manager object in scene
        theDimView = GameObject.FindWithTag(TAG_DIMVIEW); //dim view game object in scene
		theVisor = GameObject.FindWithTag(TAG_VISOR); //visor object in scene
        theVisorFrameView = GameObject.FindWithTag(TAG_VISOR_FRAMEVIEW); //visor frame view object in scene
        theTargets = GameObject.FindWithTag(TAG_TARGETS); //targets game object container in scene
        theTutorial = GameObject.FindWithTag(TAG_TUTORIAL); //tutorial game object container in scene

		//scripts
		theBounds = theGame.AddComponent<Bounds>(); //add new bounds script
		theData = theGame.AddComponent<GazeDataManager>(); //add new data manager script
        theWave = theGame.AddComponent<Wave>(); //add new wave script
		theVisorRechargeScript = theVisor.GetComponent<Recharge>(); //visor recharge script
        theVisorGazeMoveScript = theVisor.GetComponent<GazeMove>(); //visor gazemove script

        //init tutorial wave
        //a single target that must be destroyed to advance
        theWave = theWave.waveWithPrefabParentLimits(target_00, theTargets, 1, 1, 0);

        //update score
        ScoreManager.Instance.resetScore();
        
        UnityEngine.Debug.Log("[GameManager] Starting the game!");

        //transition into scene via state manager
        if (StateManager.Instance != null) {
            TransitionFade theTransition = StateManager.Instance.gameObject.GetComponent<TransitionFade>();
            theTransition.toggleFade();
        }

        //audio
        if (AudioManager.Instance != null) {
            AudioManager.Instance.toggleFade();
        }

	}  //end function
开发者ID:Ar2rZ,项目名称:tetbeams,代码行数:47,代码来源:GameManager.cs

示例2: checkGameState

	}  //end function
    
    //check the game state and update as needed
    //used to manage levels, waves, and other content experienced during gameplay
    public void checkGameState() {
        //check whether the current wave has ended
        //if so, setup a new wave
        //otherwise continue with current wave
        if (theWave.isEnded == true) {
            //fade out and destroy tutorial object
            if (theTutorial != null) {
                Destroy(theTutorial);
            }
            //increment the current level
            currentLevel++;
            Debug.Log("[GameManager] Wave starting for level: " + currentLevel);
            //1, 2, 4, 8, 10, 9, 9, 6, 1
            //set up a new wave based on the current level
            switch (currentLevel) {
                //note: level 0 tutorial already init in start function
                //level 1: introduce random destination, two targets
                case 1:
					//one wave of two slow targets that move to a random destination and stop
					theWave = theWave.waveWithPrefabParentLimits(target_01, theTargets, 2, 2, 0);
                    break;
                //level 2: introduce random destination loops, medium speed, two waves
                case 2:
                    //two waves of two medium speed targets that complete random destination loops
                    theWave = theWave.waveWithPrefabParentLimits(target_02, theTargets, 2, 4, 0);
                    break;
                //level 3: introduce destroy on completion of random loops, three waves
                case 3:
                    //three waves of two medium speed targets that complete 10 random destination loops
                    theWave = theWave.waveWithPrefabParentLimits(target_03, theTargets, 2, 8, 0);
                    break;
                //level 4: introduce origin loops, three targets
                case 4:
                    //10 medium speed targets (three at once) that loop between origin and random destination
                    theWave = theWave.waveWithPrefabParentLimits(target_04, theTargets, 3, 10, 0);
                    break;
                //level 5: introduce destroy on completion of 11 origin loops
                case 5:
					//three waves of three medium speed targets that complete 11 random destination to origin loops
                    theWave = theWave.waveWithPrefabParentLimits(target_05, theTargets, 3, 9, 0);
                    break;
				//level 6: introduce fast speed, reduce loops
                case 6:
                    //three waves of three fast targets that complete 9 random destination to origin loops
                    theWave = theWave.waveWithPrefabParentLimits(target_06, theTargets, 3, 9, 0);
                    break;
				//level 7: reduce waves, reduce loops
                case 7:
					//two waves of three fast targets that complete 7 random destination to origin loops
                    theWave = theWave.waveWithPrefabParentLimits(target_07, theTargets, 3, 6, 0);
                    break;
				//level 8: introduce most difficult speed, one shot target
                case 8:
					//an extremely fast target that makes a single random destination to origin loop
                    theWave = theWave.waveWithPrefabParentLimits(target_08, theTargets, 1, 1, 0);
                    break;
				//game complete
                case 9:
					//game complete
					Debug.Log("All waves completed - Game Over");
                    //toggle flag
                    isGameOver = true;
                    //update score
                    ScoreManager.Instance.totalObjects = 50; //50 targets in demo
                    ScoreManager.Instance.levelScore();
                    break;
                //default
                default:
                    Debug.Log("[GameManager] Error: level not found");
                    break;
            } //end switch

            //reset wave if game is not over
            if (isGameOver == false) {
                theWave.resetWave();
            }
            //end game
            else if (isGameOver == true) {
                Debug.Log("[GameManager] Game Over - End Game");
                //load level summary
                //transition to next scene
                TransitionFade theTransition = StateManager.Instance.gameObject.GetComponent<TransitionFade>();
                theTransition.toggleFade();
                StateManager.Instance.switchSceneAfterDelay("summary", theTransition.duration);
                //audio
                AudioManager theAudioManager = AudioManager.Instance.gameObject.GetComponent<AudioManager>();
                theAudioManager.toggleFade();
                AudioManager.Instance.switchBgmAfterDelay(theAudioManager.bgmSummary, theAudioManager.bgmFadeDuration);
                //show mouse cursor
                Screen.showCursor = true;
            }

        } //end if

    } //end function
开发者ID:Ar2rZ,项目名称:tetbeams,代码行数:99,代码来源:GameManager.cs


注:本文中的Wave.waveWithPrefabParentLimits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。