public void Start() { _updateNextFrame = true; _buildMode = FindObjectOfType<BuildMode>(); _imageSetter = GetComponent<ImageSetter>(); _runner = FindObjectOfType<Runner>(); }
public IEnumerator PlayerDisconnect(string username) { int userID = 1; UserHandler uHandler = GetComponent <UserHandler>(); for (int i = 1; i < uHandler.users.Count; i++) { if (uHandler.users[i].GetComponent <UserData>().uName != "") { if (uHandler.users[i].GetComponent <UserData>().uName == username) { break; } else { userID++; } } } ImageSetter imgSetter = imageSetter.GetComponent <ImageSetter>(); foreach (GameObject tag in imgSetter.tagObjs) { tag.GetComponent <TagData>().isGuessed[userID] = false; } uHandler.ResetUser(userID); yield return(null); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); ImageSetter editorObj = target as ImageSetter; if (editorObj == null) { return; } if (GUILayout.Button("UpdateInternalTexture")) { editorObj.UpdateInternalTexture(); } editorObj.pixelPosX = EditorGUILayout.IntField("Pixel Position X:", editorObj.pixelPosX); editorObj.pixelPosY = EditorGUILayout.IntField("Pixel Position Y:", editorObj.pixelPosY); editorObj.newColor = EditorGUILayout.ColorField("New Color", editorObj.newColor); if (GUILayout.Button("Set Pixel")) { editorObj.SetPixelColor(editorObj.pixelPosX, editorObj.pixelPosY, editorObj.newColor); } OnDebugGrid(editorObj, editorObj.imageSizeX, editorObj.imageSizeY); }
void Start() { mImageSetter = GetComponent <ImageSetter>(); mCurrent.x = initialPlayerPositionX; mCurrent.y = initialPlayerPositionY; mCurrent.z = initialPlayerPositionZ; if (shouldResetGridAtStart) { ResetVoxelGridToBackgroundColor(); } // Set initial player position mImageSetter.SetPixelColor(mCurrent.x + mCurrent.z * worldSizeX, mCurrent.y, playerColor); mLastDirection = new Int3(0, 0, 1); mCurrent = Int3.random(Int3.zero(), mWorldSize); // mCurrent = new Int3(mCurrentX, mCurrentY, mCurrentZ); mWorldSize = new Int3(worldSizeX, worldSizeY, worldSizeZ); snakeBody = new List <Int3>(); snakeBody.Add(mCurrent); PlaceFoodAtRandom(); }
void Start() { updateFillSpeed = 1f / skillTime; Maudio = GetComponent <AudioSource> (); alertFruit = alertImage.GetComponent <Image>(); imageSetter = alertImage.GetComponent <ImageSetter> (); OriginalColumnRate = ColumnSpwan.spwanRate; OriginalScrollSpeed = GameControl.instance.scrollspeed; }
void Start() { currentscreen = currentScreen.Title; mainGameObjects.SetActive(false); fruits.SetActive(false); audioSource = this.GetComponent <AudioSource>(); imageSetter = this.GetComponent <ImageSetter>(); buttonTexts = new Text[2]; for (int i = 0; i < 2; ++i) { buttonTexts[i] = buttons[i].GetComponentInChildren <Text>(); } }
public void init() { sessionLength = Setting.session_length; audioSource = GetComponent <AudioSource>(); fileinfo = new FileInfo(Setting.fileName(playerName, "Attention")); streamwriter = fileinfo.AppendText(); streamwriter.WriteLine(DescriptionString); streamwriter.WriteLine(FruitDescriptionString); imageSetter = gameObject.GetComponent <ImageSetter>(); timeSessionBegin = Time.realtimeSinceStartup; sessionNum = 0; gameGoingOn = true; startSession(); StartCoroutine(GameBody()); }
public override Task RunAsyncInternal(IBackgroundTaskInstance taskInstance) { if (taskInstance == null) { return(null); } _deferral = taskInstance.GetDeferral(); return(Task.Run(async() => { var settings = await Settings.GetSettings(); await ImageSetter.UpdateImages(settings); _deferral?.Complete(); })); }
void Start() { mImageSetter = GetComponent <ImageSetter>(); mCurrentX = initialPlayerPositionX; mCurrentY = initialPlayerPositionY; mCurrentZ = initialPlayerPositionZ; for (int x = 0; x < worldSizeX; x++) { for (int y = 0; y < worldSizeY; y++) { for (int z = 0; z < worldSizeZ; z++) { mImageSetter.SetPixelColor(x + z * worldSizeX, y, backgroundColor, false); } } } mImageSetter.SetPixelColor(mCurrentX + mCurrentZ * worldSizeX, mCurrentY, playerColor); }
public IEnumerator EndMatch() { state = (int)States.disconnected; UserHandler uHandler = GetComponent <UserHandler>(); ProgressBar pBar = progressBar.GetComponent <ProgressBar>(); ImageSetter imgSetter = imageSetter.GetComponent <ImageSetter>(); for (int i = 0; i < uHandler.users.Count; i++) { if (uHandler.users[i].GetComponent <UserData>().uName != "") { uHandler.ResetUser(i); } } pBar.ResetGame(true, false); Camera.main.transform.DOMove(new Vector3(-381, 642, -10), 0.5f); MenuData.state = 0; waitImage.SetActive(false); yield return(null); }
public void OnDebugGrid(ImageSetter editorObj, int sizeX, int sizeY) { editorObj.currentGridPosX = EditorGUILayout.IntField("Grid Start Position X:", editorObj.currentGridPosX); editorObj.currentGridPosY = EditorGUILayout.IntField("Grid Start Position Y:", editorObj.currentGridPosY); // Number of Cells int cols = 25, rows = 15; float gridItemWidth = maxInnerWidth / (1.0f * cols); // GUI.Box(new Rect(5,5, 800, 800), "Colors"); // GUILayout.BeginArea(new Rect(10, 10, 700, 700)); GUILayout.BeginVertical(); for (int y = 0; y < rows && y < sizeY - editorObj.currentGridPosY; y++) { GUILayout.BeginHorizontal(); for (int x = 0; x < cols && x < sizeX - editorObj.currentGridPosX; x++) { Color lastColor = editorObj.GetPixelColor(x + editorObj.currentGridPosX, y + editorObj.currentGridPosY); Color newColor = EditorGUILayout.ColorField(GUIContent.none, // colorGrid.GetColor(x, y), lastColor, false, true, false, null, GUILayout.Width(gridItemWidth)); if (lastColor != newColor) { editorObj.SetPixelColor(x + editorObj.currentGridPosX, y + editorObj.currentGridPosY, newColor); } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); // GUILayout.EndArea(); }
public void LoadSourceImageFromFile(string fileName) { ImageSetter.SetNewImage(LoadImage(fileName)); }
public void SetPosition(float x, float y) { controller = GameObject.Find("image_container").GetComponent <ImageSetter>(); transform.position = new Vector3(x, y, transform.position.z); }
// Update is called once per frame void Update() { //return; if (networkGameRunning) { if (networkHandler.state == (int)NetworkHandler.States.thinkLoading) { if (imageSetter.GetComponent <ImageSetter>().imageLoaded) { networkHandler.SendMessage("SendTCPMessage", "2~"); networkHandler.state = (int)NetworkHandler.States.thinkReady; } } else if (networkHandler.state == (int)NetworkHandler.States.inGame) { users[0].GetComponent <UserData>().timer += Time.deltaTime; } } else if (botGameRunning) { ImageSetter imgSetter = imageSetter.GetComponent <ImageSetter>(); if (!imgSetter.imageLoaded || !thinkDone) { return; } users[0].GetComponent <UserData>().timer += Time.deltaTime; if (MenuData.mode == (int)MenuData.Modes.battleRoyale || MenuData.mode == (int)MenuData.Modes.sort) { HandleBotRoyale(); return; } bool allTagsGuessed = false; for (int i = 0; i < 4; i++) { //prüft ob alle tags erraten for (int a = 0; a < imgSetter.tagObjs.Count; a++) { if (!imgSetter.tagObjs[a].GetComponent <TagData>().isGuessed[i]) { allTagsGuessed = false; } } } if (allTagsGuessed) { return; } for (int i = 1; i < 4; i++) { //looped durch user //Debug.Log(i.ToString() + " Timer: " + // users[i].GetComponent<UserData>().timer); bool allGuessed = true; for (int a = 0; a < imgSetter.tagObjs.Count; a++) { if (!imgSetter.tagObjs[a].GetComponent <TagData>().isGuessed[i]) { allGuessed = false; } } users[i].GetComponent <UserData>().guessedAll = allGuessed; if (users[i].GetComponent <UserData>().timer <= 0 && !users[i].GetComponent <UserData>().guessedAll) { //guess tag algo -> aufgerufen wenn timer abgelaufen users[i].GetComponent <UserData>().SetTimer(GenerateTime(diff, users[i].GetComponent <UserData>().internalDiff)); int tagCount = imgSetter.tagObjs.Count; bool notFound = true; while (notFound) { notFound = false; int trange = Random.Range(0, 100); int tpos = 0; if (trange > 10 && trange < 30) { //2. top tag tpos = 1; } else if (trange >= 30 && trange < 60) { tpos = 2; } else if (trange >= 60) { tpos = 3; if (tagCount == 5) { tpos = Random.Range(3, 5); //3 oder 4 } else if (tagCount == 6) { tpos = Random.Range(3, 6); //3, 4 oder 5 } } if (imgSetter.tagObjs[tpos].GetComponent <TagData>().isGuessed[i] == true) { //wenn tag bereits erraten dann weitersuchen notFound = true; } if (!notFound) { //tag noch nicht erraten -> setzt auf erraten (i ist nutzerID) FlashTag(tpos, i, CalcBenis(i, tpos, diff)); //Debug.Log(tpos + " " + i); //Debug.Break(); } } } else { users[i].GetComponent <UserData>().timer -= 1 * Time.deltaTime; } } } if (userBenis != userBenisBackup - 5) { userBenis = userBenisBackup - 5; Application.Quit(); } }