public void OnExit(WandController controller)
 {
     foreach (var vis in FindObjectOfType <ImAxesRecognizer>().WalkLinkedVisualisations(this))
     {
         vis.OnExit(controller);
     }
 }
Esempio n. 2
0
    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();
            }
        }
    }
Esempio n. 3
0
    // 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);
    }
Esempio n. 4
0
 public void BeginMovePlane(WandController wand)
 {
     attachedWand         = wand;
     prePos.position      = wand.transform.position;
     prePos.rotation      = wand.transform.rotation;
     currentlyMovingPlane = true;
 }
Esempio n. 5
0
 // initialize
 protected override void Start()
 {
     base.Start();
     controller     = GetComponent <PlayerController> ();
     wandController = GetComponent <WandController> ();
     viewCamera     = Camera.main;
 }
Esempio n. 6
0
 public bool OnGrab(WandController controller)
 {
     v1.transform.parent = controller.transform;
     v2.transform.parent = controller.transform;
     transform.parent    = controller.transform;
     return(true);
 }
Esempio n. 7
0
    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);
    }
Esempio n. 9
0
 // 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);
                }
            }
        }
    }
Esempio n. 11
0
    // 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";*/
    }
Esempio n. 12
0
    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;
    }
Esempio n. 13
0
 public void EndRotate(WandController wand)
 {
     if (wand == attachedWand)
     {
         attachedWand      = null;
         currentlyRotating = false;
     }
 }
Esempio n. 14
0
 public void EndGrab(WandController wand)
 {
     if (wand == attachedWand)
     {
         attachedWand    = null;
         currentlyMoving = false;
     }
 }
Esempio n. 15
0
 public void EndMovePlane(WandController wand)
 {
     if (wand == attachedWand)
     {
         attachedWand         = null;
         currentlyMovingPlane = false;
     }
 }
Esempio n. 16
0
 protected void Init()
 {
     rigidBody      = this.GetComponent <Rigidbody>();
     _interacting   = false;
     attachedWand   = null;
     _thisTransform = this.transform;
     canInteract    = false;
 }
Esempio n. 17
0
 public void BeginInteraction(WandController wand)
 {
     attachedWand = wand;
     interactionPoint.position = wand.transform.position;
     interactionPoint.rotation = wand.transform.rotation;
     interactionPoint.SetParent(transform, true);
     currentlyInteracting = true;
 }
Esempio n. 18
0
 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;
     }
 }
Esempio n. 21
0
 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();
 }
Esempio n. 22
0
 /// <summary>
 /// EndInteraction
 /// </summary>
 public void EndInteration(WandController wand)
 {
     if (this._AttachedWand == wand)
     {
         this._AttachedWand  = null;
         this._IsInteracting = false;
     }
 }
Esempio n. 23
0
 void OnTriggerDown(WandController wand)
 {
     if (mainState_ == MainState.MINIGAMEFAILED)
     {
         currentMiniGame_.GameSetup();
         InputController.Instance.OnTriggerDown_ -= OnTriggerDown;
     }
 }
Esempio n. 24
0
 // Update is called once per frame
 public void HoverOn(WandController C)
 {
     if (C.triggerDown)
     {
         InputController.inUse = true;
         StartCoroutine(Spawn(C));
     }
 }
Esempio n. 25
0
    // 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";
    }
Esempio n. 26
0
    public override void Deattach(WandController wand)
    {
        GetComponent <Renderer>().material.color = Color.white;

        if (attachedWand == wand)
        {
            attachedWand = null;
        }
    }
    public void BeginInteraction(WandController wand)
    {
        attachedWand = wand;
        interactionPoint.position = wand.transform.position;
        interactionPoint.rotation = wand.transform.rotation;
        interactionPoint.SetParent(transform, true);

        currentlyInteracting = true;
    }
Esempio n. 28
0
 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;
    }
Esempio n. 30
0
    public bool OnGrab(WandController controller)
    {
        foreach (var vis in FindObjectOfType <ImAxesRecognizer>().WalkLinkedVisualisations(this))
        {
            controller.PropergateOnGrab(vis.gameObject);
        }

        return(false);
    }
Esempio n. 31
0
 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;
 }
Esempio n. 32
0
    /// <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;
    }
Esempio n. 33
0
    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);
 }
Esempio n. 35
0
 public virtual void getHit(WandController wand)
 {
     destory();
     Debug.Log ("get hit");
 }