private void FixedUpdate() { if (joint == null && spawn.GetStateDown(trackedObj.inputSource)) { if (!active) { snapCam.gameObject.SetActive(true); Debug.Log("shoot picture"); int amountOfPokemansFound = 0; for (int i = 0; i < pokemans.Length; i++) { Pokemans pk = pokemans[i].GetComponent <Pokemans>(); if (IsInView(snapCam.gameObject, pk.gameObject)) { Debug.Log("Pokeman is in view"); amountOfPokemansFound++; } } snapCam.Snap(amountOfPokemansFound); flash = true; light.intensity = intensityOrigin; flareSpeed = 1; StartCoroutine(LensFlash()); active = true; } } }
void OnGUI() { Picture.normal.background = pictureButton; if (GUI.Button(new Rect(Screen.width - Screen.width / 4, Screen.height / 2, Screen.width / 4, Screen.height / 2), "", Picture)) { int amountOfPokemansFound = 0; for (int i = 0; i < pokemans.Length; i++) { Pokemans pk = pokemans[i].GetComponent <Pokemans>(); if (IsInView(MainCamera.gameObject, pk.gameObject)) { Debug.Log("Pokeman is in view"); amountOfPokemansFound++; } // if(pk.foundMe){ // amountOfPokemansFound++; // } } snapCam.Snap(amountOfPokemansFound); flash = true; flareSpeed = 1; StartCoroutine(LensFlash()); } Candy.normal.background = shoot; if (GUI.Button(new Rect(0, Screen.height / 2, Screen.width / 4, Screen.height / 2), "", Candy)) { Shoot(); } if (flash) { canvas.SetActive(true); image.color = new Color(image.color.r, image.color.g, image.color.b, flareSpeed); } }
void OnSceneGUI() { Pokemans fow = (Pokemans)target; Handles.color = Color.white; Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius); Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false); Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius); Handles.color = Color.red; foreach (Transform visibleTargets in fow.visibleTargets) { Handles.DrawLine(fow.transform.position, visibleTargets.position); } }