public override void ExtendedControl()
    {
        base.ExtendedControl();
        float dt = Time.deltaTime;

        float x1 = NAInput.GetAxis(NAControl.MoveHorizontal);
        float y1 = NAInput.GetAxis(NAControl.MoveVertical);
        float x2 = NAInput.GetAxis(NAControl.ViewHorizontal);
        float y2 = NAInput.GetAxis(NAControl.ViewVertical);

        bool buttonAction = NAInput.GetControlDown(NAControl.Action);
        bool buttonJump   = NAInput.GetControlDown(NAControl.Jump);
        bool buttonCamera = NAInput.GetControlDown(NAControl.Camera);
        bool buttonMenu   = NAInput.GetControlDown(NAControl.Menu);

        AudioSource audio = GetComponent <AudioSource>();

        if (buttonCamera)
        {
            RecorderPlay();
        }
        if (buttonMenu)
        {
            Record();
        }
        if (buttonAction)
        {
            RecorderStop();
        }

        if (buttonJump)
        {
            audio.loop = !audio.loop;
        }
    }
Esempio n. 2
0
    //put your logic inside this function
    public override void ExtendedControl()
    {
        //contrôles custom
        pos      += Time.deltaTime * NAInput.GetAxis(NAControl.MoveHorizontal);
        duration += Time.deltaTime * NAInput.GetAxis(NAControl.MoveVertical);

        pos      = Mathf.Clamp(pos, 0f, 1f);
        duration = Mathf.Clamp(duration, 0.0001f, 1f);
        if (NAInput.GetControlDown(NAControl.Jump))
        {
            Generate();
        }
        if (NAInput.GetControlDown(NAControl.Camera))
        {
            Randomize();
        }
    }
Esempio n. 3
0
    static public void Process()
    {
        float CurrentPadX = NAInput.GetAxis(NAControl.PadHorizontal);

        if (Mathf.Abs(CurrentPadX) > Mathf.Abs(PreviousPadX))
        {
            PadHorizontalPressed = true;
        }
        else
        {
            PadHorizontalPressed = false;
        }
        if (Mathf.Abs(CurrentPadX) < Mathf.Abs(PreviousPadX))
        {
            PadHorizontalReleased = true;
        }
        else
        {
            PadHorizontalReleased = false;
        }
        PreviousPadX = CurrentPadX;

        float CurrentPadY = NAInput.GetAxis(NAControl.PadVertical);

        if (Mathf.Abs(CurrentPadY) > Mathf.Abs(PreviousPadY))
        {
            PadVerticalPressed = true;
        }
        else
        {
            PadVerticalPressed = false;
        }
        if (Mathf.Abs(CurrentPadY) < Mathf.Abs(PreviousPadY))
        {
            PadVerticalReleased = true;
        }
        else
        {
            PadVerticalReleased = false;
        }
        PreviousPadY = CurrentPadY;
    }
Esempio n. 4
0
    //manages the Extended control
    public override void ExtendedControl()
    {
        if (NA.instanciables.Count == 0)
        {
            return;
        }
        float x1 = NAInput.GetAxis(NAControl.MoveHorizontal);

        float padx = NAInput.GetAxis(NAControl.PadHorizontal);
        float pady = NAInput.GetAxis(NAControl.PadVertical);


        if (NAInput.PadHorizontalPressed && padx > 0)
        {
            Next();
        }
        else if (NAInput.PadHorizontalPressed && padx < 0)
        {
            Previous();
        }
    }
