public void SetWallLife(WallInfo Info, LifeEnvironment Environment) { if (Info == null) { return; } }
public CellDirType GetGapWallDir(CellInfo cellInfo) { WallInfo gapWall = GetNeighborWallByDir(cellInfo, CellDirType.up); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.up); } gapWall = GetNeighborWallByDir(cellInfo, CellDirType.right_up); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.right_up); } gapWall = GetNeighborWallByDir(cellInfo, CellDirType.right_down); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.right_down); } gapWall = GetNeighborWallByDir(cellInfo, CellDirType.down); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.down); } gapWall = GetNeighborWallByDir(cellInfo, CellDirType.left_down); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.left_down); } gapWall = GetNeighborWallByDir(cellInfo, CellDirType.left_up); if (gapWall != null && gapWall.IsNull()) { return(CellDirType.left_up); } return(CellDirType.no); }
public virtual void setWallData(WallInfo wallInfo) { maxHealth = wallInfo.maxHealth; currentHealth = wallInfo.maxHealth >= wallInfo.currentHealth ? wallInfo.currentHealth : wallInfo.maxHealth; setHealthText(); // rotate by init angle initAngle = wallInfo.initAngle; transform.Rotate(0, 0, -initAngle); initPosition = wallInfo.initPosition.GetV3(); type = wallInfo.type; if (wallInfo.movement == null || wallInfo.movement.speed <= 0) { GetComponent <WallMovement>().enabled = false; } else { GetComponent <WallMovement>().enabled = true; GetComponent <WallMovement>().SetMovementData(wallInfo.movement); } if (wallInfo.rotate == null || wallInfo.rotate.speed <= 0) { GetComponent <WallRotate>().enabled = false; } else { GetComponent <WallRotate>().enabled = true; GetComponent <WallRotate>().SetRotateData(wallInfo.rotate); } }
// Start is called before the first frame update void Start() { var topWall = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth / 2, cam.pixelHeight, 1)); var bottomWall = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth / 2, 0, 1)); var leftWall = cam.ScreenToWorldPoint(new Vector3(0, cam.pixelHeight / 2, 1)); var rightWall = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth, cam.pixelHeight / 2, 1)); float wallWidth = 2.81f; // (float)(cam.pixelWidth / 9.46); float wallHeight = 2.1f; // (float)(cam.pixelHeight / 9.57); top = new WallInfo(topWall, wallWidth, wallThickness, new Vector2(0, gravity), new Vector3(0, 0, -180)); bottom = new WallInfo(bottomWall, wallWidth, wallThickness, new Vector2(0, -gravity), new Vector3(0, 0, 0)); left = new WallInfo(leftWall, wallThickness, wallHeight, new Vector2(-gravity, 0), new Vector3(0, 0, -90)); right = new WallInfo(rightWall, wallThickness, wallHeight, new Vector2(gravity, 0), new Vector3(0, 0, 90)); possibleWalls.Add(top); possibleWalls.Add(bottom); possibleWalls.Add(left); possibleWalls.Add(right); Physics2D.gravity = new Vector2(0, 0); currentWall = left; transform.localPosition = currentWall.position; transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); rocket.transform.rotation = Quaternion.Euler(currentWall.mPlayerRotation); isUpdatingWorld = true; }
public void GenerateWalls() { _playHelper = GetComponent <PlayAreaHelper>(); Walls = new WallInfo[4]; Vector3[] positions = { _playHelper.FrontCenter, _playHelper.BackCenter, _playHelper.RightCenter, _playHelper.LeftCenter }; Vector3[] lookRotations = { Vector3.back, Vector3.forward, Vector3.left, Vector3.right }; WallDir[] dirs = { WallDir.Front, WallDir.Back, WallDir.Right, WallDir.Left }; for (int i = 0; i < 4; i++) { GameObject newWall = Instantiate(WallPrefab); WallInfo info = newWall.GetComponent <WallInfo>(); if (info != null) { Vector3 wallCenter = positions[i]; wallCenter.y = WallHeight / 2; newWall.transform.rotation = Quaternion.LookRotation(lookRotations[i]); newWall.transform.parent = this.transform; float width = _playHelper.PlaySpaceRect.width; if (i >= 2) { width = _playHelper.PlaySpaceRect.height; } info.SetWallProperties(wallCenter, width, WallHeight, dirs[i]); Walls[i] = info; } } }
public override void Init(int SceneID, LifeMCore Core, Life Parent) { WallType type = WallType.Normal; if (Parent == null) { return; } if (Parent is IggWall) { type = (Parent as IggWall).m_WallType; } base.Init(SceneID, Core, Parent); WallInfo info = WallM.GetWallData(type, Core.m_DataID); if (info == null) { return; } m_StartPos.Unit = info.m_cx; m_StartPos.Layer = info.m_cy; m_Size = 2; m_FullHp = info.m_hp; m_IsDamage = true; m_wood = info.m_wood; m_stone = info.m_stone; m_steel = info.m_steel; m_phy_defend = info.m_phydefned; m_magic_defend = info.m_magicdefend; m_DoorState = false; }
public Wall(Vector3 position, WallDirection direction, WallInfo info) { this.Length = 1; this.Info = info; this.buildingPosition = position; this.direction = direction; }
//是否为边界强 private static bool IsBorderWall(WallInfo Info) { if (Info == null) { return(false); } return(MapSize.IsBorder(Info.m_cy, Info.m_cx)); }
public CellAnimInfo Invade() { if (blocked == true) { blocked = false; return(null); } List <CellAnimInfo> waitList = new List <CellAnimInfo>(); int i; for (i = 0; i < CellModel.Instance.allCells.Count; i++) { List <CellInfo> xCells = CellModel.Instance.allCells[i]; for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; if (cellInfo.isBlank == false && (cellInfo.config.id == invadeId || cellInfo.config.hide_id == invadeId)) { List <CellInfo> neighbors = CellModel.Instance.GetNeighbors(cellInfo); for (int n = 0; n < neighbors.Count; n++) { CellInfo neighbor = neighbors[n]; if (neighbor != null && neighbor.isBlank == false && neighbor.posY >= 0 && CoverModel.Instance.AbsorbLine(neighbor.posX, neighbor.posY) == false) { if (neighbor.config.cell_type == (int)CellType.five && neighbor.isMonsterHold == false) { WallInfo wall = WallModel.Instance.GetWall(cellInfo, neighbor); if (wall.IsNull()) { //Debug.Log("find"); CellAnimInfo cellAnim = new CellAnimInfo(); cellAnim.fromInfo = cellInfo; cellAnim.toInfo = neighbor; waitList.Add(cellAnim); } } } } } } } if (waitList.Count > 0) { int rangeIndex = Random.Range(0, waitList.Count); CellAnimInfo cellAnim = waitList[rangeIndex]; cellAnim.toInfo.changer = 0; cellAnim.toInfo.SetConfig(invadeId); return(cellAnim); } return(null); }
public void AddAnim(WallInfo wallInfo, CellAnimType animationType = CellAnimType.move) { List <WallAnimInfo> stepMoves = anims[anims.Count - 1]; WallAnimInfo moveInfo = new WallAnimInfo(); moveInfo.startFrame = anims.Count; moveInfo.toInfo = wallInfo; stepMoves.Add(moveInfo); }
public bool CanLine(CellInfo fromCell, CellInfo toCell) { WallInfo wall = GetWall(fromCell, toCell); if (wall == null) { return(false); } return(wall.CanLine()); }
public WallInfo(WallInfo other) { this.type = other.type; this.initPosition = other.initPosition; this.initAngle = other.initAngle; this.currentHealth = other.currentHealth; this.maxHealth = other.maxHealth; this.movement = other.movement; this.rotate = other.rotate; }
protected void InitWalls() { if (level.walls == null) { return; } for (var i = 0; i < level.walls.Count; i++) { WallInfo wallInfo = level.walls[i]; WallManager.Instance.CreateWall(wallInfo); } }
public static void DumpNewWalls() { Dictionary <int, WallInfo> walls = Global.Instance.Info.Walls; WallInfo wi; Map useMap = new Map(); useMap.wall(true); String tileXML; FileStream stream = new FileStream("newWallXML.txt", FileMode.Create); StreamWriter writer = new StreamWriter(stream); string[] wallNames = null; // Enum.GetNames(typeof(MoreTerra.Enums.WallEnum)); for (int i = 1; i <= 224; i++) { useMap.type = (byte)i; if (!walls.TryGetValue(i, out wi)) { wi = new WallInfo(); wi.name = wallNames[i]; wi.wallImage = i; wi.colorName = "Unknown"; } tileXML = " <wall "; if (wi.name != null) { tileXML = tileXML + "name=\"" + wi.name + "\" "; } tileXML = tileXML + "wallImage=\"" + i + "\" "; if (!String.IsNullOrEmpty(wi.colorName)) { tileXML = tileXML + "color=\"" + wi.colorName + "\" "; } else { tileXML = tileXML + String.Format("color=\"#{0:X2}{1:X2}{2:X2}\" ", wi.color.R, wi.color.G, wi.color.B); } OfficialColor c = useMap.tileColor(0); tileXML = tileXML + String.Format("officialColor=\"#{0:X2}{1:X2}{2:X2}\" ", c.R, c.G, c.B); tileXML = tileXML + "/>"; // <wall name="Blue Dungeon Brick" wallImage="7" unsafe="true" color="Wall Dungeon Blue" /> writer.WriteLine(tileXML); } writer.Close(); }
public static bool IsWall(int ID) { WallInfo Info = GetWallData(ID); if (Info == null) { return(false); } else { return(true); } }
void UpdateWall(WallInfo wallinfo) { wallInfo = wallinfo; if (wallInfo.EMeshFilter == null) { wallInfo.EMeshFilter = GetComponent <MeshFilter>(); } if (wallInfo.EMeshFilter.mesh != null) { DestroyImmediate(wallInfo.EMeshFilter.mesh); } wallInfo.EMeshFilter.mesh = MeshCreate.CreateQuadMesh(); }
private void swap(WallInfo s) { this.m_id = s.m_id; this.m_cx = s.m_cx; this.m_cy = s.m_cy; this.m_phydefned = s.m_phydefned; this.m_magicdefend = s.m_magicdefend; this.m_hp = s.m_hp; this.m_w = s.m_w; this.m_wood = s.m_wood; this.m_stone = s.m_stone; this.m_steel = s.m_steel; }
public String insertFollowInfo(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("insert into [snehav27].[FollowInfo] (Follower,Followed,FollowDate) values(@follower,@followed,@followDate)", con); cmd.Parameters.AddWithValue("@follower", wi.authorusername); cmd.Parameters.AddWithValue("@followed", wi.ownerUsername); cmd.Parameters.AddWithValue("@followDate", DateTime.Now); cmd.ExecuteNonQuery(); con.Close(); return("success"); }
public String unFollow(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("DELETE FROM [snehav27].[FollowInfo] WHERE Follower = @follower and Followed = @followed", con); cmd.Parameters.AddWithValue("@follower", wi.authorusername); cmd.Parameters.AddWithValue("@followed", wi.ownerUsername); cmd.ExecuteNonQuery(); con.Close(); return("success"); }
public void Initialise(WallInfo info) { xGatePosition = info.xGatePosition; xGateWidth = info.xGateWidth; yMapPosition = info.yMapPosition; hasGate = info.hasGate; numPlayersPast = 0; for (int i = 0; i < (int)Enum.kMaxPlayersPerGame; i++) { passedBy[i] = false; } numGates = 0; }
void UpdateTheWall() { if (!rocket) { return; } currentWall = getRandomWallPosition(); transform.localPosition = currentWall.position; transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); rocket.transform.rotation = Quaternion.Euler(currentWall.mPlayerRotation); }
private IEnumerator VWalls(List <WallInfo> cells) { yield return(null); while (cells.Count > 0) { WallInfo cell = cells[0]; cells.RemoveAt(0); gridManager.SetWall(cell.node.x, cell.node.y, cell.wall); yield return(new WaitForSeconds(wallTime)); } }
public void RollCut(int cutNum) { crtBattle.RollCut(cutNum); int i; for (i = 0; i < cutNum; i++) { MonsterModel.Instance.allMonsters.RemoveAt(0); FloorModel.Instance.allFloors.RemoveAt(0); CellModel.Instance.allCells.RemoveAt(0); WallModel.Instance.allWalls.RemoveAt(0); CoverModel.Instance.allCovers.RemoveAt(0); } for (i = 0; i < crtBattle.battle_height; i++) { List <MonsterInfo> yMonsters = MonsterModel.Instance.allMonsters[i]; List <FloorInfo> yFloors = FloorModel.Instance.allFloors[i]; List <CellInfo> yCells = CellModel.Instance.allCells[i]; List <List <WallInfo> > yWalls = WallModel.Instance.allWalls[i]; List <CoverInfo> yCovers = CoverModel.Instance.allCovers[i]; for (int j = 0; j < crtBattle.battle_width; j++) { MonsterInfo monsterInfo = yMonsters[j]; monsterInfo.posY -= cutNum; FloorInfo floorInfo = yFloors[j]; floorInfo.posY -= cutNum; CellInfo cellInfo = yCells[j]; cellInfo.posY -= cutNum; List <WallInfo> xWalls = yWalls[j]; for (int n = 0; n < xWalls.Count; n++) { WallInfo wallInfo = xWalls[n]; wallInfo.posY -= cutNum; } CoverInfo coverInfo = yCovers[j]; coverInfo.posY -= cutNum; } } SkillModel.Instance.InitFightingEntitys(); }
public DataSet fetchFollowingInfo(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("select * from [snehav27].[FollowInfo] where Follower =@follower Order By FollowDate desc", con); // var username = Request.QueryString["username"].ToString(); cmd.Parameters.Add("@follower", wi.ownerUsername.Trim()); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); return(ds); }
public DataSet fetchWallInfo(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("select * from [snehav27].[UserWallPosts] where ownerusername =@ownerusername Order By PostedDate desc", con); // var username = Request.QueryString["username"].ToString(); cmd.Parameters.Add("@ownerusername", wi.ownerUsername); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); return(ds); }
public DataSet getCommentsCreatedByUser(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("select top 5 * from [snehav27].[Comments] where CommentUserName =@CommentUserName Order By CommentDateTime desc", con); // var username = Request.QueryString["username"].ToString(); cmd.Parameters.Add("@CommentUserName", wi.ownerUsername.Trim()); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); return(ds); }
public String insertDataOnWall(WallInfo wi) { SqlConnection con = new SqlConnection(connstring); con.Open(); SqlCommand cmd = new SqlCommand("insert into [snehav27].[UserWallPosts] (UserName,OwnerUserName,Subject,Comment,PostedDate) values(@userName,@ownerUserName,@subject,@comment,@postedDate)", con); cmd.Parameters.AddWithValue("@userName", wi.authorusername); cmd.Parameters.AddWithValue("@ownerUserName", wi.ownerUsername); cmd.Parameters.AddWithValue("@subject", wi.subject); cmd.Parameters.AddWithValue("@comment", wi.comment); cmd.Parameters.AddWithValue("@postedDate", DateTime.Now); cmd.ExecuteNonQuery(); con.Close(); return("success"); }
private static CellInfo FindSlider(CellInfo blank) { CellInfo findCell = null; int humpOff = blank.IsHump() ? -1 : 0; int slidOff = CellInfo.SORT_FLAG; findCell = CellModel.Instance.GetCellByPos(blank.posX + slidOff, blank.posY + humpOff); WallInfo slidWall = WallModel.Instance.GetWallByPos(blank.posY, blank.posX, 1 + slidOff); if (findCell == null || !findCell.CanMove() || !slidWall.CanPass()) { findCell = CellModel.Instance.GetCellByPos(blank.posX - slidOff, blank.posY + humpOff); return(findCell); } return(findCell); }
public WallInfo Copy() { WallInfo wallInfo = new WallInfo(); wallInfo.runId = runId; wallInfo.configId = configId; //if (config != null) //{ // wallInfo.config = (config_wall_item)config.Copy(); //} wallInfo.config = config; wallInfo.life = life; wallInfo.posX = posX; wallInfo.posY = posY; wallInfo.posN = posN; return(wallInfo); }
private static void CombinWall(WallInfo Wall1, WallInfo Wall2, ref bool ret) { ret = false; //合并规则。相邻或重叠的墙进行合并。 int dis = Wall1.m_cx - Wall2.m_cx; dis = Mathf.Abs(dis); //合并墙体 if (Wall1.m_cy == Wall2.m_cy && dis <= 1) { ret = true; } else { ret = false; } }
public void InitForWall(WallInfo wall, bool whichSide) { if (wall.isNorthSouth) { if (whichSide) rotMat = Quaternion.Euler(new Vector3(0f, 0f, 90f)); else rotMat = Quaternion.Euler(new Vector3(0f, 0f, -90f)); } else { if (whichSide) rotMat = Quaternion.Euler(new Vector3(90f, 0f, 0f)); else rotMat = Quaternion.Euler(new Vector3(-90f, 0f, 0f)); } upDir = rotMat * new Vector3(0,1f,0); widthDir = rotMat * new Vector3(1f,0,0); lengthDir = rotMat * new Vector3(0,0,1f); anchorType = GeneratablePrefab.AttachAnchor.Wall; // TODO: Adjust dimensions and corner pos }
private void createParishWall(WallInfo[] wallInfos) { this.origWallInfo = wallInfos; List<WallInfo> list = new List<WallInfo>(); this.wallList.Clear(); foreach (WallInfo info in wallInfos) { if (info.entryType == 1) { bool flag = false; foreach (WallInfo info2 in list) { if (info2.userID == info.userID) { flag = true; info2.fData1 += info.fData1; info2.data4 += info.data4; } } if (!flag) { WallInfo item = new WallInfo { data1 = info.data1, data2 = info.data2, data3 = info.data3, data4 = info.data4, fData1 = info.fData1, entryType = info.entryType, userID = info.userID, username = info.username }; list.Add(item); this.wallList.Add(item); } } else { this.wallList.Add(info); } } this.updateWallArea(); }