Exemplo n.º 1
0
        public DetourMoveTo()
        {
            try {
                IntPtr moveToPointer = new IntPtr(Memory.LOLBaseAddress + Offsets.MoveTo);
                MoveToDele = (moveTo)Marshal.GetDelegateForFunctionPointer(moveToPointer, typeof(moveTo));

                Memory.GetMagic.Detours.CreateAndApply(MoveToDele, new moveTo(this.MoveToDetour), "moveTo");
            } catch (Exception ex) {
                Frame.Log(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public DetourMoveTo()
        {
            try {

                    IntPtr moveToPointer = new IntPtr(Memory.LOLBaseAddress+Offsets.MoveTo);
                    MoveToDele = (moveTo)Marshal.GetDelegateForFunctionPointer(moveToPointer, typeof(moveTo));

                    Memory.GetMagic.Detours.CreateAndApply(MoveToDele,new moveTo(this.MoveToDetour),"moveTo");

                } catch (Exception ex) {

                    Frame.Log(ex.ToString());
                }
        }
Exemplo n.º 3
0
    GameObject instatiateNewRobot(GameObject prefab,GlobalControl.motionModels _motionModel)
    {
        Vector3 currentPosition = currentObject.transform.position;
        Quaternion currentRotation = currentObject.transform.rotation;
        //Remove current object
        DestroyImmediate(currentObject);
        //Create new one
        currentObject = (GameObject)Object.Instantiate(prefab,currentPosition,currentRotation);
        currentObject.name = robotName;
        currentObject.gameObject.SetActive(true);

        //Add control script
        gm = currentObject.gameObject.AddComponent<GlobalMove>();
        gm.changeMotionModel (_motionModel);
        move = currentObject.AddComponent<moveTo> ();
        move.changeMotionModel (_motionModel);

        this.motionModel = _motionModel;
        return currentObject;
    }
Exemplo n.º 4
0
 public void createRobot()
 {
     print ("CREATING ROBOT: " + motionModel);
     if (robot != null){
         GameObject.DestroyImmediate(robot);
     }
     switch(motionModel){
         case GlobalControl.motionModels.DISCRETE:
             robot = (GameObject) Instantiate(Resources.Load("SphereCamera", typeof(GameObject)));
             break;
         case GlobalControl.motionModels.KINEMATIC:
             robot = (GameObject) Instantiate(Resources.Load("SphereCamera", typeof(GameObject)));
             break;
         case GlobalControl.motionModels.DYNAMIC:
             robot = (GameObject) Instantiate(Resources.Load("SphereCamera", typeof(GameObject)));
             break;
         case GlobalControl.motionModels.DIFFERENTIAL:
             robot = (GameObject) Instantiate(Resources.Load("DifferentialRobotCamera", typeof(GameObject)));
             robot.transform.localScale = new Vector3(0.3f,0.3f,0.3f);
             break;
         case GlobalControl.motionModels.CAR:
             robot = (GameObject) Instantiate(Resources.Load("CarCamera", typeof(GameObject)));
             break;
     }
     //Sample a position
     bool found = false;
     float x=0, z=0;
     while (!found) {
         x = Random.Range(-xBound,xBound);
         z = Random.Range(-yBound,yBound);
         found = !grid.isRectOccupied(new Vector3(x,0.5f,z),robot.collider.bounds.extents);
     }
     robot.transform.position = new Vector3(x, 0.5f, z);
     robot.transform.rotation = Quaternion.identity;
     robot.name = "robot";
     robot.tag = "robot";
     robot.SetActive (true);
     GameObject rCam = GameObject.Find ("RobotCamera");
     rCam.camera.enabled = false;
     rCam.camera.gameObject.AddComponent<CameraControl> ();
     //Add MoveTo script
     moveComponent =robot.gameObject.AddComponent<GlobalMove> ();
     moveComponent.changeMotionModel (motionModel);
     moveComponent.changeMaxVelocity (maxV);
     if (motionModel == GlobalControl.motionModels.DIFFERENTIAL) {
         MoveDifferential md = robot.gameObject.GetComponent<MoveDifferential>();
         md.maxW = 0.1f;
     }
     moveToComponent=robot.gameObject.AddComponent<moveTo> ();
     moveToComponent.changeMotionModel(motionModel);
     //		robot.gameObject.AddComponent<LocalCollisionAvoidance> ();
 }
Exemplo n.º 5
0
    private moveTo selfState;    //reference to state machine

    // Start is called before the first frame update
    void Start()
    {
        player    = GameObject.FindGameObjectsWithTag("Player");
        coll      = GetComponent <SphereCollider>();
        selfState = GetComponent <moveTo>();
    }
Exemplo n.º 6
0
    void Start()
    {
        //Create Sphere
        gtext.text = "Kinematic";
        Vector3 initialPosition = new Vector3 (0, 0.5f, 0);
        currentObject = (GameObject)Object.Instantiate (sphere, initialPosition, Quaternion.identity);
        currentObject.gameObject.SetActive (true);
        currentObject.name = robotName;
        Rigidbody r = currentObject.gameObject.AddComponent<Rigidbody> ();
        r.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

        //Add control script
        gm = currentObject.gameObject.AddComponent<GlobalMove>();
        gm.changeMotionModel (motionModel);
        move = currentObject.AddComponent<moveTo> ();
        move.changeMotionModel (motionModel);
        collisionAvoidance = currentObject.AddComponent<LocalCollisionAvoidance> ();
        collisionAvoidance.motionModel = motionModel;
    }
Exemplo n.º 7
0
 void Start()
 {
     //Create Sphere
     gtext.text = "Kinematic";
     Vector3 initialPosition = new Vector3 (0, 0.5f, 0);
     currentObject = (GameObject)Object.Instantiate (sphere, initialPosition, Quaternion.identity);
     currentObject.gameObject.SetActive (true);
     currentObject.name = robotName;
     //Add control script
     gm = currentObject.gameObject.AddComponent<GlobalMove>();
     gm.changeMotionModel (motionModel);
     move = currentObject.AddComponent<moveTo> ();
     move.changeMotionModel (motionModel);
 }