/*~Person() * { * --count; * }*/ public Person(Vector2 position, Texture2D texture, floor f) : base(position, "Person", AIMode.Seek, f, null) { if (Texture == null) { Texture = texture; } }
public void makePrefab_() { // activate example 1 // m_Example1Manager.GoGoGo(); int I = 0; for (int i = 0; i < Game_Controller.Instance.ROWS; i++) { //bool check_row = true; for (int j = 0; j < Game_Controller.Instance.COLUMNS; j++) { floor sample = Instantiate(Game_Controller.Instance.Floor_Tile) as floor; sample.transform.position = this.transform.position + new Vector3(i * Game_Controller.Instance.HEIGHT, 0, j * Game_Controller.Instance.WIDTH); sample.transform.parent = aa_rootscene.transform; sample.transform.name = I.ToString(); sample.GetComponent <floor> ().I = i; sample.GetComponent <floor> ().J = j; sample.GetComponent <floor> ().ID = I; aa_rootscene.data.rows [i].col [j] = sample; I++; } } }
/* private void OnCollisionEnter(Collision collision) * { * clickSound.Play(); * }*/ void OnTriggerEnter(Collider col) { if (!colliders.Contains(col)) { colliders.Add(col); } if (gameOverScript.gameOver) { return; } if (!col.gameObject.GetComponent <MeshRenderer>().enabled) { fracture fractureScript = playerObject.GetComponent <fracture>(); floor floorScript = floorObject.GetComponent <floor>(); playerObject.GetComponent <Rigidbody>().isKinematic = false; playerObject.GetComponent <Rigidbody>().velocity = Random.onUnitSphere * floorScript.explodeSpeed * 10000; fractureScript.breakPlayer(); this.GetComponent <Rigidbody>().isKinematic = false; floorScript.collapseFloor(); //this.GetComponent<Rigidbody>().velocity = Random.onUnitSphere * floorScript.explodeSpeed; print("GAME OVER\n"); gameOverScript.gameOver = true; smokeObject.SetActive(false); } }
public animalSection(int numberOfFloors) { FloorsInSections = new List <floor>(); for (int i = 0; i < numberOfFloors; i++) { floor section = new floor(); FloorsInSections.Add(section); } }
public void CharacterSet(World w, floor f, int e, int h, int a, int s, GameObject g) { world = w; posx = f.x; posy = f.y; eyesight = e; health = h; attack = a; movespeed = s; obj = g; }
void OnTriggerStay(Collider other) { if (exploding > 0 && !nope) { floor floor = null; if ((floor = other.GetComponent <floor>()) != null) { floor.Drop(); } } }
private void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public SimObject(Vector2 Position, string name, AIMode action, floor f, Queue <SimEvent> Q) { if (Q != null && SEQ == null) { SEQ = Q; } Name = String.Format("{0}{1}", name, serial); ++serial; position = Position; Action = action; Fl = f; }
public bool Move(int direction) { int movedposx = 0; int movedposy = 0; this.direction = direction; switch (direction) { case 0: movedposx = 0; movedposy = 1; break; case 1: movedposx = 1; movedposy = 0; break; case 2: movedposx = 0; movedposy = -1; break; case 3: movedposx = -1; movedposy = 0; break; } floor f = world.GetFloor(posx + movedposx, posy + movedposy); if (f != null) { if (f.charontop == null) { world.GetFloor(posx, posy).charontop = null; posx += movedposx; posy += movedposy; world.GetFloor(posx, posy).charontop = this; obj.transform.Translate(movedposx, 0, movedposy); } else { f.charontop.health -= attack; if (f.charontop.health < 0) { world.Kill(f.charontop); } } return(true); } return(false); }
public void Make_Row(int ColIndex, int i) { floor sample = Instantiate(Game_Controller.Instance.Floor_Tile) as floor; sample.transform.position = Game_Controller.Instance.transform.position + new Vector3(i * Game_Controller.Instance.WIDTH, 0, ColIndex * Game_Controller.Instance.HEIGHT); sample.transform.parent = Game_Controller.Instance.transform.GetChild(0).transform; sample.GetComponent <floor> ().I = i; sample.GetComponent <floor> ().J = ColIndex; sample.GetComponent <floor> ().ID = i * Game_Controller.Instance.COLUMNS + ColIndex; Game_Controller.Instance.transform.GetChild(0).transform.GetComponent <aa_Scene_Maker>().data.rows [i].col [ColIndex] = sample; }
public void EnterHuXingFloor(CameraUniversalCenter camCenter, string floorName, CanveGroupFade triggerFastMoveSM, ScrollMenu fastMoveSM) { DisplayAllFloorMesh(); currentAtFloor.floorName = ""; foreach (floor f in allFloor) { if (f.floorName == floorName) { currentAtFloor = f; isMYing = true; camCenter.ChangeCamera(f.cameraUniversal, 0.5f); if (f.pointForMove2 != null && f.pointForMove2.Length > 0) { fastMoveSM.GetComponent <RectTransform>().DOAnchorPosY(60, 1); triggerFastMoveSM.AlphaPlayForward(); string[] displayGroup = new string[f.pointForMove2.Length]; string[] paraGroup = new string[f.pointForMove2.Length]; for (int i = 0; i < f.pointForMove2.Length; i++) { displayGroup[i] = f.pointForMove2[i].name; paraGroup[i] = i.ToString(); } fastMoveSM.CreateItemGroup(displayGroup, paraGroup); } else { fastMoveSM.GetComponent <RectTransform>().DOAnchorPosY(60, 1); triggerFastMoveSM.AlphaPlayBackward(); } } } }
void makePrefab_() { int I = 0; for (int i = 0; i < b_ROWS; i++) { //bool check_row = true; for (int j = 0; j < c_COLUMNS; j++) { floor sample = Instantiate(Floor_Tile) as floor; sample.transform.position = this.transform.position + new Vector3(i * WIDTH, 0, j * HEIGHT); sample.transform.parent = FloorBase.transform; sample.transform.name = I.ToString(); sample.GetComponent <floor>().I = i; sample.GetComponent <floor>().J = j; sample.GetComponent <floor>().ID = I; FloorBase.GetComponent <Floorbase>().data.rows[i].col[j] = sample; I++; } } }
public ResultHelper AddFloor(FloorDto floorDto) { try { floor item = new floor(); item.FloorID = floorDto.FloorID; item.Map = floorDto.Map; item.Name = floorDto.Name; item.Other = floorDto.Other; if (floorDto.BlockID == 0) { item.BlockID = null; } else { item.BlockID = floorDto.BlockID; } if (floorDto.BuildID == 0) { item.BuildID = null; } else { item.BuildID = floorDto.BuildID; } using (UnitOfWork unitofWork = new UnitOfWork()) { unitofWork.GetRepository <floor>().Insert(item); unitofWork.saveChanges(); return(new ResultHelper(true, item.FloorID, ResultHelper.SuccessMessage)); } } catch (Exception ex) { return(new ResultHelper(false, floorDto.FloorID, ResultHelper.UnSuccessMessage)); } }
public FloorDto GetFloor(int floorID) { try { using (UnitOfWork unitofWork = new UnitOfWork()) { floor item = new floor(); item = unitofWork.GetRepository <floor>().GetById(x => x.FloorID == floorID); FloorDto floorDto = new FloorDto(); floorDto.FloorID = item.FloorID; floorDto.Map = item.Map; floorDto.Name = item.Name; floorDto.Other = item.Other; if (item.BuildID != null) { floorDto.BuildID = item.BuildID.Value; } else { floorDto.BuildID = 0; } if (item.BlockID != null) { floorDto.BlockID = item.BlockID.Value; } else { floorDto.BlockID = 0; } return(floorDto); } } catch (Exception) { return(null); } }
private IFloor ToFloor(floor floor) { return(new Floor(floor.flrId, floor.flrName, floor.hallId)); }
public Client(construction_company guest_worker) { my_floor = guest_worker.lodges_floor(); my_wallpaper = guest_worker.glue_wallpaper(); }
public void setTarget(floor start, floor end) { this.Start_AStar = start; this.End_AStar = end; }
private IEnumerator thread_join() { float StartT = Time.realtimeSinceStartup; while (true) { //yield return new WaitForSeconds(1); yield return(null); bool full_thread_finished = true; for (int i = 0; i < Game_Controller.Instance.indexingEnemies.Length; i++) { if (!Game_Controller.Instance.indexingEnemies [i].finished_AStar) { full_thread_finished = false; } } if (full_thread_finished) { Debug.Log(" Thread Wait Over"); makeScene.GetComponent <Button>().interactable = true; myThread.Join(); break; } else { //Debug.Log ("Inside Thread Wait"); for (int i = 0; (i < Game_Controller.Instance.ROWS) && Game_Controller.Instance.z_bool_show_Astar; i++) { for (int j = 0; j < Game_Controller.Instance.COLUMNS; j++) { /* * if (Game_Controller.Instance.data.rows [i].col [j].Color_Flag == 2) * { * if(scene.GetComponent<rootScene> ().data.rows [i].col [j].transform.GetChild(0)!=null) * scene.GetComponent<rootScene> ().data.rows [i].col [j].transform.GetChild(0).GetComponent<Renderer> ().material.color = Color.red; * } * * if (Game_Controller.Instance.data.rows [i].col [j].Color_Flag == 3) * { * if(scene.GetComponent<rootScene> ().data.rows [i].col [j].transform.GetChild(0)!=null) * scene.GetComponent<rootScene> ().data.rows [i].col [j].transform.GetChild(0).GetComponent<Renderer> ().material.color = Color.yellow; * }*/ floor tile = scene.GetComponent <rootScene> ().data.rows [i].col [j]; int Child_Index = tile.ChildIDSelected; switch (Game_Controller.Instance.data.rows [i].col [j].Color_Flag) { case 1: // tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material.color = Color.yellow; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_S; break; case 2: //tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material.color = Color.red; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_E; break; case 3: // tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material.color = Color.green; if (tile.start_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_S; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.red; } else { if (tile.end_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_E; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.yellow; } else { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_C; } } break; case 4: //tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material.color = Color.magenta; //tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material =a_O; if (tile.start_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_S; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.green; } else { if (tile.end_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_E; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.blue; } else { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_O; } } break; case 5: //tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material.color = Color.cyan; //tile.transform.GetChild(Child_Index).GetComponent<Renderer> ().material = a_CurrentNode; if (tile.start_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_S; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.cyan; } else { if (tile.end_node) { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_E; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material.color = Color.magenta; } else { tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = a_CurrentNode; } } break; } } } } } for (int i = 0; i < Game_Controller.Instance.indexingEnemies.Length; i++) { for (int j = 0; j < Game_Controller.Instance.indexingEnemies[i].foundPath.Count; j++) { AStarNode astarnode = Game_Controller.Instance.indexingEnemies [i].foundPath [j]; floor tile = scene.GetComponent <rootScene> ().data.rows [astarnode.I].col [astarnode.J]; int Child_Index = tile.ChildIDSelected; tile.transform.GetChild(Child_Index).GetComponent <Renderer> ().material = Game_Controller.Instance.z_final_pathMaterial;; } } Proceed.GetComponent <Button>().interactable = true; float EndT = Time.realtimeSinceStartup; for (int threadIndex = 0; threadIndex < Game_Controller.Instance.indexingEnemies.Length; threadIndex++) { Game_Controller.Instance.indexingEnemies [threadIndex].aStarFinish_Time = EndT - StartT; } }
public void Save() { // 1. Get the SaveName; string scenarioName = ScenarioName.text; // 2. Get all the existing scenes from gamemanager. List <GameObject> AllScenes = null; if (gamemanager.name == "DesignSceneGameManager") { AllScenes = gamemanager.GetComponent <DesignSceneGameManager>().AllScenes; } // 3. Create a folder named with savename. WorkingDirectory = Application.persistentDataPath + "/" + scenarioName; // If there already exists a scenario with scenarioName, replace it with the new one. Therefore, // users should make sure not to use the same scenario name if (Directory.Exists(WorkingDirectory)) { Directory.Delete(WorkingDirectory, true); } Directory.CreateDirectory(WorkingDirectory); // 4. For each scene, do the followings foreach (GameObject Scene in AllScenes) { // 4.1 create a sub-folder with the scenarioName name WorkingDirectory = Application.persistentDataPath + "/" + scenarioName + "/" + Scene.name; Directory.CreateDirectory(WorkingDirectory); // 4.2 create a list to store all the names of the objects List <string> AllObjectNames = new List <string>(); // 4.3 Fill in the class SceneDetails according to the design of the scene SceneDetails sceneDetails = new SceneDetails(); sceneDetails.Walls = new List <wall>(); sceneDetails.Floors = new List <floor>(); sceneDetails.Ceilings = new List <ceiling>(); sceneDetails.Obstacles = new List <obstacle>(); sceneDetails.Doors = new List <door>(); sceneDetails.Fires = new List <fire>(); sceneDetails.Pedestrians = new List <pedestrian>(); sceneDetails.Players = new List <player>(); // 4.3.1 Fill in the simulation info sceneDetails.SimTime = Scene.GetComponent <SceneInfo>().SimulationTime; sceneDetails.Width = Scene.GetComponent <SceneInfo>().Width; sceneDetails.Length = Scene.GetComponent <SceneInfo>().Length; sceneDetails.Height = Scene.GetComponent <SceneInfo>().Height; sceneDetails.PlayerX = Scene.GetComponent <SceneInfo>().PlayerX; sceneDetails.PlayerY = Scene.GetComponent <SceneInfo>().PlayerY; // 4.3.2 fill in the info of different objects into sceneDetails foreach (Transform ChildObjectTransform in Scene.transform) { // Wall and its doors if (ChildObjectTransform.tag == "Wall") { wall WallInfo = new wall(); Wall wallinfo = ChildObjectTransform.gameObject.GetComponent <Wall>(); AllObjectNames.Add(wallinfo.Name); WallInfo.NameIndex = AllObjectNames.Count - 1; WallInfo.xpos = wallinfo.x_pos; WallInfo.ypos = wallinfo.y_pos; WallInfo.zrot = wallinfo.z_rot; WallInfo.Width = wallinfo.Width; WallInfo.Height = wallinfo.Height; WallInfo.Opacity = wallinfo.Opacity; sceneDetails.Walls.Add(WallInfo); // doors that are attached to it foreach (Transform doorTransform in ChildObjectTransform) { if (doorTransform.tag == "Door") { door DoorInfo = new door(); Door doorinfo = doorTransform.gameObject.GetComponent <Door>(); AllObjectNames.Add(doorinfo.Name); DoorInfo.NameIndex = AllObjectNames.Count - 1; DoorInfo.RelativePosition = doorinfo.RelativePosition; DoorInfo.Width = doorinfo.Width; DoorInfo.Height = doorinfo.Height; if (doorinfo.Open) { DoorInfo.Open = 1; } else { DoorInfo.Open = 0; } DoorInfo.WallNameIndex = WallInfo.NameIndex; AllObjectNames.Add(doorinfo.NextScene.name); DoorInfo.SceneNameIndex = AllObjectNames.Count - 1; sceneDetails.Doors.Add(DoorInfo); } } } // Floor else if (ChildObjectTransform.tag == "Floor") { floor FloorInfo = new floor(); Floor floorinfo = ChildObjectTransform.gameObject.GetComponent <Floor>(); AllObjectNames.Add(floorinfo.Name); FloorInfo.NameIndex = AllObjectNames.Count - 1; FloorInfo.xpos = floorinfo.x_pos; FloorInfo.ypos = floorinfo.y_pos; FloorInfo.Width = floorinfo.Width; FloorInfo.Length = floorinfo.Length; sceneDetails.Floors.Add(FloorInfo); } // Ceiling else if (ChildObjectTransform.tag == "Ceiling") { ceiling CeilingInfo = new ceiling(); Ceiling ceilinginfo = ChildObjectTransform.gameObject.GetComponent <Ceiling>(); AllObjectNames.Add(ceilinginfo.Name); CeilingInfo.NameIndex = AllObjectNames.Count - 1; CeilingInfo.xpos = ceilinginfo.x_pos; CeilingInfo.ypos = ceilinginfo.y_pos; CeilingInfo.zpos = ceilinginfo.z_pos; CeilingInfo.Width = ceilinginfo.Width; CeilingInfo.Length = ceilinginfo.Length; CeilingInfo.Opacity = ceilinginfo.Opacity; sceneDetails.Ceilings.Add(CeilingInfo); } // Obstacle else if (ChildObjectTransform.tag == "Obstacle") { obstacle ObstacleInfo = new obstacle(); Obstacle obstacleinfo = ChildObjectTransform.gameObject.GetComponent <Obstacle>(); AllObjectNames.Add(obstacleinfo.Name); ObstacleInfo.NameIndex = AllObjectNames.Count - 1; ObstacleInfo.xpos = obstacleinfo.x_pos; ObstacleInfo.ypos = obstacleinfo.y_pos; ObstacleInfo.Width = obstacleinfo.Width; ObstacleInfo.Length = obstacleinfo.Length; ObstacleInfo.Height = obstacleinfo.Height; ObstacleInfo.Opacity = obstacleinfo.Opacity; sceneDetails.Obstacles.Add(ObstacleInfo); } // Fire else if (ChildObjectTransform.tag == "Fire") { fire FireInfo = new fire(); Fire fireinfo = ChildObjectTransform.gameObject.GetComponent <Fire>(); AllObjectNames.Add(fireinfo.Name); FireInfo.NameIndex = AllObjectNames.Count - 1; FireInfo.xpos = fireinfo.x_pos; FireInfo.ypos = fireinfo.y_pos; FireInfo.zpos = fireinfo.z_pos; FireInfo.Width = fireinfo.Width; FireInfo.Length = fireinfo.Length; FireInfo.HRRPUA = fireinfo.HRRPUA; FireInfo.CO_YIELD = fireinfo.CO_YIELD; FireInfo.SOOT_YIELD = fireinfo.SOOT_YIELD; FireInfo.Fuel = Array.IndexOf(fireinfo.Fuels, fireinfo.FUEL); sceneDetails.Fires.Add(FireInfo); } // Pedestrian else if (ChildObjectTransform.tag == "Pedestrian") { pedestrian PedestrianInfo = new pedestrian(); Pedestrian pedestrianinfo = ChildObjectTransform.gameObject.GetComponent <Pedestrian>(); AllObjectNames.Add(pedestrianinfo.Name); PedestrianInfo.NameIndex = AllObjectNames.Count - 1; PedestrianInfo.xpos = pedestrianinfo.x_pos; PedestrianInfo.ypos = pedestrianinfo.y_pos; PedestrianInfo.Speed = pedestrianinfo.Speed; PedestrianInfo.Health = pedestrianinfo.Health; AllObjectNames.Add(pedestrianinfo.Exit.name); PedestrianInfo.ExitNameIndex = AllObjectNames.Count - 1; sceneDetails.Pedestrians.Add(PedestrianInfo); } else if (ChildObjectTransform.tag == "Player") { player PlayerInfo = new player(); Player playerinfo = ChildObjectTransform.gameObject.GetComponent <Player>(); AllObjectNames.Add(playerinfo.Name); PlayerInfo.NameIndex = AllObjectNames.Count - 1; PlayerInfo.xpos = playerinfo.x_pos; PlayerInfo.ypos = playerinfo.y_pos; PlayerInfo.Speed = playerinfo.Speed; PlayerInfo.Health = playerinfo.Health; sceneDetails.Players.Add(PlayerInfo); } } // 4.4 Save AllObjectNames into a text file StreamWriter NamesTxtFile = new StreamWriter(WorkingDirectory + "/AllNames.txt"); foreach (string name in AllObjectNames) { NamesTxtFile.WriteLine(name); } NamesTxtFile.Close(); // 4.5 Save sceneDetails into a binary file, SceneDetails.dat BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(WorkingDirectory + "/SceneDetails.dat", FileMode.OpenOrCreate); bf.Serialize(file, sceneDetails); file.Close(); } }
/// <summary> /// Takes the floor of each component in the given vec2. /// </summary> public static vec2 floor(in vec2 o) => new vec2(floor(o.x), floor(o.y));
/// <summary> /// Takes the floor of each component in the given vec3. /// </summary> public static vec3 floor(in vec3 o) => new vec3(floor(o.x), floor(o.y), floor(o.z));
/// <summary> /// Takes the floor of each component in the given dvec3. /// </summary> public static dvec3 floor(in dvec3 o) => new dvec3(floor(o.x), floor(o.y), floor(o.z));
/// <summary> /// Takes the floor of each component in the given dvec2. /// </summary> public static dvec2 floor(in dvec2 o) => new dvec2(floor(o.x), floor(o.y));