/// <summary> /// Creates the render flags /// </summary> public void CreateFlags() { //Create Flags mFlags = OverlayFlags.Show; //Create Effects mEffects = new Microsoft.DirectX.DirectDraw.OverlayEffects(); }
public void CheckCorrect(Texture2D sourceTexture) { if (Application.isEditor) { byte[] bytes = sourceTexture.EncodeToPNG(); File.WriteAllBytes(Application.dataPath + "/Rendering/textures/test.png", bytes); } Image <Bgr, byte> sourceImage = ImageHelper.ToImage(sourceTexture); Image <Gray, float> result = new Image <Gray, float> (257 - templateImage.Width, 257 - templateImage.Height); Emgu.CV.CvInvoke.MatchTemplate(sourceImage, templateImage, result, TemplateMatchingType.CcorrNormed, mask); double[] minValues, maxValues; Point[] minLocations, maxLocations; result.MinMax(out minValues, out maxValues, out minLocations, out maxLocations); print(maxValues [0] + " " + maxLocations [0]); if (maxValues [0] > accuracy) { solved = true; gameObject.transform.Find("whole").gameObject.SetActive(true); string levelName = "Level" + (SceneManager.GetActiveScene().buildIndex - 1); float currentTime = Time.time - startTime; if (!PlayerPrefs.HasKey(levelName)) { PlayerPrefs.SetFloat(levelName, currentTime); } else if (PlayerPrefs.GetFloat(levelName) > currentTime) { PlayerPrefs.SetFloat(levelName, currentTime); OverlayEffects.ShowTime("New best time! " + formatTime(currentTime)); } else { OverlayEffects.ShowTime(formatTime(currentTime) + "\nBest time: " + formatTime(PlayerPrefs.GetFloat(levelName))); } PlayerPrefs.Save(); //sender.SendTime (levelName, currentTime); if (Application.isEditor) { RotRememberer.WriteString(gameObject); } StartCoroutine("NextLevel"); } }
// Use this for initialization private void Start() { CharacterController = GetComponent <CharacterController> (); Camera = GetComponentInChildren <Camera> (); Camera.enabled = true; FOV = Camera.fieldOfView; OriginalCameraPosition = Camera.transform.localPosition; FovKick.Setup(Camera); HeadBob.Setup(Camera, StepInterval); StepCycle = 0f; NextStep = StepCycle / 2f; Jumping = false; WasHoldingHoldDown = false; WasHoldingRDown = false; RotateMode = false; AudioSource = GetComponent <AudioSource> (); MouseLook.Init(transform, Camera.transform); OriginalSpeed = WalkSpeed; overlayEffect = GameObject.FindGameObjectWithTag("Overlay").GetComponentInChildren <OverlayEffects> (true); }
/// <summary> /// Creates the render flags /// </summary> public void CreateFlags() { //Create Flags { m_Flags = OverlayFlags.Show; if (AlphaEnabled) { m_Flags |= OverlayFlags.Effects | OverlayFlags.KeySourceOverride; } } //Create Effects { m_Effects = new OverlayEffects(); //Transparency if (AlphaEnabled) { ColorKey key = new ColorKey(); key.ColorSpaceHighValue = key.ColorSpaceLowValue = 0; //Make Black (0,0,0) transparent m_Effects.DestinationColorKey = key; } } }
public override bool LetGo() { myCollider.gameObject.layer = LayerMask.NameToLayer("Default"); //print (WithinLimits (posError) + " " + correctPos + " " + transform.position); bool posCorrect = false; bool rotCorrect = false; if (WithinLimits(posError)) { transform.position = correctPos; audioSource.Play(); posCorrect = true; } if (RotWithinLimits(rotError)) { rotCorrect = true; } if ((posCorrect || rotCorrect) && !(posCorrect && rotCorrect)) { OverlayEffects.halfCorrect(); } return(posCorrect || rotCorrect); }
// Update is called once per frame void Update() { if (!solved) { if (!levelBeacon.GetActive()) { return; } bool focus = Input.GetKey(KeyCode.F); if (focus && !wasFocus) //do once after f is pressed { levelBeacon.SetCameraActive(true); StartCoroutine(levelBeacon.TakePicture(this)); } else if (!focus && wasFocus) //do once after release { levelBeacon.SetCameraActive(false); FPCamera.enabled = true; } wasFocus = focus; OverlayEffects.ShowTime(formatTime(Time.time - startTime)); } }
void Start () { timeText = transform.Find ("Time").GetComponent<Text> (); instance = this; }