Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (Sinput.GetButtonDownRepeating("Up"))
        {
            //highlight item above
            currentMenuItem.highlighted = false;
            currentMenuItem             = currentMenuItem.itemAbove;
            currentMenuItem.highlighted = true;
        }
        if (Sinput.GetButtonDownRepeating("Down"))
        {
            //highlight item below
            currentMenuItem.highlighted = false;
            currentMenuItem             = currentMenuItem.itemBelow;
            currentMenuItem.highlighted = true;
        }
        if (Sinput.GetButtonDown("Submit"))
        {
            //select this item
            currentMenuItem.Select();
            Sinput.ResetInputs();
        }

        cam.position = Vector3.Lerp(cam.position, currentMenuItem.camTargetPos.position, Time.deltaTime * 4f);
        cam.rotation = Quaternion.Slerp(cam.rotation, currentMenuItem.camTargetPos.rotation, Time.deltaTime * 4f);

        cursor.position = currentMenuItem.cursorTarget.position;
    }
Beispiel #2
0
        public override void Process()
        {
            bool usedEvent = SendUpdateEventToSelectedObject();

            m_InputDeviceSlot = (InputDeviceSlot)Enum.Parse(typeof(InputDeviceSlot), m_InputSlotter);

            if (eventSystem.sendNavigationEvents)
            {
                if (!usedEvent)
                {
                    usedEvent |= SendMoveEventToSelectedObject();
                }

                if (!usedEvent)
                {
                    //SendSubmitEventToSelectedObject();
                    if (SendSubmitEventToSelectedObject())
                    {
                        Sinput.ResetInputs();
                    }
                }
            }

            ProcessMouseEvent();
        }
        public override void Process()
        {
            bool usedEvent = SendUpdateEventToSelectedObject();

            if (eventSystem.sendNavigationEvents)
            {
                if (!usedEvent)
                {
                    usedEvent |= SendMoveEventToSelectedObject();
                }

                if (!usedEvent)
                {
                    //SendSubmitEventToSelectedObject();
                    if (SendSubmitEventToSelectedObject())
                    {
                        Sinput.ResetInputs();
                    }
                }
            }

            ProcessMouseEvent();
        }
        // Update is called once per frame
        void Update()
        {
            SinputSystems.InputDeviceSlot slot = Sinput.GetSlotPress("Join");

            if (slot != SinputSystems.InputDeviceSlot.any)
            {
                //a player has pressed join!

                //first we check if this player has already joined
                bool alreadyJoined = false;
                for (int i = 0; i < players.Count; i++)
                {
                    if (players[i].playerSlot == slot)
                    {
                        alreadyJoined = true;
                        //lets assume this player is trying to unjoin, and remove them :)
                        Destroy(players[i].gameObject);
                        players.RemoveAt(i);
                        i--;
                    }
                }

                if (!alreadyJoined)
                {
                    //this is a new player looking to join, so lets let them!
                    GameObject newPlayer = (GameObject)GameObject.Instantiate(playerPrefab);
                    newPlayer.transform.position = new Vector3(Random.Range(-4f, 4f), 3f, Random.Range(-4f, 4f));
                    newPlayer.GetComponent <ShootyPlayer>().playerSlot = slot;
                    players.Add(newPlayer.GetComponent <ShootyPlayer>());

                    //lets prevent any new inputs from this slot for a few frames
                    //This isn't necessary, but will prevent people accidentally pressing join twice quickly :)
                    Sinput.ResetInputs(slot);
                }
            }
        }