private bool isFaceWall(FaceMode faceMode, bool isFaceLeft) { float deep = 8f; Vector2 startPosition = new Vector2(), position = this.transform.position; switch (faceMode) { case FaceMode.bodyFace: startPosition = new Vector2(position.x, position.y - 1.5f); // new Vector2 (position.x, position.y); break; case FaceMode.headFace: startPosition = new Vector2(position.x, position.y + 8f); break; case FaceMode.footFace: startPosition = new Vector2(position.x, position.y - 15.5f); break; } if (!isFaceLeft) { RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.right, deep, groundLayerMask | interactiveLayerMask); Debug.DrawLine(startPosition, new Vector2(startPosition.x + deep, startPosition.y), Color.red); return(hit.collider == null); } else { RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.left, deep, groundLayerMask | interactiveLayerMask); Debug.DrawLine(startPosition, new Vector2(startPosition.x - deep, startPosition.y), Color.red); return(hit.collider == null); } }
public void Load(IntPtr handle) { faceMode = (FaceMode)BrowserInterop.vtsGetMeshFaceMode(handle); Util.CheckError(); IntPtr bufPtr; uint bufSize; BrowserInterop.vtsGetMeshIndices(handle, out bufPtr, out bufSize, out indicesCount); Util.CheckError(); if (indicesCount > 0) { short[] tmp = new short[indicesCount]; Marshal.Copy(bufPtr, tmp, 0, (int)indicesCount); indices = new ushort[indicesCount]; Buffer.BlockCopy(tmp, 0, indices, 0, (int)indicesCount * 2); } BrowserInterop.vtsGetMeshVertices(handle, out bufPtr, out bufSize, out verticesCount); Util.CheckError(); vertices = new byte[bufSize]; Marshal.Copy(bufPtr, vertices, 0, (int)bufSize); attributes = new List <VertexAttribute>(4); for (uint i = 0; i < 4; i++) { VertexAttribute a; uint type; BrowserInterop.vtsGetMeshAttribute(handle, i, out a.offset, out a.stride, out a.components, out type, out a.enable, out a.normalized); Util.CheckError(); a.type = (GpuType)type; attributes.Add(a); } }
/// <summary> /// Adjust the GraphicsDevice's render state to render the faces in a faceMode. /// </summary> public static void BeginFaceMode(this GraphicsDevice device, FaceMode faceMode) { switch (faceMode) { case FaceMode.FrontFaces: device.RenderState.CullMode = CullMode.CullCounterClockwiseFace; break; case FaceMode.BackFaces: device.RenderState.CullMode = CullMode.CullClockwiseFace; break; case FaceMode.AllFaces: device.RenderState.CullMode = CullMode.None; break; } }
public void ChangeImage(FaceMode mode) { View.SetActive(false); switch (mode) { case FaceMode.Normal: View = Normal; break; case FaceMode.Win: View = Win; break; default: View = Lose; break; } View.SetActive(true); }
public virtual bool Serialize(ref object writer) { if (writer is JObject) { JObject jmat = writer as JObject; jmat.Add("Blend", BlendMode.ToString()); //jmat.Add("Texture", Texture.Keyname); jmat.Add("DepthTest", IsDepthTest); jmat.Add("Face", FaceMode.ToString()); jmat.Add("LinkedSubset", LinkedSubsetName.ToLower()); jmat.Add("DiffColor", CJsonConverter.ConvertColor(DiffuseColor)); } else { return(false); } return(true); }
public void Load(IntPtr handle) { id = Util.CheckString(BrowserInterop.vtsResourceGetId(handle)); faceMode = (FaceMode)BrowserInterop.vtsMeshGetFaceMode(handle); Util.CheckInterop(); IntPtr bufPtr = IntPtr.Zero; uint bufSize = 0; BrowserInterop.vtsMeshGetIndices(handle, ref bufPtr, ref bufSize, ref indicesCount); Util.CheckInterop(); if (indicesCount > 0) { short[] tmp = new short[indicesCount]; Marshal.Copy(bufPtr, tmp, 0, (int)indicesCount); indices = new ushort[indicesCount]; Buffer.BlockCopy(tmp, 0, indices, 0, (int)indicesCount * 2); } BrowserInterop.vtsMeshGetVertices(handle, ref bufPtr, ref bufSize, ref verticesCount); Util.CheckInterop(); vertices = new byte[bufSize]; Marshal.Copy(bufPtr, vertices, 0, (int)bufSize); attributes = new List <VertexAttribute>(4); for (uint i = 0; i < 4; i++) { VertexAttribute a; a.offset = 0; a.stride = 0; a.components = 0; a.enable = false; a.normalized = false; uint type = 0; BrowserInterop.vtsMeshGetAttribute(handle, i, ref a.offset, ref a.stride, ref a.components, ref type, ref a.enable, ref a.normalized); Util.CheckInterop(); a.type = (GpuType)type; attributes.Add(a); } }
public FaceFlags(byte x) { rotateFlipType = (RotateFlipType)(x & 7); faceMode = (FaceMode)(x >> 3 & 3); }
public void SetFaceToMonster(Vector3 destVec) { m_RelativeSpace = FaceMode.FaceToMonster; destVec.z = 0; m_DstUpVec = destVec; }
public void SetFaceToOri() { m_RelativeSpace = FaceMode.FaceToOri; }