Esempio n. 1
0
    public void Respond()
    {
        gameObject.GetComponent <Rigidbody2D>().velocity = Vector3.zero;
        if (controlType.Equals(ControlType.move))
        {
            var move = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);

            if (move.magnitude > .04f)
            {
                oldMove = move;

                gameObject.GetComponent <Rigidbody2D>().velocity = move * speed;

                float angle = Vector3.Angle(move, transform.up);

                if (move.x > 0f)
                {
                    angle = -angle;
                }

                angle += 180f;

                (animationManager as PlayerAnimationManager).Move(angle);
            }

            if (Input.GetButtonDown("Fire2"))
            {
                Use(oldMove);
            }

            if (Input.GetAxis("Left_Trigger").Equals(1) && gameObject.name.Equals("Ship"))
            {
                Vector3 leftSide = Quaternion.AngleAxis(90, Vector3.forward) * oldMove;
                Use(leftSide);
            }

            if (Input.GetAxis("Right_Trigger").Equals(1) && gameObject.name.Equals("Ship"))
            {
                Vector3 rightSide = Quaternion.AngleAxis(-90, Vector3.forward) * oldMove;
                Use(rightSide);
            }

            if (Input.GetButtonDown("Fire3"))
            {
                GameObject.FindObjectOfType <MiniMap>().Show();
                controlType = ControlType.map;
            }

            GameObject.FindObjectOfType <SelectionWheel>().UpdateSelection(gameObject.GetComponent <Inventory>());
        }
        else if (controlType.Equals(ControlType.map))
        {
            if (Input.GetButtonDown("Fire3"))
            {
                GameObject.FindObjectOfType <MiniMap>().Hide();
                controlType = ControlType.move;
            }
        }
    }
Esempio n. 2
0
        /// <summary>
        /// Actuates a standard windows control such as a button,
        /// checkbox etc.
        /// </summary>
        /// <param name="ctrlType">Type of the control</param>
        /// <returns>true if the element is a windows control</returns>
        protected bool actuateStandardControl(ControlType ctrlType)
        {
            bool handled = true;

            if (ctrlType.Equals(ControlType.Button) ||
                ctrlType.Equals(ControlType.CheckBox) ||
                ctrlType.Equals(ControlType.RadioButton))
            {
                AgentManager.Instance.Keyboard.Send(Keys.Space);
            }
            else if (ctrlType.Equals(ControlType.ListItem))
            {
                AgentManager.Instance.Keyboard.Send(Keys.Enter);
            }
            else
            {
                handled = false;
            }

            return(handled);
        }
Esempio n. 3
0
        public virtual bool HasPrimaryChildren(ControlType controlType)
        {
            if (controlType.Equals(ControlType.Custom))
            {
                return(true);
            }
            ControlDictionaryItem item = items.FindBy(controlType);

            if (item == null)
            {
                throw new ControlDictionaryException("Could not find control of type " + controlType.LocalizedControlType);
            }
            return(item.HasPrimaryChildren);
        }
        public virtual bool HasPrimaryChildren(ControlType controlType)
        {
            if (controlType.Equals(ControlType.Custom))
            {
                return(true);
            }
            var results = items.FindBy(controlType).ToArray();

            if (!results.Any())
            {
                throw new ControlDictionaryException("Could not find control of type " + controlType.LocalizedControlType);
            }
            return(results.Any(i => i.HasPrimaryChildren));
        }
 public virtual ControlDictionaryItem[] FindBy(ControlType controlType)
 {
     return(this
            .Where(obj => controlType.Equals(obj.ControlType) && !obj.IsIdentifiedByClassName && !obj.IsIdentifiedByName)
            .ToArray());
 }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            var other = obj as PlayerType;

            return(other != null && ControlType.Equals(other.ControlType) && OffscreenPlayerFactory == other.OffscreenPlayerFactory);
        }
 public virtual ControlDictionaryItem FindBy(ControlType controlType)
 {
     return(Find(obj => controlType.Equals(obj.ControlType) && !obj.IsIdentifiedByClassName && !obj.IsIdentifiedByName));
 }
Esempio n. 8
0
 public override bool Equals(object obj)
 {
     return(obj is PlayerType other && ControlType.Equals(other.ControlType) && OffscreenPlayerFactory == other.OffscreenPlayerFactory);
 }