//绘制战斗格子 void DrawBattleBlock(Vector3 pos, Color c, int x, int y) { //Debug.DrawRay(pos, Vector3.up, c, 1f); var parent = GameObject.Find("decal parent"); if (parent == null) { parent = new GameObject("decal parent"); } var obj = EasyDecal.Project(m_DecalPrefab, pos, Quaternion.identity); obj.transform.SetParent(parent.transform); obj.LateBake(); var bPos = new BattleBlockVector(x, y); var bbd = new BattleBlockData(); bbd.BattlePos = bPos; bbd.WorldPos = pos; bbd.gameObject = obj.gameObject; battleBlocks.Add(bbd); }
private void DrawBattleBlock(Vector3 pos, Color c, int x, int y) { var parent = FindOrCreateBlocksParent(); var obj = EasyDecal.Project(m_DecalPrefab, pos, Quaternion.identity); obj.transform.SetParent(parent.transform); //obj.LateBake(); //StartCoroutine(SetDecalsHidenFrames(obj)); var bPos = new BattleBlockVector(x, y); var bbd = new BattleBlockData(); bbd.BattlePos = bPos; bbd.WorldPos = pos; bbd.gameObject = obj.gameObject; battleBlocks.Add(bbd); }
//绘制战斗格子,默认不显示 void DrawBattleBlock(Vector3 pos, Color c, int x, int y, Vector3 normal, BattleboxBlock boxBlock) { var parent = FindOrCreateBlocksParent(); var block = Resources.Load <GameObject>("BattleboxBlock"); var obj = EasyDecal.Project(block, pos, Quaternion.identity); obj.Quality = 2; obj.Distance = 0.05f; obj.transform.SetParent(parent.transform, false); var bPos = new BattleBlockVector(x, y); var bbd = new BattleBlockData(); bbd.BattlePos = bPos; bbd.WorldPos = pos; bbd.gameObject = obj.gameObject; bbd.BoxBlock = boxBlock; battleBlocks.Add(bbd); }