Esempio n. 5
0
    //manages the Extended control
    public override void ExtendedControl()
    {
        float dt = Time.deltaTime;

        float x1 = NAInput.GetAxis(NAControl.MoveHorizontal);
        float y1 = NAInput.GetAxis(NAControl.MoveVertical);
        float x2 = NAInput.GetAxis(NAControl.ViewHorizontal);
        float y2 = NAInput.GetAxis(NAControl.ViewVertical);

        bool buttonJump   = NAInput.GetControlDown(NAControl.Jump);
        bool buttonCamera = NAInput.GetControlDown(NAControl.Camera);
        bool buttonMenu   = NAInput.GetControlDown(NAControl.Menu);


        Light light = target.GetComponent <Light>();

        //light.range       += y1*dt*1f;
        light.spotAngle += x2 * dt * 45f;
        light.intensity -= y2 * dt * 1f;

        light.intensity = Mathf.Clamp(light.intensity, 0, 2f);
        light.spotAngle = Mathf.Clamp(light.spotAngle, 0, 179f);
        if (LightName == "MainLightViewer")
        {
            //target.transform.Rotate(y1*dt*45f,x1*dt*45f,0);
            target.transform.RotateAround(transform.position, transform.up, x1 * dt * 45f);
            target.transform.RotateAround(transform.position, transform.right, y1 * -1f * dt * 45f);
        }

        if (buttonCamera)
        {
            light.color = new Color(Random.value, Random.value, Random.value);
        }
        if (buttonJump)
        {
            light.color = Color.white;
        }

        dirty = true;
    }
Esempio n. 6
0
    public override void ExtendedControl()
    {
        base.ExtendedControl();
        float dt = Time.deltaTime;

        float x1 = NAInput.GetAxis(NAControl.MoveHorizontal);
        float y1 = NAInput.GetAxis(NAControl.MoveVertical);
        float x2 = NAInput.GetAxis(NAControl.ViewHorizontal);
        float y2 = NAInput.GetAxis(NAControl.ViewVertical);

        bool buttonAction = NAInput.GetControlDown(NAControl.Action);
        bool buttonJump   = NAInput.GetControlDown(NAControl.Jump);
        bool buttonCamera = NAInput.GetControlDown(NAControl.Camera);
        bool buttonMenu   = NAInput.GetControlDown(NAControl.Menu);

        frequency += x1 * dt * 100f;
        duration  += y1 * dt;

        duration = Mathf.Clamp(duration, 0.1f, 10);


        if (buttonJump)
        {
            Generate();
            //Play();
        }

        float padx = NAInput.GetAxis(NAControl.PadHorizontal);
        float pady = NAInput.GetAxis(NAControl.PadVertical);

        if (NAInput.PadHorizontalPressed && padx > 0)
        {
            waveform = waveform++;
        }
        else if (NAInput.PadHorizontalPressed && padx < 0)
        {
            waveform = waveform--;
        }
    }
