public SetPixel ( float x, float y, Color color ) : void | ||
x | float | |
y | float | |
color | Color | |
return | void |
void Update() { fupixel.ClearPixels(Color.black); for (int i = 0; i < stars.Length; i++) { int x = (int)(stars[i].x / stars[i].z) + fupixel.width / 2; int y = (int)(stars[i].y / stars[i].z) + fupixel.height / 2; byte c = (byte)(255f / stars[i].z); if (x < fupixel.width) { stars[i] += new Vector3(Time.deltaTime * speed, 0f, 0f); } else { stars[i] = new Vector3(-xSize, stars[i].y, stars[i].z); } if (x >= 0 && x < fupixel.width && y >= 0 && y < fupixel.height) { fupixel.SetPixel(x, y, c, c, c, 255); } } }
// Use this for initialization void Start() { fupixel = gameObject.GetComponent<Fupixel>(); fupixel.ClearPixels(Color.black); fupixel.SetPixel(10, 10, Color.red); }
private void DrawSnake() { fupixel.SetPixel(snakeX, snakeY, snakeColor); fupixel.SetPixel(snakeParts.Peek(), backgroundColor); }
// Use this for initialization void Start() { fupixel = gameObject.GetComponent <Fupixel>(); fupixel.ClearPixels(Color.black); fupixel.SetPixel(10, 10, Color.red); }