コード例 #1
0
    public IEnumerator RespawnPlayerCo()
    {
        player.letGo();
        Instantiate(deathParticle, player.transform.position, player.transform.rotation);
        player.enabled = false;
        player.GetComponent <Renderer> ().enabled = false;
        mainCamera.isFollowing = false;
//		Debug.Log ("Player respawn here!");
        yield return(new WaitForSeconds(respawnDelay));

        player.GetComponent <Rigidbody2D> ().velocity = new Vector2(0f, 0f);
        player.transform.position = currentCheckpoint.transform.position;
        player.enabled            = true;
        player.GetComponent <Renderer> ().enabled = true;
        healthBarSwapper.FullHealth();
        healthBarSwapper.isDead = false;
        mainCamera.isFollowing  = true;
        player.isDead           = false;
        Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation);
    }