Guest User

Untitled

a guest
May 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Kynai : MonoBehaviour
  5. {
  6. public KeyCode weaponkey;
  7. public GameObject kynai1;
  8. public Camera camera;
  9. public IEnumerator Coroutine()
  10. {
  11. while (true)
  12. {
  13. kynai1.transform.position += Camera.mainCamera.transform.forward*40;
  14. yield return new WaitForEndOfFrame();
  15. Debug.Log("PABOTAET");
  16. }
  17. }
  18. // Use this for initialization
  19. void Start ()
  20. {
  21. }
  22.  
  23. // Update is called once per frame
  24. void Update ()
  25. {
  26. if (Input.GetKeyDown(weaponkey))
  27. {
  28. Transform blank = Instantiate(kynai1,transform.position, transform.rotation) as Transform;
  29. StartCoroutine(Coroutine());
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment