public void TurnOffTile(CCGridSize pos) { var coords = new CCQuad3(); //memset(&coords, 0, sizeof(ccQuad3)); SetTile(pos, ref coords); }
/// <summary> /// sets a new tile /// </summary> public void SetTile(CCGridSize pos, ref CCQuad3 coords) { int idx = (m_sGridSize.Y * pos.X + pos.Y) * 4; CCV3F_T2F[] vertArray = m_pVertices; vertArray[idx + 0].vertices = coords.BottomLeft; vertArray[idx + 1].vertices = coords.BottomRight; vertArray[idx + 2].vertices = coords.TopLeft; vertArray[idx + 3].vertices = coords.TopRight; m_bDirty = true; }
public override void TransformTile(CCGridSize pos, float distance) { CCQuad3 coords = OriginalTile(pos); CCPoint step = m_pTarget.Grid.Step; float dy = (step.Y / 2) * (1.0f - distance); coords.BottomLeft.Y += dy; // (step.Y / 2) * (1.0f - distance); coords.BottomRight.Y += dy; // (step.Y / 2) * (1.0f - distance); coords.TopLeft.Y -= dy; // (step.Y / 2) * (1.0f - distance); coords.TopRight.Y -= dy; // (step.Y / 2) * (1.0f - distance); SetTile(pos, ref coords); }
public override void Update(float time) { int i, j; for (i = 0; i < m_sGridSize.X; i++) { for (j = 0; j < m_sGridSize.Y; j++) { CCQuad3 coords = OriginalTile(new CCGridSize(i, j)); coords.BottomLeft.Z = ((float)Math.Sin(time * (float)Math.PI * m_nWaves * 2 + (coords.BottomLeft.Y + coords.BottomLeft.X) * .01f) * m_fAmplitude * m_fAmplitudeRate); coords.BottomRight.Z = coords.BottomLeft.Z; coords.TopLeft.Z = coords.BottomLeft.Z; coords.TopRight.Z = coords.BottomLeft.Z; SetTile(new CCGridSize(i, j), ref coords); } } }
public void SetTile(CCGridSize pos, ref CCQuad3 coords) { m_pGrid.SetTile(pos, ref coords); }
public void TurnOnTile(CCGridSize pos) { CCQuad3 orig = OriginalTile(pos); SetTile(pos, ref orig); }