示例#1
0
 public void SetTexCoords(UsageHint usage, coord[] texCoords)
 {
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     GL.BindBuffer(BufferTarget.ArrayBuffer, _texCoordBuffer);
     GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(sizeof(coord) * texCoords.Length), texCoords, (BufferUsageHint)usage);
     _Graphics.ErrorCheck();
 }
示例#2
0
 public override string ToString()
 {
     return(string.Concat(
                nameof(Handle) + "=", Handle.ToString(),
                ", " + nameof(StorageLengthInBytes) + "=", StorageLengthInBytes.ToString(),
                ", " + nameof(UsageHint) + "=", UsageHint.ToString()
                ));
 }
示例#3
0
        public SamplerBuffer(byte[] data, UsageHint usageHint = UsageHint.StaticRead)
        {
            this._bufferId = GL.GenBuffer();
            GL.BindBuffer(BufferTarget.TextureBuffer, _bufferId);
            GL.BufferData(BufferTarget.TextureBuffer, new IntPtr(data.Length), data, (BufferUsageHint)usageHint);

            this._textureId = GL.GenTexture();
        }
示例#4
0
 public void SetVertices(UsageHint usage, params GraphicsPoint[] vertices)
 {
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     GL.BindBuffer(BufferTarget.ArrayBuffer, _vertexBuffer);
     GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(GraphicsPoint.Size * vertices.Length), vertices, (BufferUsageHint)usage);
     _vertexCount = vertices.Length;
     _Graphics.ErrorCheck();
 }
示例#5
0
 public void TriangleStripCoords(UsageHint usage, int count)
 {
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     Contract.Requires <ArgumentOutOfRangeException>(count >= 0);
     GL.BindBuffer(BufferTarget.ArrayBuffer, _texCoordBuffer);
     GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(8 * sizeof(coord) * count), Enumerable.Repeat(defaultTriangleStripCoords, count).ToArray(), (BufferUsageHint)usage);
     _Graphics.ErrorCheck();
 }
示例#6
0
 public void SetColors(UsageHint usage, Color[] colors)
 {
     // @TODO Select colors for each primitive? (e.g. when drawing PrimitiveType.Triangles, allow colors.Length == vertices.Length / 3)
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     GL.BindBuffer(BufferTarget.ArrayBuffer, _colorBuffer);
     GL.EnableVertexAttribArray(1);
     GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(4 * colors.Length), colors, (BufferUsageHint)usage);
     _Graphics.ErrorCheck();
 }
示例#7
0
 public void SetVertices(UsageHint usage, params coord[] vertices)
 {
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     Contract.Requires <ArgumentException>(vertices.Length % 2 == 0);
     GL.BindBuffer(BufferTarget.ArrayBuffer, _vertexBuffer);
     GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(sizeof(coord) * vertices.Length), vertices, (BufferUsageHint)usage);
     _vertexCount = vertices.Length / 2;
     _Graphics.ErrorCheck();
 }
示例#8
0
 void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.tag == "Player")
     {
         if (!autoStart)
         {
             hot = false;
             UsageHint.Hide();
         }
     }
 }
示例#9
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Player")
     {
         if (autoStart)
         {
             StartConversation();
         }
         else
         {
             hot = true;
             UsageHint.Show();
         }
     }
 }
示例#10
0
    public void StartConversation()
    {
        onStart.Invoke();

        opened = true;
        bubble = Instantiate(bubblePrefab).GetComponent <SpeechBubble>();
        bubble.transform.SetParent(gameObject.transform, false);
        PlayerInput.instance.enabled = false;

        currentPhrase          = 0;
        bubble.phrase.text     = phrases[currentPhrase].text;
        bubble.portrait.sprite = phrases[currentPhrase].portrait;

        if (!autoStart)
        {
            UsageHint.Hide();
        }
    }
示例#11
0
 void Start()
 {
     instance = this;
     text = GetComponent<Text> ();
 }
示例#12
0
 void Start()
 {
     instance = this;
     text     = GetComponent <Text> ();
 }
示例#13
0
 public void WriteData(byte[] data, UsageHint usageHint = UsageHint.DynamicRead)
 {
     Contract.Requires <ObjectDisposedException>(!IsDisposed);
     GL.BindBuffer(BufferTarget.TextureBuffer, _bufferId);
     GL.BufferData(BufferTarget.TextureBuffer, new IntPtr(data.Length), data, (BufferUsageHint)usageHint);
 }