Beispiel #1
0
    public override void InstanceInteract(GameObject obj, Vector3 point, StateMachine checkMachine)
    {
        switch (action)
        {
        case "DestroyGos":
            ADMIN.DestroyGos();
            break;

        case "CreateGos":
            ADMIN.CreateGos();
            break;

        case "Save":
            ADMIN.Save();
            break;

        case "Load":
            ADMIN.Load();
            break;

        default:
            break;
        }
    }
Beispiel #2
0
    public override void InstanceUpdate(StateMachine checkMachine)
    {
        GameObject sightedObject = GetSightedObject();
        Vector3    sightedPoint  = GetSightedPoint();

        if (lastSwipeTime + 0.1f < Time.time)
        {
            is_swipe = false;
        }
        if (Input.GetKeyDown(KeyCode.UpArrow) || OVRInput.GetUp(OVRInput.RawButton.DpadUp))
        {
            SwipeUp(sightedObject, sightedPoint, this);
        }
        if (Input.GetKeyDown(KeyCode.DownArrow) || OVRInput.GetUp(OVRInput.RawButton.DpadDown))
        {
            SwipeDown(sightedObject, sightedPoint, this);
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow) || OVRInput.GetUp(OVRInput.RawButton.DpadLeft))
        {
            SwipeBack(sightedObject, sightedPoint, this);
        }
        if (Input.GetKeyDown(KeyCode.RightArrow) || OVRInput.GetUp(OVRInput.RawButton.DpadRight))
        {
            SwipeForward(sightedObject, sightedPoint, this);
        }
        if (Input.GetMouseButtonDown(0) && !is_swipe)
        {
            is_holding = true;
            holdStart  = Time.time;
            GetCurrentState().Tap(sightedObject, sightedPoint, this);
        }
        if (Input.GetMouseButtonUp(0))
        {
            is_holding = false;
            if (!is_swipe)
            {
                GetCurrentState().Release(sightedObject, sightedPoint, this);
            }
        }
        if (is_holding)
        {
            GetCurrentState().CheckInteract(sightedObject, sightedPoint, this);
        }
        else
        {
            CheckInteractionChange(sightedObject);
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            PlayerMachine.playerObject.transform.Rotate(0, -45, 0);
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            PlayerMachine.playerObject.transform.Rotate(0, 45, 0);
        }
        if (Input.GetKeyDown(KeyCode.M))
        {
            ADMIN.DestroyGos();
        }
        if (Input.GetKeyDown(KeyCode.N))
        {
            ADMIN.CreateGos();
        }
        if (Input.GetKeyDown(KeyCode.K))
        {
            ADMIN.Save();
        }
        if (Input.GetKeyDown(KeyCode.L))
        {
            ADMIN.Load();
        }
        Gaze(GetSightedPoint());
        currentState.InstanceUpdate(this);
        if (InputMachine.instance != this)
        {
            return;
        }
        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
        float fps = 1.0f / deltaTime;

        fpsText.text = string.Format("{0:0.} fps", fps);
    }