Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #pragma strict
  2.  
  3. public bool torchOn;
  4. void Start () {
  5. torchOn = false;
  6. animation["get_torch_up"].speed = 1.0;
  7. }
  8. void Update () {
  9. if(Input.GetKeyUp("f") && !torchOn) {
  10. animation.Play("get_torch_up");
  11. torchOn = true;
  12. animation["get_torch_up"].speed = -1.0;
  13. }
  14. if(Input.GetKeyUp("f") && torchOn) {
  15. animation.Play("get_torch_up"); // со скоростью -1
  16. torchOn = false;
  17. animation["get_torch_up"].speed = 1.0;
  18. }
  19. if(torchOn) {
  20. animation.Play("torch_idle");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement