Exemplo n.º 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);
    }
Exemplo n.º 2
0
 //verifica lo que esta chocando
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Wall")
     {
         float Side_Position = Mathf.Sign(Enemy.GetComponent <Rigidbody2D>().transform.position.x - collision.transform.position.x);
         Enemy.Addforce       = true;
         Enemy.Ball_Direction = Side_Position * Snow_Speed;
         if (Enemy.Enemy_Speed > -0.01f)
         {
             Enemy.Ball_Direction *= -1;
         }
     }
     if (collision.gameObject.tag == "Wall_End" && Carry == true)
     {
         Player.GetComponent <Rigidbody2D>().simulated = true;
         Player.SendMessage("Surf_Snowball", false);
         Player.Player_State = Player_Script.PlayerState.Jump;
         Instantiate(Sw_Particle, transform.position, Quaternion.identity);
     }
     else if (collision.gameObject.tag == "Wall_End" && Carry == false)
     {
         Instantiate(Sw_Particle, transform.position, Quaternion.identity);
     }
 }
Exemplo n.º 3
0
 private void bluePowerUp(Player_Script script)
 {
     script.GetComponent<Controls>().speed = 20.0f;
 }