/// <summary> /// Creates the fact set from an object instance with object grapher. /// </summary> /// <param name="objectinstance">The object instance.</param> /// <returns></returns> public List <WME> CreateFactSetFromObjectInstanceWithObjectGrapher(ObjectInstance objectinstance) { Object obj = objectinstance.Object; ObjectInterface objectinterface = new ObjectInterface(AgendaName); return(objectinterface.createFactSetObjectInstanceWithObjectGrapher(obj)); }
public bool PathBlocked(int aX, int aY) { bool lIsBlocked = false; //check base grid if ((this.BaseGrid.GetItem(aX, aY) == LevelTiles.Wall)) { lIsBlocked = true; } //check object grid ObjectInterface lObj = ObjectGrid.GetItem(aX, aY); if (lObj != null) { if (!lObj.CanWalk()) { lIsBlocked = true; } } //check Actorgrid if (ActorGrid.GetItem(aX, aY) != null) { lIsBlocked = true; } return(lIsBlocked); }
public static void loadScene(string sceneName) { RCLog.append("-----------------------------***-------------------------------"); sceneName = sceneName.Replace("\"", ""); int index = -1; UnityEngine.Debug.Log(sceneName); string[] gameFiles = FileManager.getAllScenes(); //foreach (string s in gameFiles) UnityEngine.Debug.Log(s); for (int i = 0; i < gameFiles.Length; i++) { if (gameFiles[i] == sceneName) { index = i; break; } } if (index < 0) { return; } RCLog.append("checkpoint1"); Data.reset(); Data.sceneName = sceneName; UnityEngine.GameObject loader = UnityEngine.GameObject.Find("Loader"); UnityEngine.GameObject gui = new UnityEngine.GameObject("GUI"); ObjectInterface oi = gui.AddComponent <ObjectInterface>(); FileManager.loadScene(); UnityEngine.GameObject.Destroy(gui); RCLog.append("checkpoint2"); loader.GetComponent <Loader>().reload(); RCLog.append("checkpoint3"); }
public frmConfiguration(string scriptNamePath) { this.configGuiCtrl = new ObjectInterface(); this.currentDir = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts"; this.InitializeComponent(); this.configFilePathVal.Text = scriptNamePath.Replace(".py", ".cfg"); }
/// <summary> /// Creates the fact set from an object instance. /// </summary> /// <param name="objectinstance">The object instance.</param> /// <param name="objectMapTable">The object map table.</param> /// <returns></returns> public List <WME> CreateFactSetFromObjectInstance(ObjectInstance objectinstance, ObjectMapTable objectMapTable) { ObjectInterface objectinterface = new ObjectInterface(AgendaName); Object obj = objectinstance.Object; return(objectinterface.createFactSetFromObjectInstance(obj, objectMapTable)); }
public void Build() { int temp = 0; foreach (GameObject obj in pack) { ObjectInterface img = imgarr[temp].GetComponent <ObjectInterface>(); img.ApplyItem(obj); temp++; } }
public frmGPIBCtrl(int boardID, byte primaryAddress, byte secondaryAddress) { this.cpGuiCtrl = new ObjectInterface(); try { this._GPIBCtrl = new GPIB_Mgr_Agilent_HP8648C(boardID, primaryAddress, secondaryAddress); this.InitializeComponent(); } catch (Exception exception) { MessageBox.Show(exception.Message, "ERROR!"); } }
public frmGPIBCtrl() { this.cpGuiCtrl = new ObjectInterface(); try { this._GPIBCtrl = new GPIB_Mgr_Agilent_HP8648C(); this.InitializeComponent(); } catch (Exception exception) { MessageBox.Show(exception.Message, "ERROR!"); } }
public Level(GraphicsDevice graphicsDevice, String map, int[] whys, List<Wall> walls, ContentManager Content, UnitInterface sprite, ObjectInterface[] objects, PlayerActionsInterface actions) { //Load Properties this.graphicsDevice = graphicsDevice; this.mapTexture = Content.Load<Texture2D>(map); this.walls = walls; this.whys = whys; this.actions = actions; this.objects = objects; this.mainguy = sprite; this.boundary = false; mapName = map; batch = new SpriteBatch(graphicsDevice); font = Content.Load<SpriteFont>("cheese serif"); speed = 5; update(); }
public override ActionResult Perform() { ActionResult lResult = new ActionResult(false); Coordinate lNewPos = this.Actor.GetPos() + this.Dir; // check if there is anyone in the space Actor lTarget = this.Level.ActorGrid.GetItem(lNewPos); if (lTarget != null) { lResult.Alternate(new MeleeAttackAction(this.Actor, lTarget)); return(lResult); } //is it a door or something that can be opened ObjectInterface lObject = this.Level.ObjectGrid.GetItem(lNewPos); if (lObject != null) { if (!lObject.CanWalk()) { lResult.Alternate(lObject.DefaultAction(this.Actor)); return(lResult); } } //set new position this.Actor.SetPos(lNewPos); lResult.Success(); debug.Print("MoveAction: ", "Name:" + this.Actor.Stats.Name.ToString() + " pos:" + lNewPos.ToString() + " dir:" + this.Dir.ToString(), 20); Item lItem = this.Level.ItemGrid.GetItem(lNewPos); if (lItem != null) { lResult.Success("There is a " + lItem.GetName() + " on the floor here."); } else { lResult.Success(); } return(lResult); }
public void doWork() { if (hitInfo.collider == null && triggeredItem == null) { targetPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); targetPosition.y = transform.position.y; } else if (hitInfo.collider != null && triggeredItem == null) { if (hitInfo.collider.tag == "Untagged" || hitInfo.collider.tag == "Floor") { targetPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); targetPosition.y = transform.position.y; } else { Debug.Log("Hellor"); ObjectInterface obj = hitInfo.collider.gameObject.GetComponent <ObjectInterface>(); obj.Work(); } } else if (hitInfo.collider == null && triggeredItem != null) { triggeredItem = null; } else if (hitInfo.collider != null && triggeredItem != null) { if (hitInfo.collider.tag == "Untagged" || hitInfo.collider.tag == "Floor") { triggeredItem = null; } else { ObjectInterface obj = hitInfo.collider.gameObject.GetComponent <ObjectInterface>(); obj.ApplyItem(triggeredItem); triggeredItem = null; } } else { Debug.Log("Error"); } }
public ObjectDetails ImportTemplate(int lot, string objectName) { var template = ObjectInterface.Import(lot, out var error); if (template == null) { Debug.LogError(error); } var zoneObject = new GameObject(objectName); var objectDetails = zoneObject.AddOrGetComponent <ObjectDetails>(); objectDetails.Lot = lot; zoneObject.transform.parent = Scene.transform; template.transform.parent = zoneObject.transform; return(objectDetails); }
void Update() { if (Input.GetKeyDown(KeyCode.Mouse1)) { if (activeInv) { inventory.SetActive(false); activeInv = false; } else { inventory.SetActive(true); activeInv = true; } } if (Input.GetKeyDown(KeyCode.Mouse0)) { //Set up the new Pointer Event m_PointerEventData = new PointerEventData(m_EventSystem); //Set the Pointer Event Position to that of the mouse position m_PointerEventData.position = Input.mousePosition; //Create a list of Raycast Results List <RaycastResult> results = new List <RaycastResult>(); //RaycastResult results; //Raycast using the Graphics Raycaster and mouse click position m_Raycaster.Raycast(m_PointerEventData, results); //For every result returned, output the name of the GameObject on the Canvas hit by the Ray foreach (RaycastResult result in results) { Debug.Log(result.gameObject.tag); GameObject temp = result.gameObject; ObjectInterface obj = temp.GetComponent <ObjectInterface>(); obj.Work(); break; } } }
public static GameObject Import(string workingFile) { const float scale = 3.125f; using var stream = File.OpenRead(workingFile); using var reader = new BitReader(stream); var zone = new LuzFile(); zone.Deserialize(reader); return(null); var zoneInstance = new GameObject($"Zone {Path.GetFileName(workingFile)}"); var zoneDetails = zoneInstance.AddOrGetComponent <ZoneDetails>(); zoneDetails.ZoneName = Path.GetFileName(workingFile); zoneDetails.ZoneId = zone.WorldId; var spawnPoint = new GameObject("Zone Spawnpoint"); spawnPoint.transform.parent = zoneInstance.transform; spawnPoint.transform.position = new Vector3(zone.SpawnPoint.X, zone.SpawnPoint.Y, zone.SpawnPoint.Z); spawnPoint.transform.rotation = new Quaternion(zone.SpawnRotation.X, zone.SpawnRotation.Y, zone.SpawnRotation.Z, zone.SpawnRotation.W); zoneDetails.SpawnPoint = spawnPoint.transform; var sourceDir = Path.GetDirectoryName(workingFile) ?? WorkspaceControl.CurrentWorkspace.AssetPath; var terrain = TerrainInterface.Import(Path.Combine( sourceDir, zone.TerrainFileName) ); terrain.transform.parent = zoneInstance.transform; foreach (var sceneInfo in zone.Scenes) { var scenePath = Path.Combine(sourceDir, sceneInfo.FileName); var sceneInstance = new GameObject($"Scene {sceneInfo.SceneName} ({sceneInfo.SceneId}, {sceneInfo.LayerId})"); var sceneDetails = sceneInstance.AddOrGetComponent <SceneDetails>(); sceneInstance.transform.parent = zoneInstance.transform; using var lvlStream = File.OpenRead(scenePath); using var lvlReader = new BitReader(lvlStream); var lvl = new LvlFile(); lvl.Deserialize(lvlReader); sceneDetails.SceneName = sceneInfo.SceneName; sceneDetails.SceneLayer = sceneInfo.LayerId; sceneDetails.SkyBox = lvl.LevelSkyConfig == null ? sceneDetails.SkyBox : lvl.LevelSkyConfig.Skybox; if (lvl.LevelObjects == null) { continue; } foreach (var template in lvl.LevelObjects.Templates) { GameObject lwoObject; try { lwoObject = ObjectInterface.Import(template.Lot, out var error); if (lwoObject == null) { Debug.LogError(error); continue; } } catch (Exception e) { Debug.LogError(e); continue; } lwoObject.transform.parent = sceneInstance.transform; lwoObject.transform.position = new Vector3(template.Position.X, template.Position.Y, template.Position.Z); lwoObject.transform.rotation = new Quaternion(template.Rotation.X, template.Rotation.Y, template.Rotation.Z, template.Rotation.W); } } return(zoneInstance); }
public frmSPAzCtrl() { this.cpGuiCtrl = new ObjectInterface(); this._SPAzMgr = new SPAzMgr(0x378); this.InitializeComponent(); }
public frmConfiguration() { this.configGuiCtrl = new ObjectInterface(); this.currentDir = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\scripts"; this.InitializeComponent(); }
public static void loadScene() { string filename = Data.gameName; string dir = path + "\\" + filename; string load_string = ""; string filepath; int landscape_index = 0; filepath = dir + "\\scenes\\" + Data.sceneName; Debug.Log("loading file " + filepath); load_string = System.IO.File.ReadAllText(filepath); //clear the current data in game// //incase the file has nothing to load,return// if (load_string == "") { return; } ObjectInterface objInterface = GameObject.Find("GUI").GetComponent <ObjectInterface>(); load_string = load_string.Replace("\r", ""); string[] flags = load_string.Split('\n'); if (flags.Length == 0) { return; } for (int j = 0; j < flags.Length; j++) { string[] tokens = flags[j].Split('$'); if (tokens[0] == "#") { if (tokens[1] == "0") { continue; } landscape_index = Data.getFileIndex(tokens[1]); objInterface.placeLandscape(landscape_index); continue; } //retrieve the data and store in respective formats.// string name = tokens[0]; string scriptRef = tokens[1]; string objectType = tokens[2]; string model_name = tokens[3]; float posX = float.Parse(tokens[4]); float posY = float.Parse(tokens[5]); float posZ = float.Parse(tokens[6]); float rotX = float.Parse(tokens[7]); float rotY = float.Parse(tokens[8]); float rotZ = float.Parse(tokens[9]); float rotW = float.Parse(tokens[10]); float sclx = float.Parse(tokens[11]); float scly = float.Parse(tokens[12]); float sclz = float.Parse(tokens[13]); int model = Data.getFileIndex(model_name); //creating transform data from retrieved data.// Vector3 position = new Vector3(posX, posY, posZ); Quaternion rotation = new Quaternion(rotX, rotY, rotZ, rotW); Vector3 scale = new Vector3(sclx, scly, sclz); //pulling the script data from respective script files.// string script = System.IO.File.ReadAllText(dir + "\\" + scriptRef + ".txt"); //get objecttype and place the animal using object interface script.// ObjectType type = getObjectType(objectType); objInterface.placeObject(model, position, type); //setup rest of the data to initialize the object.// MainObject mainObject = Data.objects[Data.objects.Count - 1].GetComponent <MainObject>(); mainObject.script = script; mainObject.scriptRef = scriptRef; mainObject.nameO = name; mainObject.position = position; mainObject.rotation = rotation; mainObject.scale = scale; //set gameobjects parameters.// Data.objects[Data.objects.Count - 1].transform.position = position; Data.objects[Data.objects.Count - 1].transform.rotation = rotation; Data.objects[Data.objects.Count - 1].transform.localScale = scale; } Data.setAnimalsOnGround(); Data.activeObj = Data.objects.Count - 1; //updates the scene in game file string gameFilePath = dir + "\\_game"; System.IO.File.WriteAllText(gameFilePath, Data.sceneName); }
public OpenAction(Actor aActor, ObjectInterface aObject) { this.Actor = aActor; this.Object = aObject; }
public frmSPAzCtrl(int address) { this.cpGuiCtrl = new ObjectInterface(); this._SPAzMgr = new SPAzMgr(address); this.InitializeComponent(); }
public void objectInteract(ObjectInterface obj) { }
public void objectInteract(ObjectInterface piece) { }