Esempio n. 1
0
 public void SetPlayerIndex(int index)
 {
     indexPlayer = index;
     if (index == 0)
     {
         m_myControlKeySet = new LeftHandControlKeySet();
     }
     else
     {
         m_myControlKeySet = new RightHandControlKeySet();
     }
 }
Esempio n. 2
0
    void Update()
    {
        if (state == false)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            updatePointPosition(curRow + 1, curCol, "up");
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            updatePointPosition(curRow - 1, curCol, "down");
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            updatePointPosition(curRow, curCol + 1, "right");
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            updatePointPosition(curRow, curCol - 1, "left");
        }
        //  Debug.Log(curRow + " " + curCol);


        if (ControlKeySet.WarpPermitted())
        {
            int speedAmplifier = 10;

            int amplify = Input.GetKey(ControlKeySet.GetControlKey(Controls.Amplify)) ? 1 : 0;

            int increaseWarpingX = Input.GetKey(ControlKeySet.GetControlKey(Controls.WarpingIncreaseX)) ? 1 : 0;
            int decreaseWarpingX = Input.GetKey(ControlKeySet.GetControlKey(Controls.WarpingDecreaseX)) ? 1 : 0;
            int increaseWarpingY = Input.GetKey(ControlKeySet.GetControlKey(Controls.WarpingIncreaseY)) ? 1 : 0;
            int decreaseWaroingY = Input.GetKey(ControlKeySet.GetControlKey(Controls.WarpingDecreaseY)) ? 1 : 0;

            replacePoint(new Vector2d(-(decreaseWarpingX * (Time.deltaTime * BlendWarpManager.instance.pointSpeed * (1 + amplify * (speedAmplifier - 1))))
                                      + (increaseWarpingX * (Time.deltaTime * BlendWarpManager.instance.pointSpeed * (1 + amplify * (speedAmplifier - 1)))),
                                      -(decreaseWaroingY * (Time.deltaTime * BlendWarpManager.instance.pointSpeed * (1 + amplify * (speedAmplifier - 1))))
                                      + (increaseWarpingY * (Time.deltaTime * BlendWarpManager.instance.pointSpeed * (1 + amplify * (speedAmplifier - 1))))));
        }
    }
Esempio n. 3
0
    void Update()
    {
        if (targetQuadObj != null)
        {
            Material mat = targetQuadObj.GetComponent <Renderer>().material;
            mat.SetFloat("_BrightnessAmount", Brightness / 100.0f);
            mat.SetFloat("_BlendingLeft", leftBlending / 100.0f);
            mat.SetFloat("_BlendingRight", RightBlending / 100.0f);
            mat.SetFloat("_BlendingUp", UpBlending / 100.0f);
            mat.SetFloat("_BlendingDown", DownBlending / 100.0f);
            mat.SetFloat("_FunctionDegree", FunctionDegree);
        }
        if (state == false)
        {
            return;
        }

        if (Input.GetKey(KeyCode.B))
        {
            if (Input.GetKey(KeyCode.RightArrow))
            {
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    Brightness = Math.Min(100, Brightness + 10 * BlendWarpManager.instance.blendMoveSpeed);
                }
                else
                {
                    Brightness = Math.Min(100, Brightness + BlendWarpManager.instance.blendMoveSpeed);
                }
            }

            if (Input.GetKey(KeyCode.LeftArrow))
            {
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    Brightness = Math.Max(0, Brightness - 10 * BlendWarpManager.instance.blendMoveSpeed);
                }
                else
                {
                    Brightness = Math.Max(0, Brightness - BlendWarpManager.instance.blendMoveSpeed);
                }
            }
            data.Brightness = Brightness;
            GUImessages.instance.showMessage("Brightness: " + (int)(data.Brightness) + "%", Color.green, true);
        }

        if (ControlKeySet.BlendPermitted())
        {
            int amplifierSpeed = 10;

            int amplify = Input.GetKey(ControlKeySet.GetControlKey(Controls.Amplify)) ? 1 : 0;

            int blendingLeft  = Input.GetKey(ControlKeySet.GetModeKey(ControllingModes.BlendingLeft)) ? 1 : 0;
            int blendingRight = Input.GetKey(ControlKeySet.GetModeKey(ControllingModes.BlendingRight)) ? 1 : 0;
            int blendingUp    = Input.GetKey(ControlKeySet.GetModeKey(ControllingModes.BlendingUp)) ? 1 : 0;
            int blendingDown  = Input.GetKey(ControlKeySet.GetModeKey(ControllingModes.BlendingDown)) ? 1 : 0;

            int increaseBlending = Input.GetKey(ControlKeySet.GetControlKey(Controls.BlendingIncrease)) ? 1 : 0;
            int decreaseBlending = Input.GetKey(ControlKeySet.GetControlKey(Controls.BlendingDecrease)) ? 1 : 0;

            if (blendingLeft > 0)
            {
                leftBlending = Math.Max(0, Math.Min(100, blendingLeft * (leftBlending
                                                                         + increaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed
                                                                         - decreaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed)));
            }
            if (blendingRight > 0)
            {
                RightBlending = Math.Max(0, Math.Min(100, blendingRight * (RightBlending
                                                                           + increaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed
                                                                           - decreaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed)));
            }
            if (blendingUp > 0)
            {
                UpBlending = Math.Max(0, Math.Min(100, blendingUp * (UpBlending
                                                                     + increaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed
                                                                     - decreaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed)));
            }
            if (blendingDown > 0)
            {
                DownBlending = Math.Max(0, Math.Min(100, blendingDown * (DownBlending
                                                                         + increaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed
                                                                         - decreaseBlending * (amplify * (amplifierSpeed - 1) + 1) * BlendWarpManager.instance.blendMoveSpeed)));
            }

            data.leftBlending  = leftBlending;
            data.RightBlending = RightBlending;
            data.UpBlending    = UpBlending;
            data.DownBlending  = DownBlending;

            GUImessages.instance.showMessage("Blend-Left-Right-Up-Down: " + (int)(data.leftBlending) + " " + (int)(data.RightBlending) + " " + (int)(data.UpBlending) + " " + (int)(data.DownBlending), Color.green, true);
        }
        if (Input.GetKey(KeyCode.Y))
        {
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                FunctionDegree = Math.Max(1, FunctionDegree - 1);
            }
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                FunctionDegree = Math.Min(5, FunctionDegree + 1);
            }
            GUImessages.instance.showMessage("Degree " + (int)FunctionDegree, Color.green, true);
        }
    }