// Use this for initialization
    void Start()
    {
        if (code == null)
        {
            code = gameObject.GetComponent <MainObject>().script;
        }

        Compiler.setCode(code);
        Compiler.compile();

        _ip = new Interpretor();
        _ip.setICode(Compiler.getICode());
        _ip.init();

        //animation setup//
        anim = GetComponent <Animator>();
        if (anim == null)
        {
            anim = GetComponentInChildren <Animator>();
        }
        if (controller == null)
        {
            controller = GetComponent <CharacterController>();
        }
        if (controller == null)
        {
            controller = GetComponentInChildren <CharacterController>();
        }
        stats  = gameObject.GetComponent <AnimalStats>();
        _speed = stats.walk_speed;
        //stats.setType(0);

        //TMP fun animation//
        vision = gameObject.GetComponent <VisionScript2>();
        if (vision == null)
        {
            vision = gameObject.AddComponent <VisionScript2>();
        }
        vision.setSpeed(stats.walk_speed);
        vision.setTurnSpeed(stats.turn_speed);
        vision.enabled = false;

        //add libraries.//
        SensingLib sl = gameObject.AddComponent <SensingLib>();

        sl.setInterpretor(_ip);

        //audio setup//
        audioSetup();

        //tmp code
        tantest();
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        if (code == null)
        {
            code = gameObject.GetComponent <MainObject>().script;
        }
        Compiler.setCode(code);
        Compiler.compile();

        _ip = new Interpretor();
        _ip.setICode(Compiler.getICode());
        _ip.init();

        //add libraries.//
        SensingLib sl = gameObject.AddComponent <SensingLib>();

        sl.setInterpretor(_ip);
    }