示例#1
0
    public void Update()
    {
        if (euphoriaController.IsDead())
        {
            return;
        }
        Vector2 movement = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        if (euphoriaController.IsEuphoric())
        {
            this.rigidBody.velocity = movement.normalized * this.euphoricSpeed;
        }
        else
        {
            this.rigidBody.velocity = movement.normalized * this.walkSpeed;
        }
        mousePos = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
        float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }
示例#2
0
 public void Update()
 {
     if (euphoriaController.IsDead())
     {
         foreach (Transform child in transform)
         {
             child.gameObject.SetActive(true);
         }
         if (Input.GetKey(KeyCode.R))
         {
             Application.LoadLevel(Application.loadedLevel);
         }
     }
     else
     {
         foreach (Transform child in transform)
         {
             child.gameObject.SetActive(false);
         }
     }
 }