private void PostProcessInvertors() { List <string> conditions = new List <string>() { "RED", "BLUE" }; if (CheckHaveEveryTag(conditions) && !activeTags.Contains("MAGENTA")) { Invertor invertor = new Invertor(); invertor.Apply("MAGENTA", invertables, true, conditions); postProcessRecursCount += 1; } postProcessRecursCount -= 1; List <Invertor> invertorsToClear = new List <Invertor>(); foreach (var invertor in activeTagInvertors) { if (invertor.AddedByPostprocessor) { if (!CheckHaveEveryTag(invertor.conditionsToStay)) { invertorsToClear.Add(invertor); } } } foreach (var invertor in invertorsToClear) { invertor.Clear(); } }
private void Update() { justGrabbed = false; invertSymbol.SetActive(false); grabTip.SetActive(false); releaseTip.SetActive(false); RaycastHit hitInfo; if (Physics.Raycast(new Ray(transform.position, transform.forward), out hitInfo, 10000, layer)) { invertable = hitInfo.transform.gameObject.GetComponent <Invertable>(); grabable = hitInfo.transform.gameObject.GetComponent <Grabable>(); if (invertable != null) { if (!playerInput.CoursorFree) { invertSymbol.SetActive(true); } if (Input.GetKeyDown(KeyCode.Mouse0) && !playerInput.CoursorFree) { InvertorSlot slot = InvertionManager.Instance.GetFreeInvertorSlot(); if (slot != null) { Invertor invertor = new Invertor(); slot.TakeSlot(invertor, invertor.Apply(invertable)); } } } if (grabable != null && currentGrabable == null) { grabTip.SetActive(true); if (Input.GetKeyDown(KeyCode.F) && !playerInput.CoursorFree) { grabable.Grab(grabTransform, 2); currentGrabable = grabable; justGrabbed = true; } } } if (currentGrabable != null) { releaseTip.SetActive(true); } if (!justGrabbed && Input.GetKeyDown(KeyCode.F) && currentGrabable != null) { currentGrabable.Release(); currentGrabable = null; } if (currentGrabable != null && currentGrabable.Target != grabTransform) { currentGrabable = null; } }
public void AddTagInvertor(string tag) { InvertorSlot slot = GetFreeInvertorSlot(); if (slot != null) { Invertor invertor = new Invertor(); slot.TakeSlot(invertor, invertor.Apply(tag, invertables)); } }