Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
648 B
2
Indexable
Never
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoonSharp.Interpreter;

public class BotLocation : MonoBehaviour
{
    // Start is called before the first frame update  
    float x_from_player;  
    double returnX() {

        string script = @"    
		-- returns X for bots 8)

        x = 5

		return 5";

	DynValue res = Script.RunString(script);
	return res.Number;

    }
    
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        x_from_player = (float)returnX();
        transform.Translate(Vector3.forward * Time.deltaTime * x_from_player);

    
    }
}