public void OnExit(WandController controller) { foreach (var vis in FindObjectOfType <ImAxesRecognizer>().WalkLinkedVisualisations(this)) { vis.OnExit(controller); } }
public void HoverOn(WandController C) { _LastHoverTimestamp = Time.time; if (!_IsHoveredOn) { _IsHoveredOn = true; StartCoroutine(HoverOffCount()); } if (_Highlight != null) { _Highlight.enabled = true; } if (_Name != null) { _Name.enabled = true; } if (C.triggerDown) { _Click.Invoke(); if (OnClick != null) { OnClick(); } } }
// Grabbable interface public void OnDrag(WandController controller) { // float offset = CalculateLinearMapping(controller.transform, MaxPositionC, MinPositionC); Vector3 previousP = transform.position; Vector3 p = controller.transform.position; if (p.x < MinPositionC) { p.x = MinPositionC; } if (p.x > MaxPositionC) { p.x = MaxPositionC; } p.y = previousP.y; p.z = previousP.z; transform.position = p; float normalisedValue = p.x / (MaxPositionC - MinPositionC) - 0.5f; label.text = textLabel + " " + normalisedValue; //OnValueChange(normalisedValue); EventManager.TriggerEvent(eventName, normalisedValue); }
public void BeginMovePlane(WandController wand) { attachedWand = wand; prePos.position = wand.transform.position; prePos.rotation = wand.transform.rotation; currentlyMovingPlane = true; }
// initialize protected override void Start() { base.Start(); controller = GetComponent <PlayerController> (); wandController = GetComponent <WandController> (); viewCamera = Camera.main; }
public bool OnGrab(WandController controller) { v1.transform.parent = controller.transform; v2.transform.parent = controller.transform; transform.parent = controller.transform; return(true); }
public void OnRelease(WandController controller) { v1.transform.parent = null; v2.transform.parent = null; transform.parent = null; }
//Returns true if the controller was attached correctly. public bool TryAttach(WandController ctrl) { //Only attach if the controller is not holding something already. if (ctrl.heldItem != null) { return(false); } //Steal object from other controller. if (attachedController != null) { if (!Stealable) { return(false); } DetachController(); } attachedController = ctrl; OnBeginInteraction(); // Perhaps DetachController was called from OnBeginInteraction. if (attachedController == null) { return(false); } return(true); }
// initialize protected override void Start() { base.Start(); controller = GetComponent<PlayerController> (); wandController = GetComponent<WandController> (); viewCamera = Camera.main; }
public void EndInteraction(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyInteracting = false; // SERVER_DOOR SPECIAL if (m_type == InteractableType.ServerDoor) { GetComponent <Rigidbody>().isKinematic = true; } //Destroy(this.gameObject.GetComponent<CollisionObserver>()); for (int i = 0; i < this.transform.childCount; i++) { GameObject child = this.transform.GetChild(i).gameObject; if (child.GetComponent <Collider>()) { Physics.IgnoreCollision(m_cameraRig, child.GetComponent <Collider>(), false); } } Physics.IgnoreCollision(m_cameraRig, this.GetComponent <Collider>(), false); this.GetComponent <Renderer>().material.SetColor("_Color", Color.red); if (interactionPoint) { if (interactionPoint.gameObject) { Destroy(interactionPoint.gameObject); } } } }
// Start is called before the first frame update void Start() { wandScript1 = wand1.GetComponent <WandController>(); wandScript2 = wand2.GetComponent <WandController>(); /*t = this.GetComponentInChildren<Text>();*/ /*t.text = "Not Deleting";*/ }
public void OnDrag(WandController controller) { float offset = parentAxis.CalculateLinearMapping(controller.transform); Vector3 newP = Vector3.Lerp(parentAxis.MinPosition, parentAxis.MaxPosition, offset); transform.position = newP; parentAxis.isDirty = true; }
public void EndRotate(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyRotating = false; } }
public void EndGrab(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyMoving = false; } }
public void EndMovePlane(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyMovingPlane = false; } }
protected void Init() { rigidBody = this.GetComponent <Rigidbody>(); _interacting = false; attachedWand = null; _thisTransform = this.transform; canInteract = false; }
public void BeginInteraction(WandController wand) { attachedWand = wand; interactionPoint.position = wand.transform.position; interactionPoint.rotation = wand.transform.rotation; interactionPoint.SetParent(transform, true); currentlyInteracting = true; }
public void EndInteraction(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyInteracting = false; } }
public override void OnGripPressUp(WandController wand) { if (wand == attachedWand) { attachedWand = null; currentlyInteracting = false; } }
public void EndInteraction(WandController wand) { if(wand == attachedWand) { attachedWand = null; currentlyInteracting = false; } }
public override void BeginInteraction(WandController wand) { base.BeginInteraction(wand); transform.position = wand.transform.position; transform.rotation = wand.transform.rotation; transform.SetParent(wand.transform); wand.HideControllerModel(); }
/// <summary> /// EndInteraction /// </summary> public void EndInteration(WandController wand) { if (this._AttachedWand == wand) { this._AttachedWand = null; this._IsInteracting = false; } }
void OnTriggerDown(WandController wand) { if (mainState_ == MainState.MINIGAMEFAILED) { currentMiniGame_.GameSetup(); InputController.Instance.OnTriggerDown_ -= OnTriggerDown; } }
// Update is called once per frame public void HoverOn(WandController C) { if (C.triggerDown) { InputController.inUse = true; StartCoroutine(Spawn(C)); } }
// Start is called before the first frame update void Start() { wandScript1 = wand1.GetComponent <WandController>(); wandScript2 = wand2.GetComponent <WandController>(); t = this.GetComponentInChildren <Text>(); t.text = "Not Selecting"; }
public override void Deattach(WandController wand) { GetComponent <Renderer>().material.color = Color.white; if (attachedWand == wand) { attachedWand = null; } }
public void EndInteraction(WandController wand) { if (wand == _attachedWand) { _attachedWand = null; _currentlyInteracting = false; GetComponent <Renderer>().material.shader = _originalShader; } }
public override void OnGripPressDown(WandController wand) { attachedWand = wand; interactionPoint.position = wand.transform.position; interactionPoint.rotation = wand.transform.rotation; interactionPoint.SetParent(transform, true); currentlyInteracting = true; }
public bool OnGrab(WandController controller) { foreach (var vis in FindObjectOfType <ImAxesRecognizer>().WalkLinkedVisualisations(this)) { controller.PropergateOnGrab(vis.gameObject); } return(false); }
public void BeginRotate(WandController wand) { localPos = rbPlane.transform.localPosition; attachedWand = wand; preRotation = Quaternion.LookRotation(attachedWand.transform.position - transform.position); currentlyRotating = true; currentlyMoving = false; currentlyZooming = false; }
/// <summary> /// StartInteraction /// </summary> public void StartInteraction(WandController wand) { this._AttachedWand = wand; this._InteractionPoint.position = wand.transform.position; this._InteractionPoint.rotation = wand.transform.rotation; this._InteractionPoint.SetParent(this.transform, true); this._IsInteracting = true; }
public RadialMenu SpawnMenu(WandController wand, GameController gc) { RadialMenu newMenu = Instantiate(menuPrefab) as RadialMenu; newMenu.transform.SetParent(transform, false); newMenu.transform.localPosition = transform.localPosition + offset; newMenu.gameController = gc; newMenu.SpawnButtons(wand); return(newMenu); }
void MakeUnit() { units++; SpriteController spriteController; string name; switch (producedUnit) { case 0: pickaxes++; name = side + "Pickaxe"; spriteController = new PickaxeController { mode = 4, side = unitSide, maxDistance = unitDistance, castle = Entity }; break; case 1: swords++; name = side + "Sword"; spriteController = new SwordController { mode = 4, side = unitSide, maxDistance = unitDistance, castle = (from entities in SceneSystem.SceneInstance where entities.Name == enemy select entities).FirstOrDefault() }; break; case 2: bowArrows++; name = side + "BowArrow"; spriteController = new BowArrowController { mode = 4, side = unitSide, maxDistance = unitDistance }; break; case 3: wands++; name = side + "Wand"; spriteController = new WandController { mode = 4, side = unitSide, maxDistance = unitDistance }; break; default: name = side + "Unit"; spriteController = new SpriteController { mode = 0, side = unitSide, maxDistance = unitDistance }; break; } //make entity with specific name and add proper sprite sheet and script to it Entity entity; if (Entity.Name.Contains("Enemy")) { entity = new Entity(new Vector3(37, unitPosition, 0), name); } else { entity = new Entity(new Vector3(3, unitPosition, 0), name); } SpriteComponent spriteComponent = new SpriteComponent(); SpriteSheet spriteSheet = Asset.Get<SpriteSheet>(name.Replace("Enemy", "")); spriteComponent.SpriteProvider = new SpriteFromSheet { Sheet = spriteSheet }; spriteComponent.CurrentFrame = 4 + unitSide; ScriptComponent scriptComponent = new ScriptComponent(); scriptComponent.Scripts.Add(spriteController); entity.Add<SpriteComponent>(SpriteComponent.Key, spriteComponent); entity.Add<ScriptComponent>(ScriptComponent.Key, scriptComponent); SceneSystem.SceneInstance.Scene.AddChild(entity); }
public virtual void getHit(WandController wand) { destory(); Debug.Log ("get hit"); }