public void SetDragEndPos(GroundTile gt) { Collider.enabled = true; Tr.position = GetVector3(gt); ShowBtns(true); ShowPutBuildBtns(true, BuildJd.Type == BuildType.Decorate ? 4 : 2); }
public void PutBuild(GroundTile gt, List <GroundTile> GTs) { SetAlpha(false); foreach (var GroundTile in myGroundTiles) { GroundTile.RemoveBuild(this); } foreach (var GT in myGroundTiles) { GT.CheckError(); } myGroundTiles.Clear(); myGroundTiles.AddRange(GTs); foreach (var GT in GTs) { GT.AddBuild(this); } foreach (var GT in myGroundTiles) { GT.CheckError(); } Tr.position = GetVector3(gt); if (BuildData != null) { BuildData.PosX = gt.X; BuildData.PosY = gt.Z; } //Tr.localPosition =new Vector3(0, 0.00437f * (300 - SpIcon.sprite.rect.height),0) + GetVector3(gt.transform.localPosition); }
public bool CheckCanPut(GroundTile gt, List <GroundTile> GTs) { _testGroundTiles.Clear(); _testGroundTiles.AddRange(GTs); foreach (var GT in GTs) { GT.SetfalseGT(this); } foreach (var GT in _testGroundTiles) { GT.CheckCanPut(); } if (_testGroundTiles.Count != 0) { var tileHight = _testGroundTiles[0].Y; foreach (var GT in _testGroundTiles) { if (_testGroundTiles.Count < _needGtConut) { return(false); } if (!GT.Unlock) { return(false); } if (!GT.UseAble) { return(false); } if (tileHight != GT.Y) { return(false); } if (GT.CheckBuildList.Count > 1) { return(false); } } } return(true); }
public Vector3 GetVector3(GroundTile gt) { var pos = gt.transform.position; if (BuildJd.Type == BuildType.Base) { return(new Vector3(2.465f + pos.x, 0.84f + pos.y, -15 - gt.X + 0.1f * gt.Z)); } else if (BuildJd.Type == BuildType.Decorate) { return(new Vector3(pos.x, 0.555f + pos.y, -15 - gt.X + 0.1f * gt.Z)); } else { return(new Vector3(0.6f + pos.x, 0.8f + pos.y, -15 - gt.X + 0.1f * gt.Z)); } }