Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Kynai : MonoBehaviour
- {
- public KeyCode weaponkey;
- public GameObject kynai1;
- public Camera camera;
- public IEnumerator Coroutine()
- {
- while (true)
- {
- kynai1.transform.position += Camera.mainCamera.transform.forward*40;
- yield return new WaitForEndOfFrame();
- Debug.Log("PABOTAET");
- }
- }
- // Use this for initialization
- void Start ()
- {
- }
- // Update is called once per frame
- void Update ()
- {
- if (Input.GetKeyDown(weaponkey))
- {
- Transform blank = Instantiate(kynai1,transform.position, transform.rotation) as Transform;
- StartCoroutine(Coroutine());
- }
- }
- }
Add Comment
Please, Sign In to add comment