public IEnumerator RespawnPlayerCo() { //Instantiate(deathEffect, player.transform.position, player.transform.rotation); player.GetComponent <Rigidbody>().velocity = Vector3.zero; player.enabled = false; //player.renderer.enabled = false; //camera.isFollowing = false; yield return(new WaitForSeconds(respawnDelay)); if (player.tag == "EnemyRed") { player.transform.position = RedChampSpawnPoint.transform.position; } if (player.tag == "EnemyBlue") { player.transform.position = BlueChampSpawnPoint.transform.position; } //player.transform.position = currentCheckPoint.transform.position; player.enabled = true; //player.renderer.enabled = true; //camera.isFollowing = true; energyManager.FullEnergy(); healthManager.FullHealth(); healthManager.isDead = false; // Instantiate(RespawnEffect, currentCheckPoint.transform.position, currentCheckPoint.transform.rotation); }
public IEnumerator RespawnPlayerCoroutine() { /*** Part 5 ***/ //player.enabled = false; player.gameObject.SetActive(false); player.GetComponent <Renderer> ().enabled = false; /*** Part 7 ***/ //gravityStore = player.GetComponent<Rigidbody2D> ().gravityScale; //player.GetComponent<Rigidbody2D> ().gravityScale = 0f; /*** Part 6 prevent sticky wall***/ //player.GetComponent<Rigidbody2D> ().velocity = Vector2.zero; /*** Part 5 ***/ yield return(new WaitForSeconds(respawnDelay)); //player.enabled = true; player.gameObject.SetActive(true); player.GetComponent <Renderer> ().enabled = true; /*** Part 7 ***/ //player.GetComponent<Rigidbody2D> ().gravityScale = gravityStore; /*** Part 11 prevents respawn knockback ***/ player.knockbackCount = 0; Debug.Log("Player Respawn"); player.transform.position = currentCheckPoint.transform.position; /*** Part 9 ***/ healthManager.FullHealth(); healthManager.isDead = false; /*** prevent making player dead for respawn properly***/ }
public IEnumerator RespawnPlayerCo() { Instantiate(dethParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; myndavel.isFollowing = false; /* (this is not needed now) * -------------- gravity 5 is stored ---------------------- * gravityStore = player.GetComponent<Rigidbody2D>().gravityScale; * --------------- gravity changed to 0 ---------------------- * player.GetComponent<Rigidbody2D>().gravityScale = 0f; * player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; */ powerPoint.AddPoints(-pointPenaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); /* (this is not needed now) * --------- gravity changed back to 5 using gravityStore witch stored our gravity 5 -------------------- * player.GetComponent<Rigidbody2D>().gravityScale = gravityStore; */ player.transform.position = currentCheckpoint.transform.position; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; myndavel.isFollowing = true; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
// 重生 CoRutune 為了使用 WaitForSec public IEnumerator RespawnPlayerCo() { player.enabled = false; // 先讓玩家消失 Instantiate(deathPaticle, player.transform.position, player.transform.rotation); // 死亡粒子特效 myCamera.isFollowing = false; //player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; // 死亡時將加速度移除 player.GetComponent <Renderer> ().enabled = false; // 先讓玩家消失 //userGravity = player.GetComponent<Rigidbody2D>().gravityScale; //player.GetComponent<Rigidbody2D>().gravityScale = 0f; // 清除重力 //ScoreManager.AddPoint(-pointPenaltyOnDeath); // 死亡處罰 yield return(new WaitForSeconds(respawnDelay)); // 延遲 if (!lifeManager.gameOver) { Debug.Log("Player Respawm: 玩家重生"); healthManager.FullHealth(); // 補滿血 player.transform.position = currentSavePoint.transform.position; // 移動位置 player.enabled = true; // 啟動玩家 player.GetComponent <Renderer> ().enabled = true; // 啟動玩家 myCamera.isFollowing = true; healthManager.isDead = false; //player.GetComponent<Rigidbody2D>().gravityScale = userGravity; // 賦予重力 //player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; // 將加速度移除 Instantiate(respawnPaticle, currentSavePoint.transform.position, currentSavePoint.transform.rotation); // 重生粒子特效 } else { // GameOver enemySpawner.StopEnemySpawn(); // 停止生怪 bgm.GetComponent <AudioSource>().Stop(); Time.timeScale = 0f; // 停止時間 } }
// Respawns the player, returning to the current checkpoint and giving full health public void RespawnPlayer() { Debug.Log("Player Respawn"); player.transform.position = currentCheckpoint.transform.position; healthManager.FullHealth(); healthManager.isDead = false; }
public IEnumerator RespawnPlayerCo() { Instantiate(deathFX, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; camCtrl.isFollowing = false; // gravityStore = player.GetComponent<Rigidbody2D>().gravityScale; //player.GetComponent<Rigidbody2D>().gravityScale = 0f; //player.GetComponent<Rigidbody2D>().velocity = Vector2.zero; ScoreManager.AddPoints(-pointsPenaltyOnDeath); Debug.Log("Player Respawned"); yield return(new WaitForSeconds(respawnDelay)); //player.GetComponent<Rigidbody2D>().gravityScale = gravityStore; player.transform.position = currentCheckpoint.transform.position; player.knockBackCount = 0; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; camCtrl.isFollowing = true; Instantiate(respawnFX, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public IEnumerator RespawnPlayerCo() { Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer> ().enabled = false; gravityStore = player.GetComponent <Rigidbody2D> ().gravityScale; player.GetComponent <Rigidbody2D> ().gravityScale = 0f; player.GetComponent <Rigidbody2D> ().velocity = Vector2.zero; ScoreManager.AddPoints(-pointPenaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); player.GetComponent <Rigidbody2D> ().gravityScale = gravityStore; player.transform.position = currentCheckpoint.transform.position; if (FindObjectOfType <Camera2DFollow>() != null) { FindObjectOfType <Camera2DFollow> ().target = player.gameObject.transform; } Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); player.enabled = true; player.transform.parent = null; player.GetComponent <Renderer> ().enabled = true; healthManager.FullHealth(); //if (FindObjectOfType<AdsOnLvl> ()) //{ // FindObjectOfType<AdsOnLvl> ().deaths++; //} healthManager.isDead = false; }
public IEnumerator RespawnPlayerCo() { player.knockbackCount = 0; player.rb2d.velocity = new Vector2(0, 0); player.StopAllCoroutines(); player.enabled = false; camera.isFollowing = false; gravityStore = player.rb2d.gravityScale; player.rb2d.gravityScale = 0f; player.animator.Play("player_death"); player.GetComponent <Rigidbody2D>().simulated = false; yield return(new WaitForSeconds(1)); rend.enabled = false; Instantiate(DeathParticle, player.transform.position, player.transform.rotation); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckpoint.transform.position; camera.isFollowing = true; player.GetComponent <Rigidbody2D>().simulated = true; Instantiate(RespawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); player.enabled = true; healthManager.FullHealth(); healthManager.isDead = false; player.rb2d.gravityScale = gravityStore; rend.enabled = true; player.TurnInvincible(); }
public IEnumerator RespawnPlayerCo() { //Instantiate(deathParticle, thePlayer.transform.position, thePlayer.transform.rotation); thePlayer.enabled = false; thePlayer.GetComponent <Renderer>().enabled = false; //thePlayer.GetComponent<Rigidbody2D>().velocity = Vector2.zero; // non funziona... theCamera.enabled = false; thePlayer.tag = "PlayerIsDead"; //altriemnti ho collisioni.. trova un modo piu pulito yield return(new WaitForSeconds(respawnDelay)); thePlayer.tag = "Player"; theCamera.enabled = true; thePlayer.transform.position = currentCheckpoint.transform.position; // -------------TO-DO thePlayer.enabled = true; thePlayer.GetComponent <Renderer>().enabled = true; //Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); // -------------TO-DO //theScoreManager.AddPoints(-pointPenaltyOnDeath); theHealthManager.FullHealth(); theHealthManager.isDead = false; }
public IEnumerator RespawnPlayerCo() { player.rb2dPlayer.constraints = RigidbodyConstraints2D.FreezePositionY; theAM = FindObjectOfType <AudioManager>(); Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Animator>().enabled = false; player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); player.GetComponent <Rigidbody2D>().gravityScale = 0; player.rb2dPlayer.constraints = RigidbodyConstraints2D.FreezeAll; yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckpoint.transform.position; player.GetComponent <Rigidbody2D>().gravityScale = 1; player.enabled = true; player.GetComponent <Animator>().enabled = true; player.rb2dPlayer.constraints = RigidbodyConstraints2D.FreezeRotation; lifeManager.TakeLife(); theAM.BGM.Play(); healthManager.FullHealth(); healthManager.isDead = false; }
public IEnumerator RespawnPlayerCo() { player.enabled = false; // player component is hidden Instantiate(deathParticle, player.transform.position, player.transform.rotation); // Makes a death particle object player.gameObject.SetActive(false); //Deletes the gameobject temporalary yield return(new WaitForSeconds(respawnDelay)); //Waits a few seconds with the value of the respawnDelay var player.transform.position = currentCheckpoint.transform.position; //Player finds the checkpoint position of what was the last Checkpoint player.enabled = true; //Player component is active again player.gameObject.SetActive(true); //Player Object comes back healthManager.FullHealth(); //Player is at full health healthManager.isDead = false; //Player is not dead ScoreManager.score = 0; //Score returns to 0 Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); // Makes a respawn effect player.knockbackCount = 0; // Player's knockback is back at 0 timeManager.ResetTime(); //Time is reset }
public IEnumerator RespawnPlayerCo() //I used a Couroutine here because i wanted to add a delay time for my code //i was using this so i could freeze the code to allow the death animation to play and delay for a second so respawning wasnt instant //this allows the player to realise how they died and them jump back into the game //first i instantiate the death particle on the player so it plays //i then turn off the player so the input controls for the player dont work anymore //i then get the renderer component and set it to false so it cant be seen //i then start the vertical camera movement so it doesnt keep following the player //i then yield a return of a wait for seconds so i can delay the respawn, at which this number for seconds is set in the inspector //it then moves the player to the last activated checkpoint transform //reenables the player //sets renderer back to true //uses the healt manager to set the health of the player back to full //sets is dead to false //sets camera follow in vertical to true again to capture player movements in vertical axis //and lastly instantiates the respawn particle to finish animation { Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; camera.disableVerticalFollow = false; Debug.Log("Player Respawn Here"); yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckpoint.transform.position; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; camera.disableVerticalFollow = true; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public void EnergyTankEnabled() { tanks = newTanks; if (tanks >= 1) { healthManager.FullHealth(); newTanks--; Tanks.text = newTanks.ToString(); } else { Debug.Log("NO ENERGY TANKS AVAILABLE"); } // healthManager.FullHealth(); // energyTankManager.UseEnergyTank(); // if (energyTankManager.noOfTanks >= 1) // { //healthManager.HealthGradIncrease(); // healthManager.FullHealth(); //energyTankManager.noOfTanks--; //Debug.Log("ENERGY TANK HEALTH INCREASE"); // Debug.Log("Energy Tank Used"); // } //else // { // Debug.Log("NO ENERGY TANKS AVAILABLE"); // } }
//coroutine to generalize subroutinens //this method controls what happens during and after player death public IEnumerator RespawnPlayerCo() { Instantiate(dParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; player.GetComponent <Rigidbody2D> ().gravityScale = 0f; player.GetComponent <Rigidbody2D> ().velocity = Vector2.zero; ScoreManager.AddPoints(-pointPenatlyOnDeath); yield return(new WaitForSeconds(respawnTime)); player.GetComponent <Rigidbody2D> ().gravityScale = 5; player.transform.position = currentCheckPoint.transform.position; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; Instantiate(lParticle, currentCheckPoint.transform.position, currentCheckPoint.transform.rotation); }
} //so I can put a delay in it, and it doesn't affect all the other code public IEnumerator RespawnPlayerCo() { //KILL EVERYTHING ------------------------------------------- //Death particle Instantiate(deathParticle, player.transform.position, player.transform.rotation); //Player player.GetComponent <Renderer>().enabled = false; player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; player.enabled = false; //Camera camera.isFollowing = false; //Bow weapon.enabled = false; weapon.GetComponent <Renderer>().enabled = false; //Sword sword.enabled = false; sword.GetComponent <Renderer>().enabled = false; //RESPAWN EVERYTHING ------------------------------------------- //Subtract points ScoreManager.AddPoints(-pointPenaltyOnDeath); //Move player before delay player.transform.position = currentCheckpoint.transform.position; //Respawn Delay yield return(new WaitForSeconds(respawnDelay)); //Respawn particle Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); //Player player.GetComponent <Renderer>().enabled = true; player.enabled = true; //Health healthManager.FullHealth(); healthManager.isDead = false; //Camera camera.isFollowing = true; //Bow weapon.enabled = true; weapon.GetComponent <Renderer>().enabled = true; weapon.GetComponent <Animator>().SetBool("PlayerShoot", false); weapon.GetComponent <Animator>().CrossFade("Bow_Idle", 0f); //Sword sword.enabled = true; }
// COROUTINE..... for making delay between player death and the player respawning... public IEnumerator RespawnPlayerCo() { // clones the orginal object and returns the clone // ON PLAYER DEATH... /// Instantiate(deathParticle, player.transform.position, player.transform.rotation); // we need position and rotation when instantiating an object // taking points on death of the player ScoreManager.AddPoints(-pointPenaltyOnDeath); // storing the orginal player gravity // gravityStore = player.GetComponent<Rigidbody2D>().gravityScale; // NOT WORKING :( // camera mustnot follow anything after the player is dead /// camera.isFollowing = false; player.enabled = false; // so that after the player is dead user cannot contol the player; player.GetComponent <Renderer>().enabled = false; // so that the player will be invisible after death in time delay between // death and respawning... // for completely stopping the player after the death... player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; // vector2.zero set x==y==0 // when the player falls the camera dosent go on falling with the palyer // player shouldn't bee keeping on falling // player.GetComponent<Rigidbody2D>().gravityScale = 0f; //MAKING TIME DELAY___________________________________________________________________________ yield return(new WaitForSeconds(respawnDelay)); // resetting the orginal palyer graivty //player.GetComponent<Rigidbody2D>().gravityScale = gravityStore; // NOT WORKING I DONT KNOW SHIT!!!!!!!! //player.GetComponent<Rigidbody2D>().gravityScale = gravity; // RESETTING THE HEALTH OF THE PLAYER healthmanager.FullHealth(); healthmanager.isDead = false; // so that the player is not killed over and over again in the limited time player.knockbackCount = 0; // resume the camera following the player /// camera.isFollowing = true; // resetting the setting. i.e so player is visible and can be controlled by the user. player.enabled = true; player.GetComponent <Renderer>().enabled = true; // on death the player position is changed to the last checkpoint he passed. player.transform.position = currentCheckPoint.transform.position; // ON PLAYER RESPAWN /// Instantiate(spawnParticle, player.transform.position, player.transform.rotation); }
public void RespawnPlayer() { ScoreManager.AddPoints(-pointPenaltyOnDeath); player.enabled = false; //почитать про enabled; //player.GetComponent<Renderer> ().enabled = false; Debug.Log("Player Respawn"); player.knockbackCount = 0f; player.transform.position = currentCheckpoint.transform.position; player.enabled = true; //почитать про enabled; //player.GetComponent<Renderer> ().enabled = true; //player.knockbackCount = 0; healthManager.FullHealth(); }
public IEnumerator RespawnPlayerCo() { Instantiate(deathParticle, CharacterRobotBoy.transform.position, CharacterRobotBoy.transform.rotation); CharacterRobotBoy.enabled = false; CharacterRobotBoy.GetComponent <Renderer>().enabled = false; Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); CharacterRobotBoy.transform.position = currentCheckpoint.transform.position; CharacterRobotBoy.enabled = true; CharacterRobotBoy.GetComponent <Renderer>().enabled = true; healthManager.isDead = false; healthManager.FullHealth(); Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public void UseEnergyTank() { if (rando >= 1) { //healthManager.HealthGradIncrease(); healthManager.FullHealth(); startNoOfTanks--; //Debug.Log("ENERGY TANK HEALTH INCREASE"); // Debug.Log("Energy Tank Used"); } else { Debug.Log("NO ENERGY TANKS AVAILABLE"); } }
public IEnumerator RespawnPlayerCo() { //player dies // player.enabled = false; Instantiate(deathEffect, player.transform.position, player.transform.rotation); player.gameObject.SetActive(false); player.GetComponent <Renderer> ().enabled = false; // player.Dying (); timeManager.ResetTime(); // player.GetComponent<CircleCollider2D> ().enabled = false; //stops camera movement when dies (camera attached to player) // camera.isFollowing = false; // player.GetComponent<Rigidbody2D> ().velocity = Vector2.zero; //deduct points per death ScoreManager.AddPoints(-penaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); //player revives // player.enabled = true; player.gameObject.SetActive(true); player.GetComponent <Renderer> ().enabled = true; // player.Living (); player.transform.position = currentCheckpoint.transform.position; // player.GetComponent<CircleCollider2D> ().enabled = true; /*** Part 9 ***/ healthManager.FullHealth(); healthManager.isDead = false; timeManager.ResetTime(); // camera.isFollowing = true; }
//a coroutine runs on it's own timeloop, need to do this to use the wait for seconds i think public IEnumerator RespawnPlayerCo() { //create game object need position and rotation Instantiate(DeathParticle, Player.transform.position, Player.transform.rotation); //disable player, so he can't move Player.enabled = false; //hide the player Player.GetComponent <Renderer>().enabled = false; camera.isFollowing = false; //if the player dies by falling off, we stop things like the camera from falling by setting 0 gravity //Player.GetComponent<Rigidbody2D> ().gravityScale = 0f; //this is so the camera will also stop when a player dies //Player.GetComponent<Rigidbody2D> ().velocity = Vector2.zero; ScoreManager.AddPoints(-PointPenaltyOnDeath); Debug.Log("Player Respawn"); //pause yield return(new WaitForSeconds(RespawnDelay)); //after the player respawns change the gravity back //Player.GetComponent<Rigidbody2D> ().gravityScale = 5f; //bring the player back Player.transform.position = CurrentCheckPoint.transform.position; //reset knockback when respawn Player.knockbackCount = 0; Player.enabled = true; Player.GetComponent <Renderer>().enabled = true; //reset player health healthManager.FullHealth(); healthManager.isDead = false; camera.isFollowing = true; Instantiate(RespawnParticle, CurrentCheckPoint.transform.position, CurrentCheckPoint.transform.rotation); }
public IEnumerator RespawnPlayerCo() { // Disable the player and play the death effect. // This stops the player from being seen and stops // the camera from following the player after death. Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer> ().enabled = false; camera.isFollowing = false; //Subtract points because the player died, wait before respawning //at a checkpoint. ScoreManager.AddPoints(-pointPenaltyOnDeath); yield return(new WaitForSeconds(respawnDelay)); // Move the player's position to the most recent check point and // reactivate the player. player.transform.position = currentCheckpoint.transform.position; player.enabled = true; player.GetComponent <Renderer> ().enabled = true; // Reset the player's health, knockbackcount, and // rapidFire powerup boolean. player.rapidFire = false; player.knockbackCount = 0f; healthManager.FullHealth(); healthManager.isDead = false; // Put the camera back on the player, play respawn effect. camera.isFollowing = true; player.GetComponent <Rigidbody2D> ().velocity = Vector3.zero; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); // Reset the crumble boxes. // This is done in case the player died on the crumble boxes // and respawned at a checkpoint behind them. if (crumbleBoxes.Length > 0) { for (var i = 0; i < crumbleBoxes.Length; i++) { crumbleBoxes[i].SetActive(true); crumbleBoxes [i].GetComponent <DestroyObjectOverTime> ().startDestroy = false; } } }
//wait fo respawn to diplay death particle public IEnumerator RespawnPlayerCo() { //Stop background music //GetComponent<AudioSource>().Stop(); //paritcle Instantiate(deathPaticle, player.transform.position, player.transform.rotation); //after dead don't move player.enabled = false; player.gameObject.GetComponent <Renderer>().enabled = false; //camera camera.isFollowing = false; // Penalty points after dead ScoreManager.AddPoints(-pointPenaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSecondsRealtime(respawnDelay)); //Start background music //GetComponent<AudioSource>().Play(); player.transform.position = currentCheckpoit.transform.position; player.knockbackCount = 0; //after dead don't move player.enabled = true; player.gameObject.GetComponent <Renderer>().enabled = true; //come back to full health healthManager.FullHealth(); healthManager.isDead = false; //camera camera.isFollowing = true; //paritcle Instantiate(respawnPaticle, currentCheckpoit.transform.position, currentCheckpoit.transform.rotation); }
public IEnumerator RespawnPlayerCo() { Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; camera.isFollowing = false; ScoreManager.AddPoints(-pointPenalty); Debug.Log("Player Respawns"); yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckpoint.transform.position; player.knockbackCounter = 0f; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; camera.isFollowing = true; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public IEnumerator RespawnPlayerCo() { player.enabled = false; GetComponent <Renderer>(); yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckpoint.transform.position; player.knockbackCount = 0; player.enabled = true; GetComponent <Renderer>(); healthManager.FullHealth(); healthManager.isDead = false; }
public IEnumerator RespawnPlayerCo() { Instantiate(deathPartBlack, player.transform.position, player.transform.rotation); Instantiate(deathPartTan, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; player.GetComponent <Rigidbody2D>().gravityScale = 0f; player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; ScoreManager.score = ScoreManager.score - 10; Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); player.knockbackCount = 0; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDead = false; player.transform.position = currentCheckpoint.transform.position; player.GetComponent <Rigidbody2D>().gravityScale = 5f; }
public IEnumerator RespawnPlayerCo() { Instantiate(deathParticles, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; mycamera.isFollowing = false; //player.GetComponent<Rigidbody>().useGravity = false; //player.GetComponent<Rigidbody>().velocity = Vector3.zero; ScoreManager.AddPoints(-PointPenaltyOnDeath); Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); player.transform.position = currentCheckPoint.transform.position; player.knockbackCount = 0; player.enabled = true; player.GetComponent <Renderer>().enabled = true; healthManager.FullHealth(); healthManager.isDeath = false; mycamera.isFollowing = true; //player.GetComponent<Rigidbody>().useGravity = true; Instantiate(respawnParticles, currentCheckPoint.transform.position, currentCheckPoint.transform.rotation); }
public IEnumerator RespawnPlayerCo() { Debug.Log("Player Respawn"); //Instantiate (deathParticle, player.transform.position, player.transform.rotation); yield return(new WaitForSeconds(respawnDelay)); DrillmoleyRobRespawnPos = true; OwlBotRespawn = true; BullSteveAreaRespawn = true; if (!player.m_FacingRight) { player.Flip(); } player.GetComponent <Rigidbody2D> ().gravityScale = gravityStore; player.transform.position = currentCheckpoint.transform.position; player.enabled = true; player.shotDelay = false; player.shooting = false; player.gameObject.SetActive(true); healthManager.FullHealth(); healthManager.isDead = false; ScoreManager.score = 0; cambound.XMinValue = 1.48f; cambound.XMaxValue = 650f; cambound.YMinValue = -28.01f; cambound.YMaxValue = 39.7f; HollyAI.Respawn = true; RespawnSet = true; playerMove.knockbackCount = 0.7f; playerMove.knockback = 2; playerMove.knockFromRight = false; playerMove.NoControl = false; ComingUpToBoss.SetActive(true); //Instantiate (respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); //timeManager.ResetTime (); }
//creating a co-routint public IEnumerator RespawnPlayerCo() { gravityScore = player.GetComponent <Rigidbody2D>().gravityScale; Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; //camera.isFollowing = false; player.GetComponent <Rigidbody2D>().gravityScale = 0f; //stop his speed player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; ScoreManager.AddPoints(-pointPenaltyOnDeath); Debug.Log("PLayer respawn"); yield return(new WaitForSeconds(respawnDelay)); player.GetComponent <Rigidbody2D>().gravityScale = gravityScore; player.transform.position = currentCheckpoint.transform.position; player.enabled = true; //camera.isFollowing=true; healthManager.FullHealth(); healthManager.isDead = false; player.GetComponent <Renderer>().enabled = true; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }
public IEnumerator RespawnPlayerCo() { // Creates a copy of Object Instantiate(deathParticle, player.transform.position, player.transform.rotation); player.enabled = false; player.GetComponent <Renderer>().enabled = false; camera.isFollowing = false; player.GetComponent <Rigidbody2D>().gravityScale = 0f; player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; VoidEssenceManager.RemoveCurrencyOnDeath(); // Debug.Log("Player Respawn"); yield return(new WaitForSeconds(respawnDelay)); camera.isFollowing = true; player.GetComponent <Rigidbody2D>().gravityScale = 5f; player.playerInsanity = player.playerInsanity * 1.02f; player.transform.position = currentCheckpoint.transform.position; player.enabled = true; healthManager.FullHealth(); healthManager.isDead = false; player.GetComponent <Renderer>().enabled = true; Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }