Exemplo n.º 1
0
 public GnomApp(IGnomTree view, IPressable startingElementId, IConsoleManipulator manipulator, Action<GnomEventArgs> keyRoutingMethod)
 {
     this.View = view;
     this.KeyRoutingMethod = keyRoutingMethod;
     this.Selected = startingElementId;
     this.Manipulator = manipulator;
 }
Exemplo n.º 2
0
    private void RecieveTouches()
    {
        if (Input.touchCount > 0)
        {
            targetColor = Color.white;
            #region new

            for (int i = 0; i < Input.touchCount && i < i_maxFingers; i++)
            {
                ray = cam.ScreenPointToRay(Input.touches[i].position);
                Debug.DrawRay(ray.origin, ray.direction.normalized * 10, Color.blue);

                if (Input.touches[i].phase == TouchPhase.Began)
                {
                    IPressable p = null;

                    Physics.Raycast(ray, out hit, -cam.transform.position.z + 10, controlPointMask);
                    if (hit.collider != null)
                    {
                        p = hit.collider.GetComponent <IPressable>();
                        if (p != null)
                        {
                            p.press();
                        }

                        if (!lizzy.b_Animating)
                        {
                            lizzy.SetAnimationBool("Fusetouching", true);
                        }
                        cp_currentControlPoints[Input.touches[i].fingerId] = hit.collider.GetComponent <ControlPoint>();
                    }
                }

                if (cp_currentControlPoints[Input.touches[i].fingerId] != null)
                {
                    cp_currentControlPoints[Input.touches[i].fingerId].SetPosition(cam.ScreenToWorldPoint(Vector3.Scale(Input.touches[i].position, V3_zFlatten) + V3_facePos));

                    if (Input.touches[i].phase == TouchPhase.Ended)
                    {
                        cp_currentControlPoints[Input.touches[i].fingerId] = null;
                        AudioManager.x.PlaySFX(touchClip, .8f, 1.2f);
                    }
                }
            }

            #endregion
        }
        else
        {
            if (b_won)
            {
                lizzy.SetAnimationBool("Goodjob", true);
            }
            else
            {
                lizzy.BackToIdle();
            }
            targetColor = Color.clear;
        }
    }
Exemplo n.º 3
0
 private void TouchUI()
 {
     if (Input.touchCount > 0)
     {
         ray = cam.ScreenPointToRay(Input.touches[0].position);
         //Debug.DrawRay(ray.origin, ray.direction.normalized * 10, Color.blue);
         if (Physics.Raycast(ray, out hit, -cam.transform.position.z + 10, menuMask))
         {
             //print("touching ui");
             IPressable p = hit.collider.GetComponent <IPressable>();
             if (p != null)
             {
                 p.press();
             }
         }
     }
 }
 void Bar(IPressable pressable)
 {
     pressable.Press();
 }
 /**
  * Function for assigning key functions.
  * Example: command could be "Jump" and pressable could be any pressable we pass in.
  * Any number of commands can be stored, and have any number of pressables associated
  * with them.
  */
 public void AssignPressable(string command, IPressable pressable)
 {
     if (!pressables.ContainsKey(command))
     {
         pressables[command] = new List<IPressable>();
     }
     pressables[command].Add(pressable);
 }
Exemplo n.º 6
0
 public ControlSideListener(IPressable leftControl, IPressable rightControl, float speed)
 {
     _leftControl  = leftControl;
     _rightControl = rightControl;
     _speed        = speed;
 }
Exemplo n.º 7
0
        public void LinkTo(ConsoleKey key, IPressable element, bool doubly = true)
        {
            if(!this.Neighbors.ContainsKey(key))
            {
                this.Neighbors.Add(key, element);
            }
            else
            {
                this.Neighbors[key] = element;
            }

            if (!element.Neighbors.ContainsKey(reverseKeys[key]) || doubly)
            {
                if (!element.Neighbors.ContainsKey(reverseKeys[key]))
                {
                    element.Neighbors.Add(reverseKeys[key], this);
                }
                else
                {
                    element.Neighbors[reverseKeys[key]] = this;
                }
            }
        }
Exemplo n.º 8
0
 void Start()
 {
     mechanism = transform.parent.gameObject.GetComponent <IPressable>();
 }
Exemplo n.º 9
0
 public GnomEventArgs(IGnomTree view, IPressable target, ConsoleKeyInfo keyInfo)
 {
     this.View = view;
     this.Target = target;
     this.PressedKeyInfo = keyInfo;
 }
Exemplo n.º 10
0
 public void AddPress(IPressable c)
 {
     mPressables.Add(c);
 }