public IEnumerator TestNextLevelLoadsNextLevel() { yield return(LoadScene("TestScene")); GameObject player = GameObject.FindGameObjectWithTag("Player"); EndLevel endPoint = StaticContext.Container.InstantiatePrefab(Resources.Load("EndPOint"), new Vector3(0, 0, 0), Quaternion.identity, null).GetComponent <EndLevel>(); endPoint.Action = EndLevel.EndLevelAction.NextLevel; endPoint.NextLevel = "Level1"; player.transform.position = new Vector3(-10, 0, 0); //Move towards trigger area for (float i = -10; i < 0 && player != null; i += 0.01f) { player.transform.position = new Vector3(i, 0, 0); yield return(null); } Assert.AreEqual(SceneManager.GetActiveScene().name, "Level1"); }
// Use this for initialization void Start() { explosions = GameObject.FindGameObjectsWithTag("Explosion"); GameObject.FindGameObjectWithTag("BackgroundTile").GetComponent <BackgroundTiles>().movementSpeedY = Random.Range(0.4f, 0.7f); pointsTextObj = GameObject.Find("PointsText"); healthTextObj = GameObject.Find("HealthText"); gameOverTextObj = GameObject.Find("GameOver"); controlTextObj = GameObject.Find("ControlsText"); finisheLevelTextObj = GameObject.Find("FinisheLevel"); startMenuObj = GameObject.Find("StartMenu"); continueButton = GameObject.Find("ContinueButton").GetComponent <Button>(); p1 = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); levelBar = GameObject.FindGameObjectWithTag("EndLevel").GetComponent <EndLevel>(); gameOverTextObj.SetActive(false); finisheLevelTextObj.SetActive(false); continueButton.gameObject.SetActive(false); startMenuObj.SetActive(false); init = true; isPaused = false; StartCoroutine(turnOffContol(controlDisplayTimer)); ImmortalGameManager.LoadGameLevel(); }
public IEnumerator TestGameFinishedDisplaysEndText() { yield return(LoadScene("TestScene")); GameObject player = GameObject.FindGameObjectWithTag("Player"); EndLevel endPoint = StaticContext.Container.InstantiatePrefab(Resources.Load("EndPOint"), new Vector3(0, 0, 0), Quaternion.identity, null).GetComponent <EndLevel>(); endPoint.Action = EndLevel.EndLevelAction.GameFinished; player.transform.position = new Vector3(-10, 0, 0); yield return(new WaitForSeconds(3)); textDisplayer.DidNotReceive().ShowText(Arg.Any <string>()); //Move towards trigger area for (float i = -10; i < 0; i += 0.01f) { player.transform.position = new Vector3(i, 0, 0); yield return(null); } textDisplayer.Received().ShowText(Arg.Any <string>()); }
//check the stress for loss public static void checkStress() { if (stress.getStat() >= 100) { EndLevel.end(false, "stress"); } }
// Update is called once per frame void Update() { _endLevel = GameObject.Find("EndLevel").GetComponent <EndLevel>(); _target = GameObject.FindGameObjectWithTag("Player"); if (_health > 0 && _target != null) { if ((Mathf.Abs(_target.transform.position.x - transform.position.x) > 1.5f) || (Mathf.Abs(_target.transform.position.y - transform.position.y) > 1f)) { if (!_isRangedEnemy || (_isRangedEnemy && _isMelleeEnemy)) { moveTowardsPlayer(); } else { moveParalelToPlayer(); } } atack(); } if (_endLevel.clear) { Destroy(gameObject); } }
// Use this for initialization void Start() { if (tag == "turtle") //this will be removed later it is just here for testing purposes as the other animals don't have animators { anim = GetComponent <Animator>(); } if (!editormode) { Time.timeScale = 1.0f; } Gamepaused = false; redhb = (GameObject)Instantiate(HPHealth, transform.position, Quaternion.identity); greenhb = (GameObject)Instantiate(greenHPHealth, transform.position, Quaternion.identity); GameObject endobject = GameObject.FindGameObjectWithTag("end"); EndLevel setachievescript = (EndLevel)endobject.gameObject.GetComponent(typeof(EndLevel)); activecam = (Camera)GameObject.FindGameObjectWithTag("MainCamera").GetComponent(typeof(Camera)); // if(tag=="parasite"&&!editormode) // { // GameObject cameraview= transform.GetChild(0).gameObject; // cameraview.SetActive(true); // } /*if(!setachievescript.BonusLevel) * { * completeachieve=setachievescript.getcomplete(Application.loadedLevel-levelminus); * allliveachieve=setachievescript.getalive(Application.loadedLevel-levelminus); * alldeadachieve=setachievescript.getdead(Application.loadedLevel-levelminus); * allbaconachieve=setachievescript.getbacon(Application.loadedLevel-levelminus); * timeachieve=setachievescript.gettime(Application.loadedLevel-levelminus); * }*/ }
public void playerSelected(GameObject _player) { _endLevel = GameObject.Find("EndLevel").GetComponent <EndLevel>(); _endLevel.endLevel = false; _Canvas.GetComponent <UiManager>()._playerSelected = _player; _Canvas.GetComponent <UiManager>().chooseMap(); }
private void Start() { if (instance == null) { instance = this; } numberStars = AllStars.transform.childCount; }
//ends game at 100 stress public static void stressEnd() { if (stress.getStat() >= 100) //it shouldn't ever be greater than 100 but { EndLevel.end(false, "stress"); stress.sakshiIsAFool(0); } }
// Use this for initialization void Start() { endLevel = endLevelObject.GetComponent <EndLevel> (); if (ES2.Exists(saveKeyString)) { currentBestTime = ES2.Load <float>(saveKeyString); } }
public BoardLine(Size i_CustomSize, Color i_Color, int i_Space, EndLevel i_OnEnd) { m_BaseSize = i_CustomSize; m_DefaultColor = i_Color; r_Space = i_Space; r_OnEnd = i_OnEnd; initializeComponent(); m_ColorSelection = new FormColorSelection(m_BaseSize, r_Space); }
void Start() { coll = GetComponent <Collision>(); rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); lvlManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <LevelManager>(); timeRifts = new GameObject[lvlManager.timeRiftLimits]; endLevelScript = GameObject.FindGameObjectWithTag("EndLevel").GetComponent <EndLevel>(); }
void Update() { //has animation gone hwAnimate(); if (homeworkDone() && !ended) { EndLevel.end(true); ended = true; } }
void Awake() { endScript = gameObject.GetComponent <EndLevel>(); endUI = GameObject.Find("LevelEndUI").GetComponent <Canvas>(); finalScore = GameObject.Find("Final Score").GetComponent <Text>(); timeRemaining = GameObject.Find("txtTimeRemaining").GetComponent <Text>(); endScript.endUI = endUI; endScript.finalScore = finalScore; endScript.timeToFinish = timeRemaining; }
// Start is called before the first frame update void Start() { _health = _maxHealt; _initialColor = GetComponent <SpriteRenderer>().color; _playerHealthBar = GameObject.Find("Canvas").GetComponent <UiManager>(); _endLevel = GameObject.Find("EndLevel").GetComponent <EndLevel>(); _playerHealthBar.setHealth(_maxHealt); _maxUp = GameObject.FindGameObjectWithTag("MaxUp").transform.position.y; _maxDown = GameObject.FindGameObjectWithTag("MaxDown").transform.position.y; _maxLeft = GameObject.FindGameObjectWithTag("MaxLeft").transform.position.x; _maxRight = GameObject.FindGameObjectWithTag("MaxRight").transform.position.x; }
public void NextDay() //NEXT DAY { day++; Debug.Log("Day: " + day); setDayStats(); //ADD IN STRESS DECREASE FROM SLEEP HERE if (day > 5) { EndLevel.win(); } SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
void Awake() { // Setting up the references. anim = GetComponent<Animator>(); playerMovement = GetComponent<PlayerMovement>(); flash = GameObject.Find ("Main Camera").GetComponent<GlowEffect> (); GameObject tmp = GameObject.Find ("EndLevel"); if (tmp != null) endLevel = tmp.GetComponent<EndLevel>(); GameObject gameController = GameObject.Find ("gameController"); if (gameController != null) lastPlayerSighting = gameController.GetComponent<LastPlayerSighting>(); }
// Start is called before the first frame update void Start() { if (_bounds.Length > 0) { _maxUp = _bounds[0].transform.position.y; _maxDown = _bounds[1].transform.position.y; _maxLeft = _bounds[2].transform.position.x; _maxRight = _bounds[3].transform.position.x; float initY = Random.Range(_maxDown, _maxUp); float initX = Random.Range(_maxLeft, _maxRight); transform.position = new Vector3(initX, initY, 0); } _endLevel = GameObject.Find("EndLevel").GetComponent <EndLevel>(); StartCoroutine(lifeSapan()); }
public IEnumerator TestOtherObjectsDontActivate() { yield return(LoadScene("TestScene")); EndLevel endPoint = StaticContext.Container.InstantiatePrefab(Resources.Load("EndPOint"), new Vector3(0, 0, 0), Quaternion.identity, null).GetComponent <EndLevel>(); endPoint.Action = EndLevel.EndLevelAction.GameFinished; var npc = StaticContext.Container.InstantiatePrefab(Resources.Load("NPC"), new Vector3(-100, 0, 0), Quaternion.identity, null); yield return(null); textDisplayer.DidNotReceive().ShowText(Arg.Any <string>()); }
public void OnTriggerEnter2D(Collider2D collision) //That function checking collisions with Player { endLevel = collision.GetComponent <EndLevel>(); //setting variable collision if (endLevel != null) //Checking collision witch object who has script endLevel { endLevel.Completed(); //Calling function Completed from endLevel script } gameManager = collision.GetComponent <GameManager>(); if (gameManager != null) { Hidden1.gameObject.SetActive(false); Hidden2.gameObject.SetActive(false); Hidden3.gameObject.SetActive(true); } else { Hidden1.gameObject.SetActive(true); } }
public static void LoadGameLevel() { SetCamMode(-20); GameObject spawnPoint = GameObject.FindGameObjectWithTag("EnemySpawnPoint"); if (GM.cockPitModeOn) { spawnPoint.transform.position = new Vector3(spawnPoint.transform.position.x, spawnPoint.transform.position.y, spawnPoint.transform.position.z + 80); } EndLevel finishLine = GameObject.FindGameObjectWithTag("EndLevel").GetComponent <EndLevel>(); GameObject lastObject = null; for (int i = 0; i < levelInfo.numOfWaves; i++) { SpawnInfo info = levelSpawner.SpawnObject(); GameObject enemySpawn = info.obj; int numOfEnemies = Random.Range(info.minSpawnAmmount, info.maxSpawnAmmount); for (int j = 0; j < numOfEnemies; j++) { GameObject enemy = Instantiate(enemySpawn); float ranXPos = Random.Range(p1Copy.xNegConstraint + 30, p1Copy.xPosConstraint - 30); float ranZPos = Random.Range(p1Copy.zNegConstraint + 40, p1Copy.zPosConstraint - 40); //float ranZPos = Random.Range(0, 0); enemy.transform.position = new Vector3(spawnPoint.transform.position.x + ranXPos, spawnPoint.transform.position.y, (spawnPoint.transform.position.z + ranZPos) + (i * 45)); Enemy enemyScript = enemy.GetComponent <Enemy>(); enemyScript.level = Random.Range(levelInfo.minEnemyLvl, levelInfo.maxEnemyLvl); enemyScript.Init(); if ((i == levelInfo.numOfWaves - 1) && (j == numOfEnemies - 1)) { lastObject = enemy; } } } finishLine.lastEnemy = lastObject; }
// Use this for initialization void Awake() { endlvl = levelUpMenu.GetComponent <EndLevel>(); currentLight = null; latestLight = null; justVisited = null; targetLight = null; anim = GetComponent <Animator>(); nav = GetComponent <NavMeshAgent>(); travellerHealth = GetComponent <travellerHealth>(); lamps = GameObject.FindGameObjectsWithTag("LampLight"); closeToExit = false; isScared = false; startingPointTransform = new Vector3(startingPoint.transform.position.x, startingPoint.transform.position.y, startingPoint.transform.position.z); movingBack = false; defaultSpeed = nav.speed; fastSpeed = defaultSpeed * 1.5f; }
void Start() { if (player == null) { player = GameObject.FindWithTag("Player"); } if (camera == null) { camera = GameObject.FindWithTag("MainCamera"); } if (endTrigger == null) { endTrigger = GameObject.FindWithTag("Finish"); } playerStart = playerPos; cameraStart = cameraPos; endLevel = endTrigger.GetComponent <EndLevel>(); characterControl = player.GetComponent <CharacterControl>(); }
void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("End Level")) { print("End Level"); EndLevel endLevel = col.gameObject.GetComponent <EndLevel> (); endLevel.PlaySound(); DoGameOver(); } if (col.CompareTag("Bolt")) { Collectable collectable = col.GetComponent <Collectable> (); // collectable.CollectItem (); bolts++; } if (col.CompareTag("InsideCastle")) { //gameOverScreen.UpdateGameOver (bolts, timeTaken, alter1.activated, alter2.activated, alter3.activated); } }
void OnTriggerEnter(Collider hit) { if (gameObject.tag != "parasite" && hit.gameObject.tag == "switch" && !editormode)//hit.gameObject.tag == "switch1" && { int matchnumber; Switch switchscript = (Switch)hit.gameObject.GetComponent(typeof(Switch)); matchnumber = switchscript.switchnumber; GameObject[] doors; doors = GameObject.FindGameObjectsWithTag("door"); foreach (GameObject door in doors) { DoorMove doorscript = (DoorMove)door.GetComponent(typeof(DoorMove)); if (matchnumber == doorscript.numberofdoor) { doorscript.open = true; } } } if (hit.gameObject.tag == "water" || hit.gameObject.tag == "DeepWater" || hit.gameObject.tag == "turtlewater" && !editormode) { if (gameObject.tag == "bird") { health = 0; } else if (gameObject.tag != "bear") { swim = true; // if(gameObject.tag=="turtle") // { // anim.SetBool(swimhash, true); // } } else if (tag == "bear" && !activecharacter) { health = 0; } } if (hit.gameObject.tag == "Spike") { health -= (1 * (int)Time.timeScale); } if (hit.gameObject.tag == "Bacon" && !editormode) { if (tag == "parasite") { health -= 10; Destroy(hit.gameObject); } else { health += 10; if (health > maxhealth) { health = maxhealth; } Destroy(hit.gameObject); } GameObject.Find("AudioCube").SendMessage("Chime"); } // if(hit.gameObject.tag=="ExtraBacon") // { // if(tag=="parasite") // { // health-=10; // Destroy(hit.gameObject); // } // else // { // health+=10; // if(health>maxhealth) // health=maxhealth; // Destroy(hit.gameObject); // } // } if (hit.gameObject.tag == "end" && activecharacter && !editormode) { //Debug.Log(editormode.ToString()); EndLevel endscript = (EndLevel)hit.gameObject.GetComponent(typeof(EndLevel)); // if(!endscript.BonusLevel) achievement area needs work<<<<<<<<<<<<<<<<<<<<<<<<<================================================= // { // if(Time.timeSinceLevelLoad<endscript.TimetoBeat && !endscript.gettime(Application.loadedLevel-levelminus)) // { // endscript.settime(Application.loadedLevel-levelminus, true); // } // if(!endscript.getcomplete(Application.loadedLevel-levelminus)) // { // endscript.setcomplete(Application.loadedLevel-levelminus, true); // } // if(!endscript.getalive(Application.loadedLevel-levelminus)) // { // bool allalive=true; // int num=0; // while (allalive&&num<=2) // { // GameObject animal=null; // animal = GameObject.FindGameObjectWithTag(animallist[num]); // //Debug.Log(animal.ToString()); // if(animal==null) // allalive=false; // num++; // } // //Debug.Log(allalive.ToString()); // if(allalive) // { // endscript.setalive(Application.loadedLevel-levelminus, true); // //Debug.Log(endscript.getalive(Application.loadedLevel-levelminus).ToString()); // } // } // if(!endscript.getdead(Application.loadedLevel-levelminus)) // { // bool allalivez=false; // int num=0; // while (!allalivez&&num<=2) // { // GameObject animalz=null; // animalz = GameObject.FindGameObjectWithTag(animallist[num]); // //Debug.Log(animalz.ToString()); // if(animalz!=null) // allalivez=true; // num++; // } // if(!allalivez) // { // endscript.setdead(Application.loadedLevel-levelminus, true); // } // } // if(!endscript.getbacon(Application.loadedLevel-levelminus)) // { // GameObject bacon=null; // bacon = GameObject.FindGameObjectWithTag("Bacon"); // if(bacon==null) // endscript.setbacon(Application.loadedLevel-levelminus, true); // } // } // else // { // if(Time.timeSinceLevelLoad<endscript.TimetoBeat && !endscript.getBonustime(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels)) // { // endscript.setBonustime(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels, true); // } // if(!endscript.getBonuscomplete(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels)) // { // endscript.setBonuscomplete(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels, true); // } // if(!endscript.getBonusalive(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels)) // { // bool allalive=true; // int num=0; // while (allalive&&num<=2) // { // GameObject animal=null; // animal = GameObject.FindGameObjectWithTag(animallist[num]); // //Debug.Log(animal.ToString()); // if(animal==null) // allalive=false; // num++; // } // //Debug.Log(allalive.ToString()); // if(allalive) // { // endscript.setBonusalive(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels, true); // //Debug.Log(endscript.getalive(Application.loadedLevel-levelminus).ToString()); // } // } // if(!endscript.getBonusdead(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels)) // { // bool allalivez=false; // int num=0; // while (!allalivez&&num<=2) // { // GameObject animalz=null; // animalz = GameObject.FindGameObjectWithTag(animallist[num]); // //Debug.Log(animalz.ToString()); // if(animalz!=null) // allalivez=true; // num++; // } // if(!allalivez) // { // endscript.setBonusdead(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels, true); // } // } // if(!endscript.getBonusbacon(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels)) // { // GameObject bacon=null; // bacon = GameObject.FindGameObjectWithTag("Bacon"); // if(bacon==null) // endscript.setBonusbacon(Application.loadedLevel-levelminus-endscript.numofnonbonuslevels, true); // } // } if (endscript.UserCreatedLevel) { Application.LoadLevel(0); } else if (endscript.LastLevel) { Application.LoadLevel(endscript.NextIndex); } else { int level = Application.loadedLevel; level++; Application.LoadLevel(level); } } }
void Awake() { end = this; }
void Update() { if (wxml.progress >= 1 && !downloadedlevel) { Debug.Log(gamelist[0].typevar.ToString()); downloadedlevel = true; StopCoroutine("LoadLevel"); foreach (GameType obj in gamelist) { Vector3 spawnposition = Vector3.zero; typeofobj = obj.typevar; if (typeofobj == "Wall") { target = GameObject.CreatePrimitive(PrimitiveType.Cube); } else if (typeofobj == "Turtle" || typeofobj == "Bird") { Quaternion spawn = Quaternion.Euler(0, 90, 0); target = (GameObject)Instantiate(Resources.Load(typeofobj), spawnposition, spawn); } else { target = (GameObject)Instantiate(Resources.Load(obj.typevar), spawnposition, Quaternion.identity); } target.transform.position = obj.positionvar; target.transform.localScale = obj.scalevar; target.name = obj.namevar; if (typeofobj == "Switch") { int switchnum = (int)obj.number1var; Switch switchscript = (Switch)target.GetComponent(typeof(Switch)); switchscript.switchnumber = switchnum; } else if (typeofobj == "Door") { int doornum = (int)obj.number1var; int howfardoor = (int)obj.number2var; DoorMove doorscript = (DoorMove)target.GetComponent(typeof(DoorMove)); doorscript.Vertical = obj.boolean1var; doorscript.positive = obj.boolean2var; doorscript.destroydoor = obj.boolean3var; doorscript.holddoor = obj.boolean4var; doorscript.numberofdoor = doornum; doorscript.howfar = howfardoor; } else if (typeofobj == "Gun") { float timebetween = obj.number1var; float timedelaystart = obj.number2var; float bulletspeed = obj.number3var; Gunscript cannon = (Gunscript)target.GetComponent(typeof(Gunscript)); cannon.timetowait = timebetween; cannon.startDelay = timedelaystart; cannon.bulletspeed = bulletspeed; cannon.shootvertical = obj.boolean1var; cannon.shootpositive = obj.boolean2var; cannon.posion = obj.boolean3var; cannon.water = obj.boolean4var; } else if (typeofobj == "EndFlag") { int timetobeat = (int)obj.number1var; EndLevel end = (EndLevel)target.GetComponent(typeof(EndLevel)); end.BonusLevel = obj.boolean1var; end.UserCreatedLevel = obj.boolean2var; end.LastLevel = obj.boolean3var; end.TimetoBeat = timetobeat; } else if (typeofobj == "Water") { Debug.Log("Y Scale: " + target.transform.localScale.y.ToString()); if (target.transform.localScale.y > 1) { Debug.Log("it should spawn stuff here"); Water wet = (Water)target.GetComponent(typeof(Water)); wet.mainwater = target.gameObject; GameObject turtlewater = (GameObject)Instantiate(Resources.Load("TurtleWater"), spawnposition, Quaternion.identity); Vector3 scale = new Vector3(target.transform.position.x, target.transform.position.y + ((target.transform.localScale.y / 2) - 0.5f), target.transform.position.z); turtlewater.transform.position = scale; scale = new Vector3(target.transform.localScale.x, 1, target.transform.localScale.z * 0.95f); turtlewater.transform.localScale = scale; wet.turtlewater = turtlewater; GameObject deepwater = (GameObject)Instantiate(Resources.Load("DeepWater"), spawnposition, Quaternion.identity); scale = new Vector3(target.transform.position.x, target.transform.position.y - 0.5f, target.transform.position.z); deepwater.transform.position = scale; scale = new Vector3(target.transform.localScale.x, target.transform.localScale.y - 1, target.transform.localScale.z * 0.95f); deepwater.transform.localScale = scale; wet.deepwater = deepwater; } } } Debug.Log("Load Completed"); editormode = false; } }
void Awake() { endLevelScript = GameObject.Find("GoalStatusMonitor").GetComponent <EndLevel>(); }
void Start() { endLevel = GameObject.Find("EventSystem").GetComponent <EndLevel>(); spriteMover = gameObject.GetComponent <SpriteMover>(); rayCaster = gameObject.GetComponent <RayCastTrigger>(); }
void Awake() { endLevel = GameObject.Find ("EndLevel").GetComponent<EndLevel>(); ended = false; scoreTime = GameObject.Find ("ScoreTime"); }
void Start() { rayCaster = gameObject.GetComponent <RayCastTrigger>(); wildBehaviour = GameObject.Find("EventSystem").GetComponent <WildBehaviour>(); endLevel = GameObject.Find("EventSystem").GetComponent <EndLevel>(); }