|
I am trying to make a horror game that when you turn on your flashlight, the monster runs faster. But the problem is, the AI script im using is in C# but the flashlight script is in javascript. Ive tried to make a flashlight script in C# but none of them worked. Do I need to change the code to C# or is there a way to link C# and JavaScript together? Heres the AI script just in case it might help: public int moveSpeed; public int rotateSpeed; private Transform myTransform; void Awake() { myTransform = transform; } // Use this for initialization void Start () { GameObject go = GameObject.FindGameObjectWithTag("Player"); target = go.transform; } // Update is called once per frame void Update () { Debug.DrawLine(target.position, myTransform.position, Color.red); //Look at the Target myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotateSpeed * Time.deltaTime); //Move towards the Target myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; } } Plese Help!
(comments are locked)
|
|
Thanks SOOOO much!!!! Sorry about the code box thing. Some thing weird happened and it only Did part of the code
(comments are locked)
|
|
hallo, if remember right I have found this in YOUtube hope can help you when you post a script please code it selecting the code then click on 101010 button
(comments are locked)
|
|
Thanks so much!!!!! I dont know what went wrong with the code box. It looked fine in the preview
(comments are locked)
|