Esempio n. 7
0
    void Update()
    {
        GameObject trsGyzmo = GameObject.Find("TRS Gizmo");

        if (trsGyzmo != null)
        {
            GameObject gizmoCamera = trsGyzmo.transform.Find("Main Camera").gameObject;
            if (gizmoCamera != null)
            {
                if (gizmoCamera.active == true)
                {
                    return;
                }
            }
        }



        if (NAInput.GetControl(NAControl.NextTool) || NAInput.GetControl(NAControl.PreviousTool))
        {
            return;
        }
        //joystick

        /*
         * float rotationJX = transform.localEulerAngles.y + Input.GetAxis("ViewX") * sensitivityX;
         *
         * rotationY += Input.GetAxis("ViewY") * sensitivityY * -1f;
         * rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
         * transform.localEulerAngles = new Vector3(-rotationY, rotationJX, 0);
         */
        float JoySensitivityX = 2f * 60f * Time.deltaTime;
        float JoySensitivityY = 2f * 60f * Time.deltaTime;
        float jx = NAInput.GetAxis(NAControl.ViewHorizontal);
        float jy = NAInput.GetAxis(NAControl.ViewVertical);

        float x = 0.1f * jx + (jx * jx * jx) * 0.9f;
        float y = 0.1f * jy + (jy * jy * jy) * 0.9f;

        float k = NA.JoystickSmoothing;

        cx = cx * k + x * (1f - k);
        cy = cy * k + y * (1f - k);
        float rotationJX = transform.localEulerAngles.y + cx * JoySensitivityX;

        rotationY += cy * JoySensitivityY * -1f;
        rotationY  = Mathf.Clamp(rotationY, minimumY, maximumY);
        transform.localEulerAngles = new Vector3(-rotationY, rotationJX, 0);



        if (!Input.GetMouseButton(0))
        {
            return;
        }
        if (axes == RotationAxes.MouseXAndY)
        {
            float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;

            rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
            rotationY  = Mathf.Clamp(rotationY, minimumY, maximumY);

            transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
        }
        else if (axes == RotationAxes.MouseX)
        {
            transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
        }
        else
        {
            rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
            rotationY  = Mathf.Clamp(rotationY, minimumY, maximumY);

            transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
        }
    }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        if (NAInput.GetControl(NAControl.NextTool) || NAInput.GetControl(NAControl.PreviousTool))
        {
            return;
        }
        float speed = 2f;

        if (Input.GetKey(KeyCode.LeftShift))
        {
            speed = 20f;
        }
        float dt = Time.deltaTime;

        /*
         * if (Input.GetKey(KeyCode.LeftArrow))
         * {
         *      //transform.position -= transform.right * speed * dt;
         * }
         * if (Input.GetKey(KeyCode.RightArrow))
         * {
         *      //transform.position += transform.right * speed * dt;
         * }
         * if (Input.GetKey(KeyCode.UpArrow))
         * {
         *      //transform.position += transform.forward * speed * dt;
         * }
         * if (Input.GetKey(KeyCode.DownArrow))
         * {
         *      //transform.position -= transform.forward * speed * dt;
         * }
         * if (Input.GetKey (KeyCode.RightShift))
         * {
         *      //transform.position += transform.up * speed * dt;
         * }
         */

        //axes

        float x = NAInput.GetAxis(NAControl.MoveHorizontal);
        float y = NAInput.GetAxis(NAControl.MoveVertical);

        float joy_speed = 4f;

        if (NAInput.GetControl(NAControl.Jump))
        {
            joy_speed = 20f;
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            bGravity = !bGravity;
        }


        if (NAInput.GetControl(NAControl.Jump) && x == 0 && y == 0)
        {
            timerFly += Time.deltaTime;

            if (timerFly > 1f)
            {
                timerFly = 0f;
                bGravity = !bGravity;
                if (bGravity)
                {
                    LogManager.LogWarning("you are now in walk mode");
                }
                else
                {
                    LogManager.LogWarning("you are now in fly mode");
                }
            }
        }
        else
        {
            timerFly = 0;
        }

        bool jump = NAInput.GetControlUp(NAControl.Jump);



        if (bPhysics)
        {
            Rigidbody rb    = GetComponent <Rigidbody>();
            float     coeff = Time.deltaTime * 60f * 5f;
            rb.AddForce(transform.right * joy_speed * x * coeff, ForceMode.Force);
            rb.AddForce(transform.forward * joy_speed * y * coeff, ForceMode.Force);
            //rb.velocity = transform.right * joy_speed * dt*x *100+transform.forward * joy_speed * dt*y*100;
            //transform.position += transform.right * joy_speed * dt*x;
            //transform.position += transform.forward * joy_speed * dt*y;

            if (jump)
            {
                //question do use world up or local up ?
                //mix
                Vector3 jumpup = (transform.up + Vector3.up) / 2f;
                rb.AddForce(jumpup * joy_speed * 100, ForceMode.Force);
            }

            /*if (rb.velocity.magnitude>1)
             * {
             *      rb.velocity.Normalize();
             * }
             */


            rb.useGravity = bGravity;
        }
        else
        {
            transform.position += transform.right * joy_speed * dt * x;
            transform.position += transform.forward * joy_speed * dt * y;
        }

        /*float joy_speed = 50f;
         * float y = Input.GetAxis("Vertical");
         * float x = Input.GetAxis("Horizontal");
         * transform.position += transform.right * joy_speed * dt*x;
         * transform.position += transform.forward * joy_speed * dt*y;
         */

        /*if (Input.GetMouseButtonDown (0))
         * {
         *      previousmouseposition = Input.mousePosition;
         *
         * }
         * else if (Input.GetMouseButton(0))
         * {
         *      Vector3 move = Input.mousePosition - previousmouseposition;
         *      previousmouseposition = Input.mousePosition;
         *      transform.Rotate(transform.up, move.x);
         *      transform.Rotate(transform.right, move.y*-1f);
         *
         * }
         */



        /*float vx = Input.GetAxis("ViewX");
         * float vy = Input.GetAxis("ViewY");
         *
         * Vector3 angles = transform.eulerAngles;
         * angles.x += vy;
         * angles.y += vx;
         * transform.eulerAngles = angles;
         */
    }