// Use this for initialization void Start() { /*hasSpawn = false; GetComponent<Collider2D>().enabled = false; // 2 - Check if the enemy has spawned. if (hasSpawn == false) { if (GetComponent<Renderer> ().IsVisibleFrom (Camera.main)) { Spawn (); } } else { // 4 - Out of the camera ? Destroy the game object. if (GetComponent<Renderer>().IsVisibleFrom(Camera.main) == false) { Destroy(gameObject); } } */ GameObject player = GameObject.Find ("Player"); player1 = (PlayerController2)player.GetComponent (typeof(PlayerController2)); //GameObject parent = player.transform.parent.gameObject.transform.position.x; //player1 = (PlayerController2)GameObject.Find ("Player"); //player x = transform.Find("Player").GetComponent. //Debug.Log ("Player X: " + playerx + " Player Y: " + playery); //Debug.Log ("Transform parent x: " + player.transform.parent.gameObject.transform.position.x + " Tranform parent y: " + player.transform.parent.gameObject.transform.position.y); }
void OnTriggerExit2D(Collider2D collider) { player = collider.gameObject.GetComponent<PlayerController2>(); if(player != null) { showText = false; } }
// Use this for initialization void Start() { player2 = FindObjectOfType<PlayerController2>(); bulletBar.gameObject.SetActive(true); bulletBar.value = 0; //bulletBarOn = false; }
private void Start() { audioController = FindObjectOfType(typeof(AudioController)) as AudioController; playerController2 = FindObjectOfType(typeof(PlayerController2)) as PlayerController2; levelLoader = FindObjectOfType(typeof(LevelLoader)) as LevelLoader; music = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioSource>(); sfx = GameObject.FindGameObjectWithTag("SFX").GetComponent <AudioSource>(); lastRecord = PlayerPrefs.GetInt("Record"); if (SceneManager.GetActiveScene().buildIndex == 1) { int musicAnim = PlayerPrefs.GetInt("MusicAnim"); if (musicAnim == 1) { music.mute = true; musicButton.SetBool("Muted", true); } else { music.mute = false; musicButton.SetBool("Muted", false); } int sfxAnim = PlayerPrefs.GetInt("SfxAnim"); if (sfxAnim == 1) { sfx.mute = true; sfxButton.SetBool("Muted", true); } else { sfx.mute = false; sfxButton.SetBool("Muted", false); } } else if (SceneManager.GetActiveScene().buildIndex == 3) { audioController.musicSource.Pause(); audioController.playSfx(audioController.sfxLose, 0.8f); Cursor.visible = true; kills = PlayerPrefs.GetInt("Kills"); newRecord = PlayerPrefs.GetInt("NewRecord"); if (newRecord == 1) { killsText.text = "KILLS:" + kills; newRecordText.gameObject.SetActive(true); recordText.text = "RECORD:" + kills; } else { recordText.text = "RECORD:" + lastRecord; killsText.text = "KILLS:" + kills; } } }
public int DividendTotal(PlayerController2 player) { int dividendTotal = 0; for (int i = 0; i < 3; i++) { dividendTotal += (int)(stockOptions[i].DividendAmount() * player.GetStocks(i)); } return(dividendTotal); }
void Update() { PlayerController2 player = GameManager2.Instance.GetCurrentPlayer(); List <StockController> stocks = GameManager2.Instance.stockOptions; for (int i = 0; i < 3; i++) { quantityTexts[i].SetText(player.GetStocks(i).ToString()); priceTexts[i].SetText("$" + stocks[i].price.ToString()); } }
private void OnTriggerStay(Collider other) { if (yoshi == null) { PlayerController2 controller = other.GetComponent <PlayerController2>(); if (controller != null && (!controller.IsDizzy)) { yoshi = controller.gameObject; } } }
protected override IEnumerator UseItem(PlayerController2 player) { source.volume = 0.7F; source.clip = clip; source.PlayOneShot(clip); ray.gameObject.SetActive(true); yield return(new WaitForSeconds(0.2f)); ray.gameObject.SetActive(false); }
private IEnumerator slowdown(PlayerController2 script) { int offset = -1; float old_speed = script.getSpeed(); script.setSpeed(old_speed + offset); yield return(new WaitForSeconds(duration)); script.setSpeed(old_speed - offset); }
public int TotalStockValue(PlayerController2 player) { int stockValue = 0; for (int i = 0; i < 3; i++) { stockValue += player.GetStocks(i) * stockOptions[i].price; } return(stockValue); }
//GUARDAR LOS DATOS DEL PLAYER public static void SavePlayerData(PlayerController2 player, Inventory2 inventory, PlayerAttack plAttack) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/playerdata.info"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player, inventory, plAttack); formatter.Serialize(stream, data); stream.Close(); }
void OnTriggerEnter2D(Collider2D other) { Debug.Log(other); PlayerController2 l1Boss = other.GetComponent <PlayerController2>(); // Do something // Destroy(gameObject); if (l1Boss != null) { } }
void Start() { patrol = GetComponent <Patrol2>(); animator = GetComponent <Animator>(); target = PlayerManager.instance.player.transform; agent = GetComponent <NavMeshAgent>(); combat = GetComponent <CharacterCombat>(); hidingEye = GameObject.Find("HidingEye").GetComponent <Image>(); playerController = GameObject.Find("unicorn").GetComponent <PlayerController2>(); targetStats = target.GetComponent <CharacterStats>(); patrol2 = GetComponentsInChildren <Patrol2>(); }
private IEnumerator dashcooldown(PlayerController2 script) { int offset = 2; float old_dashcooldown = script.getDashCooldown(); script.setDashCooldown(old_dashcooldown / offset); yield return(new WaitForSeconds(duration)); script.setDashCooldown(old_dashcooldown); Destroy(this); StopCoroutine("dashcooldown"); }
private void OnTriggerExit(Collider other) { PlayerController2 controller = other.GetComponent <PlayerController2>(); if (controller != null) { if (controller.gameObject == yoshi) { yoshi = null; } } }
/* * initialize variables, subscribe OnAttack to CharacterCombat delegate * */ protected virtual void Start() { stats = Player.instance.playerStats; stats.OnDeath += OnDeath; //animator = GetComponent<Animator>(); ac = GetComponentInChildren <PlayerController2>(); navmeshAgent = GetComponent <NavMeshAgent> (); combat = GetComponent <CharacterCombat> (); combat.OnAttack += OnAttack; //destructable = GetComponent<Destructable>(); //destructable.OnAttack += OnAttack; }
private IEnumerator rapidfire(PlayerController2 script) { float offset = -0.4f; float old_firerate = script.getShootingCooldown(); script.setShootingCoolDown(old_firerate + offset); yield return(new WaitForSeconds(duration)); script.setShootingCoolDown(old_firerate - offset); Destroy(this); StopCoroutine("rapidfire"); }
private void OnTriggerEnter(Collider other) { PlayerController2 playerController = other.GetComponent <PlayerController2>(); if (playerController != null && playerController.IsWithMario && !_isEnded && (playerController.NestPosition.x == transform.position.x) && (playerController.NestPosition.z == transform.position.z)) { _isEnded = true; CmdMoveCamera(playerController.netId); CmdRestart(playerController.playerName, playerController.isLocalPlayer); } }
private IEnumerator starpower(PlayerController2 script) { foreach (Collider2D hitbox in script.GetComponents <Collider2D>()) { hitbox.enabled = false; } yield return(new WaitForSeconds(duration)); foreach (Collider2D hitbox in script.GetComponents <Collider2D>()) { hitbox.enabled = true; } }
// Start is called before the first frame update void Start() { Player_1 = GameObject.Find("Player_1"); Player_2 = GameObject.Find("Player_2"); Player_3 = GameObject.Find("Player_3"); Player_4 = GameObject.Find("Player_4"); script_1 = Player_1.GetComponent <PlayerController2>(); script_2 = Player_2.GetComponent <PlayerController2>(); script_3 = Player_3.GetComponent <PlayerController2>(); script_4 = Player_4.GetComponent <PlayerController2>(); isPlaying = true; }
private void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController2>(); mat = GetComponent <SpriteRenderer>().material; col = GetComponent <Collider2D>(); sound = GetComponent <AudioSource>(); canvasObject.SetActive(false); alreadyPicked = ScenesManager.scenesManager.HeartsPickUp[numberOfHeart]; if (alreadyPicked) { Destroy(gameObject); } }
void Start() { pcont = GameObject.Find("unicorn").GetComponent <PlayerController2>(); myStats = GetComponent <EnemyStats>(); patrol = GetComponent <Patrol2>(); momDino = GetComponentInParent <EnemyController>(); animator = GetComponent <Animator>(); target = PlayerManager.instance.player.transform; agent = GetComponent <NavMeshAgent>(); combat = GetComponent <CharacterCombat>(); redEye = GetComponent <RedEye>(); //babyDino = GetComponent<EnemyController>(); targetStats = target.GetComponent <CharacterStats>(); }
// Use this for initialization void Start() { if (firedFromPlayer1) { player = FindObjectOfType<PlayerController> (); firedFromWhere = player.facingDirection; //0 left 1 right playerPosition = player.transform; if(player.transform.localScale.x < 0 && !player.facingUp && !player.facingDown){ //player is facing left so the object should fire left & player is not facing up or down speed = -speed; directionWhenFired = 1; } else if(player.transform.localScale.x > 0 && !player.facingUp && !player.facingDown){ directionWhenFired = 1; } else if(player.facingDown){ speed = -speed; directionWhenFired = 2; } else if(player.facingUp){ directionWhenFired = 2; } } else { player2 = FindObjectOfType<PlayerController2> (); firedFromWhere = player2.facingDirection; //0 left 1 right playerPosition = player2.transform; if(player2.transform.localScale.x < 0 && !player2.facingUp && !player2.facingDown){ //player is facing left so the object should fire left & player is not facing up or down speed = -speed; directionWhenFired = 1; } else if(player2.transform.localScale.x > 0 && !player2.facingUp && !player2.facingDown){ directionWhenFired = 1; } else if(player2.facingDown){ speed = -speed; directionWhenFired = 2; } else if(player2.facingUp){ directionWhenFired = 2; } } audioSources = GetComponents<AudioSource>(); sniperDestroy = audioSources[1]; }
public void InitialClassPopup() { PlayerController2 player = GetPlayer(turnNum); player.SetClass(ChooseRandom(classChances)); popup.SetButtonNum(1); popup.title.SetText("You are: \n" + player.namedClass() + " Class"); popup.buttons[0].textBox.SetText("Collect Inheritance"); popup.buttons[0].SetListener(InheritancePopup); OpenPopup(); }
protected override IEnumerator UseItem(PlayerController2 player) { source.volume = 0.7F; source.clip = clip; source.PlayOneShot(clip); player.runSpeed *= 2f; GetComponentInChildren <ParticleSystem>().Play(); yield return(new WaitForSeconds(4)); player.runSpeed /= 2f; }
void Start() { navMeshAgent = GetComponent <NavMeshAgent>(); player = FindObjectOfType <PlayerController2>(); navMeshAgent.updateRotation = false; capsuleCollider = GetComponent <CapsuleCollider>(); animator = GetComponentInChildren <Animator>(); movementAnimator = GetComponent <MovementAnimator>(); enemyManager = FindObjectOfType <EnemyManager>(); enemy = GetComponent <Transform>(); EnemyManager.Instance.RegisterEnemy(this); //Регистрируем противников в листе }
void OnTriggerExit2D(Collider2D collision) { Debug.Log("leaves oli"); if (collision.name.Equals("player_1")) { playerController1 = GameObject.Find("player_1").GetComponent <PlayerController1>(); playerController1.is_slipping = false; } else { playerController2 = GameObject.Find("player_2").GetComponent <PlayerController2>(); playerController2.is_slipping = false; } }
void OnTriggerEnter2D(Collider2D other) { Debug.Log("enter oli"); if (other.name.Equals("player_1")) { playerController1 = GameObject.Find("player_1").GetComponent <PlayerController1>(); playerController1.is_slipping = true; } else { playerController2 = GameObject.Find("player_2").GetComponent <PlayerController2>(); playerController2.is_slipping = true; } }
protected override IEnumerator UseItem(PlayerController2 player) { GetComponentInChildren <ParticleSystem>().Play(); player.jumpHeight *= 5f; source.volume = 0.7F; source.clip = clip; source.PlayOneShot(clip); player.Jump(); yield return(new WaitForSeconds(2)); player.jumpHeight /= 5f; }
void Update() { if (currentSkills[0] != null && (Input.GetKeyDown(KeyCode.Y) || Input.GetKeyDown("joystick button 3"))) { callSkill(currentSkills[0]); } if (currentSkills[1] != null && (Input.GetKeyDown(KeyCode.B) || Input.GetKeyDown("joystick button 1"))) { callSkill(currentSkills[1]); } if (currentSkills[2] != null && (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown("joystick button 2"))) { callSkill(currentSkills[2]); } if (PlayerController2.instance != null) { player = PlayerController2.instance; } // set next skill for (int i = 0; i < currentSkills.Length; i++) { if (currentSkills[i] == null) { currentSkills[i] = getNextSkill(player.getAngryScore()); currentSkills[i].startedTime = Time.time; spawnNewSkillButton(currentSkills[i]); } } // check which skills are depleated for (int i = 0; i < currentSkills.Length; i++) { var skill = currentSkills[i]; if (skill.timeUntilDisappearSec * 0.5 < Time.time - skill.startedTime) { setSkillViewAge(skill); } if (skill.timeUntilDisappearSec < Time.time - skill.startedTime) { removeSkill(skill); removeSkillButton(skill); } } }
// Use this for initialization void Start() { if (UIFade.Instance == null) { UIFade.Instance = Instantiate(UIScreen).GetComponent <UIFade>(); } if (PlayerController2.Instance == null) { //when essential loader enters screen PlayerController2 clone = Instantiate(Player).GetComponent <PlayerController2>(); PlayerController2.Instance = clone; } }
// Use this for initialization void Start() { GameObject player = GameObject.Find ("Player"); if(player != null) player1 = (PlayerController2)player.GetComponent (typeof(PlayerController2)); //GameObject parent = player.transform.parent.gameObject.transform.position.x; //player1 = (PlayerController2)GameObject.Find ("Player"); //player x = transform.Find("Player").GetComponent. //playerx = player1.transform.position.x; //+ Mathf.Abs(player.transform.parent.gameObject.transform.position.x); //playery = player1.transform.position.y; if(player1 != null) direction = (player1.transform.position - this.transform.position).normalized; //Debug.Log (this.transform.position.z); //Debug.Log ("Player X: " + playerx + " Player Y: " + playery); //Debug.Log ("Transform parent x: " + player.transform.parent.gameObject.transform.position.x + " Tranform parent y: " + player.transform.parent.gameObject.transform.position.y); }
// Use this for initialization void Start() { playerController1 = GameObject.Find("player_1").GetComponent <PlayerController1>(); playerController2 = GameObject.Find("player_2").GetComponent <PlayerController2>(); trigger = GameObject.Find("finish_trigger").GetComponent <FinishTrigger>(); timer = gameObject.GetComponent <Timer>(); animator = GameObject.Find("win_message").GetComponent <Animator>(); audioData = GameObject.Find("win_message").GetComponent <AudioSource>(); backgroundMusic = GameObject.Find("MusicPlayer").GetComponent <AudioSource>(); sfx = GameObject.Find("MusicPlayer").GetComponent <AudioSource>(); player = 0; audioHasPlayed = false; backgroundMusic.Play(277830); }
void Awake() { //Debug.Log (this.tag != "Boss3"); if (this.tag != "Clone" && this.tag != "Boss3" && this.tag != "Boss2" && this.tag != "Boss1") { //Debug.Log(this.tag); animator = this.gameObject.GetComponent<Animator> (); animator.enabled = false; } // Retrieve the weapon only once weapons = GetComponentsInChildren<WeaponScript>(); GameObject player = GameObject.Find ("Player"); if(player != null) player1 = player.GetComponent<PlayerController2>(); // Retrieve scripts to disable when not spawn }
private void Awake() { if (instance == null) { instance = this; } else { if (instance != this) { Destroy(gameObject); } } DontDestroyOnLoad(gameObject); }
private void _return() { if (transform.parent) { PlayerController2 playerController = transform.parent.GetComponent <PlayerController2>(); if (playerController) { transform.parent = null; transform.GetComponent <Rigidbody>().isKinematic = false; playerController.IsWithMario = false; playerController.MarioInstance = null; transform.GetComponent <BoxCollider>().enabled = true; this.isWithYoshi = false; } } }
// Use this for initialization void Start() { player = GameObject.Find ("Player"); if(player != null) player1 = (PlayerController2)player.GetComponent (typeof(PlayerController2)); if(player1 != null) direction = (player1.transform.position - this.transform.position).normalized; if (direction != Vector2.zero) { float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; angle += 90; transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); } }
// Use this for initialization void Start() { //rb = GetComponent<Rigidbody2D>(); GameObject player = GameObject.Find ("Player"); if(player != null) player1 = (PlayerController2)player.GetComponent (typeof(PlayerController2)); animator = this.GetComponent<Animator>(); //GameObject parent = player.transform.parent.gameObject.transform.position.x; //player1 = (PlayerController2)GameObject.Find ("Player"); //player x = transform.Find("Player").GetComponent. //Debug.Log ("Player X: " + playerx + " Player Y: " + playery); //Debug.Log ("Transform parent x: " + player.transform.parent.gameObject.transform.position.x + " Tranform parent y: " + player.transform.parent.gameObject.transform.position.y); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); script = player.GetComponent<PlayerController2>(); rotateZ = 1.0f; }
void ScoreUP(Collider collider) { script = collider.GetComponent<PlayerController2>(); script.ScoreUP(); // script.SendMessage("ScoreUp"); }
void Awake() { playerController2 = GameObject.FindGameObjectWithTag("Player2").GetComponent<PlayerController2>(); }
// Update is called once per frame void Update() { enemyCount = FindObjectsOfType<EnemyController>();//checks how many enemies are on the screen at any given time switch(waveCount){ case 1: if(enemiesToSpawn[0] > 1 && Time.time > nextEnemySpawn){ //spawns in enemies nextEnemySpawn = Time.time + enemySpawnRate; CallSpawnEnemy(); } if(enemyCount.Length > 0){ hasWaveStarted = true; anEnemyHasSpawned = true; } if(enemyCount.Length < 1 && hasWaveStarted && !waveCompleted && anEnemyHasSpawned){ //end the wave - some graphic might want to pop up here - just enable then disable it from the EndWave function //Debug.Log("Wave Completed"); waveCompleted = true; CallEndWave (); //called once, as the last enemy dies } break; case 2: if(!hasWaveStarted){ CreateHazard(platform1); hasWaveStarted = true; } if(enemiesToSpawn[1] > 1 && Time.time > nextEnemySpawn ){ //spawns in enemies nextEnemySpawn = Time.time + enemySpawnRate; CallSpawnEnemy(); } if(enemyCount.Length > 0){ anEnemyHasSpawned = true; } if(enemyCount.Length < 1 && hasWaveStarted && !waveCompleted && anEnemyHasSpawned){ //end the wave //Debug.Log("Wave Completed"); waveCompleted = true; CallEndWave (); //called once, as the last enemy dies } break; case 3: if(!hasWaveStarted){ DestroyPlatform(platform2); hasWaveStarted = true; } if(enemiesToSpawn[2] > 1 && Time.time > nextEnemySpawn){ //spawns in enemies nextEnemySpawn = Time.time + enemySpawnRate; CallSpawnEnemy(); } if(enemyCount.Length > 0){ anEnemyHasSpawned = true; } if(enemyCount.Length < 1 && hasWaveStarted && !waveCompleted && anEnemyHasSpawned){ //end the wave //Debug.Log("Wave Completed"); waveCompleted = true; CallEndWave (); //called once, as the last enemy dies } break; case 4: if(!hasWaveStarted){ CreateHazard(platform3); hasWaveStarted = true; } if(enemiesToSpawn[3] > 1 && Time.time > nextEnemySpawn){ //spawns in enemies nextEnemySpawn = Time.time + enemySpawnRate; CallSpawnEnemy(); } if(enemyCount.Length > 0){ anEnemyHasSpawned = true; } if(enemyCount.Length < 1 && hasWaveStarted && !waveCompleted && anEnemyHasSpawned){ //end the wave //Debug.Log("Wave Completed"); waveCompleted = true; CallEndWave (); //called once, as the last enemy dies } break; case 5: if(!hasWaveStarted){ DestroyPlatform(platform4); hasWaveStarted = true; } if(enemiesToSpawn[4] > 1 && Time.time > nextEnemySpawn){ //spawns in enemies nextEnemySpawn = Time.time + enemySpawnRate; CallSpawnEnemy(); } if(enemyCount.Length > 0){ anEnemyHasSpawned = true; } if(enemyCount.Length < 1 && hasWaveStarted && !waveCompleted && anEnemyHasSpawned){ //end the wave //Debug.Log("Wave Completed"); waveCompleted = true; CallEndWave (); //called once, as the last enemy dies } break; case 6: //once reaching this the next level is called if(!hasWaveStarted && !waveCompleted) { WaveGraphic[5].SetActive(true); CallNextLevel(); hasWaveStarted = true; waveCompleted = true; } break; } //spawnplayer two check if(playerTwoHasSpawned == 0 && playerTwoThisLevel == false && Input.GetKeyDown (KeyCode.Alpha2)){ Instantiate (secondPlayer, player2Spawn.position, player2Spawn.rotation); player2Canvas.SetActive(true); body2 = GameObject.FindGameObjectWithTag("P2Body"); lance2 = GameObject.FindGameObjectWithTag("P2Lance"); bottom2 = GameObject.FindGameObjectWithTag("P2Bottom"); head2 = GameObject.FindGameObjectWithTag("P2Head"); gun1_2 = GameObject.FindGameObjectWithTag("P2Gun1"); gun1_2.SetActive(false); gun2_2 = GameObject.FindGameObjectWithTag("P2Gun2"); gun2_2.SetActive(false); gun3_2 = GameObject.FindGameObjectWithTag("P2Gun3"); gun3_2.SetActive(false); gun4_2 = GameObject.FindGameObjectWithTag("P2Gun4"); gun4_2.SetActive(false); player2 = FindObjectOfType<PlayerController2>(); health2 = FindObjectOfType<PlayerTwoHealthManager>(); PlayerPrefs.SetInt("PlayerTwoHasSpawned", 1); //This will now be true for the rest of the play session.. playerTwoHasSpawned = PlayerPrefs.GetInt("PlayerTwoHasSpawned"); playerTwoThisLevel = true; } else if(playerTwoHasSpawned == 1 && playerTwoThisLevel == false){ //automatically spawns player 2 into the next level when it loads. Instantiate (secondPlayer, player2Spawn.position, player2Spawn.rotation); player2Canvas.SetActive(true); body2 = GameObject.FindGameObjectWithTag("P2Body"); lance2 = GameObject.FindGameObjectWithTag("P2Lance"); bottom2 = GameObject.FindGameObjectWithTag("P2Bottom"); head2 = GameObject.FindGameObjectWithTag("P2Head"); gun1_2 = GameObject.FindGameObjectWithTag("P2Gun1"); gun1_2.SetActive(false); gun2_2 = GameObject.FindGameObjectWithTag("P2Gun2"); gun2_2.SetActive(false); gun3_2 = GameObject.FindGameObjectWithTag("P2Gun3"); gun3_2.SetActive(false); gun4_2 = GameObject.FindGameObjectWithTag("P2Gun4"); gun4_2.SetActive(false); player2 = FindObjectOfType<PlayerController2>(); health2 = FindObjectOfType<PlayerTwoHealthManager>(); playerTwoThisLevel = true; } // //Game Over check if(gameOver == false && playerTwoHasSpawned == 0 && PlayerHealthManager.playerLives < 0){//only for player 1 player1Canvas.SetActive (false); player2Canvas.SetActive (false); player.enabled = false; player.GetComponent<Renderer>().enabled = false; player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; //haults movement body.SetActive(false); head.SetActive(false); lance.SetActive(false); bottom.SetActive(false); gun1.SetActive(false); gun2.SetActive(false); gun3.SetActive(false); gun4.SetActive(false); //disable more guns if needed CallGameOver (); //game keeps playing in the background but player control is completely lost - should be okay gameOver = true; } else if(gameOver == false && playerTwoHasSpawned == 1 && PlayerHealthManager.playerLives < 0 && PlayerTwoHealthManager.player2Lives < 0){//when two players exist player1Canvas.SetActive (false); player2Canvas.SetActive (false); //disable player one renders and ability to move just like when respawning player.enabled = false; player.GetComponent<Renderer>().enabled = false; player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; //haults movement body.SetActive(false); head.SetActive(false); lance.SetActive(false); bottom.SetActive(false); gun1.SetActive(false); gun2.SetActive(false); gun3.SetActive(false); gun4.SetActive(false); //disable player two renders and ability to move just like when respawning player2.enabled = false; player2.GetComponent<Renderer>().enabled = false; player2.GetComponent<Rigidbody2D>().velocity = Vector2.zero; //haults movement body2.SetActive(false); head2.SetActive(false); lance2.SetActive(false); bottom2.SetActive(false); gun1_2.SetActive(false); gun2_2.SetActive(false); gun3_2.SetActive(false); gun4_2.SetActive(false); //disable more guns if needed CallGameOver (); //game keeps playing in the background but player control is completely lost - should be okay gameOver = true; } }