Inheritance: MonoBehaviour
コード例 #1
0
        // Use this for initialization
        void Start()
        {
            _leftTriggerAction   = new VectorInput("/actions/main/in/lefttriggervalue");
            _rightTriggerAction  = new VectorInput("/actions/main/in/righttriggervalue");
            _leftAAction         = new BooleanInput("/actions/main/in/lefta");
            _rightAAction        = new BooleanInput("/actions/main/in/righta");
            _leftTrackpadAction  = new BooleanInput("/actions/main/in/lefttrackpadpress");
            _rightTrackpadAction = new BooleanInput("/actions/main/in/righttrackpadpress");

            string model = XRDevice.model != null?XRDevice.model.ToLower() : "";


            if (model.Contains("index"))
            {
                triggerButton = (KeyCode)IndexTriggerButton;
            }
            else if (model.Contains("vive"))
            {
                triggerButton = (KeyCode)ViveTriggerButton;
            }
            else if (model.Contains("oculus"))
            {
                triggerButton = (KeyCode)OculusTriggerButton;
            }
            else
            {
                triggerButton = (KeyCode)WMRTriggerButton;
            }
            //Debug.Log("model: " + model);
        }
コード例 #2
0
ファイル: WorldSource.cs プロジェクト: nooperation/LibSanBag
        private VectorInput Read_VectorInput(BinaryReader reader)
        {
            var result = new VectorInput();

            result.Data  = ReadString(reader);
            result.Value = ReadVectorF(reader, 4);

            return(result);
        }
コード例 #3
0
    // Use this for initialization
    void Awake()
    {
        posIntput = posIntputObj.GetComponent <VectorInput>();
        dirIntput = dirIntputObj.GetComponent <VectorInput>();

        titleText = titleGameobject.GetComponent <Text>();

        animator = GetComponent <Animator>();

        keyframeArrowManager = TimeLineSlider.GetComponent <KeyframeArrowManager>();
    }
コード例 #4
0
ファイル: Plugin.cs プロジェクト: jy970320/DynamicOpenVR
        private void RegisterActionSet()
        {
            logger.Info("Registering actions");

            leftTriggerValue  = new VectorInput("/actions/main/in/lefttriggervalue");
            rightTriggerValue = new VectorInput("/actions/main/in/righttriggervalue");
            menu          = new BooleanInput("/actions/main/in/menu");
            leftSlice     = new HapticVibrationOutput("/actions/main/out/leftslice");
            rightSlice    = new HapticVibrationOutput("/actions/main/out/rightslice");
            leftHandPose  = new PoseInput("/actions/main/in/lefthandpose");
            rightHandPose = new PoseInput("/actions/main/in/righthandpose");
        }
コード例 #5
0
ファイル: Button.cs プロジェクト: damtakon/MatchThree
 public Button(SpriteFont font, VectorInput vectorInput, Action clickAction, string text, Vector2 position, Color?defaultColor = null, Color?hoverColor = null)
 {
     Font         = font;
     ClickAction  = clickAction;
     VectorInput  = vectorInput;
     Position     = position;
     DefaultColor = defaultColor ?? Color.White;
     HoverColor   = hoverColor ?? Color.Red;
     CurrentColor = DefaultColor;
     TextRefresh(text);
     Subscribe();
 }
コード例 #6
0
        void _Create(GraphFactory graph, int inputSize, float[] gamma, float[] beta, float[] derivedMean, float[] derivedM2, int count)
        {
            _inputSize  = inputSize;
            _statistics = new VectorBasedStatistics(graph.LinearAlgebraProvider, inputSize, derivedMean, derivedM2, count);

            if (gamma == null)
            {
                gamma = new float[inputSize];
                for (var i = 0; i < inputSize; i++)
                {
                    gamma[i] = 1f;
                }
            }
            if (beta == null)
            {
                beta = new float[inputSize];
            }

            _input = new FlowThrough();
            _gamma = new VectorInput(gamma, "gamma");
            _beta  = new VectorInput(beta, "beta");

            var mean               = graph.Connect(inputSize, _input).Add(new BatchMean());
            var subtractMean       = graph.Subtract(inputSize, _input, mean.LastNode);
            var subtractMeanOutput = subtractMean.LastNode;

            var stdDev = subtractMean
                         .Add(new InputSquared())
                         .Add(new BatchMean())
                         .Add(new SquareRootOfInput())
                         .Add(new OneDividedByInput());

            var normalised = graph.Multiply(_inputSize, subtractMeanOutput, stdDev.LastNode) /*.Add(new InspectSignals(data => {
                                                                                              * var matrix = data.GetMatrix().AsIndexable();
                                                                                              * var statistics = matrix.Columns.Select(v => (v, v.Average())).Select(v2 => (v2.Item2, v2.Item1.StdDev(v2.Item2))).ToList();
                                                                                              * }))*/;
            var adjusted   = graph.Multiply(_inputSize, _gamma, normalised.LastNode);

            _output = graph.Add(_inputSize, _beta, adjusted.LastNode).LastNode;

            _start = new OneToMany(SubNodes, bp => { });
        }
コード例 #7
0
        public Vector <float> Compute(StatePair input, bool training)
        {
            // Forward propagate.
            var img = InputLayer.Compute(input.Spatial);

            for (int i = 0; i < ConvolutionalLayers.Length; i++)
            {
                img = SubSampleLayers[i].Compute(ConvolutionalLayers[i].Compute(img));
            }
            _vecp.left           = FlattenLayer.Compute(img);
            _vecp.right          = LinearHiddenLayer.Compute(VectorInput.Compute(input.Linear));
            IsOutputFromTraining = false;
            var res = OutputLayer.Compute(CombinationLayer.Compute(_vecp));

            if (ValuesComputed != null)
            {
                ValuesComputed(res, training);
            }
            return(res);
        }
コード例 #8
0
ファイル: Board.cs プロジェクト: damtakon/MatchThree
        public Board(Texture2D cellTexture2D, Rectangle boardContainer, int lines, int columns, IGemFactory gemFactory,
                     VectorInput vectorInput)
        {
            if (lines == 0 || columns == 0)
            {
                throw new ArgumentException("Lines and Columns can't be 0");
            }

            CellTexture2D = cellTexture2D;
            Gems          = new Gem[columns, lines];
            Cells         = new Rectangle[columns, lines];
            var widthCell  = boardContainer.Width / columns;
            var heightCell = boardContainer.Height / lines;
            var cellSize   = Math.Min(widthCell, heightCell);

            GemOffset = (int)(cellSize * 0.1);
            GemSize   = cellSize - GemOffset * 2;
            var startX = boardContainer.X + (boardContainer.Width - columns * cellSize) / 2;
            var startY = boardContainer.Y + (boardContainer.Height - lines * cellSize) / 2;

            CellColor  = new Color(Color.White, 50);
            GemFactory = gemFactory;
            for (var x = 0; x < columns; x++)
            {
                for (var y = 0; y < lines; y++)
                {
                    Cells[x, y] = new Rectangle(startX + x * cellSize, startY + y * cellSize, cellSize, cellSize);
                    CreateGem(x, y);
                }
            }

            Lines              = lines;
            Columns            = columns;
            Recalculate        = new List <Gem>(Gems.Length);
            BoardState         = BoardState.Move;
            VectorInput        = vectorInput;
            VectorInput.Press += VectorInputOnPress;
        }
コード例 #9
0
 public MainMenu(VectorInput vectorInput)
 {
     _vectorInput = vectorInput;
 }
コード例 #10
0
 public GameOver(VectorInput vectorInput)
 {
     _vectorInput = vectorInput;
 }
コード例 #11
0
ファイル: LevelOne.cs プロジェクト: damtakon/MatchThree
 public LevelOne(VectorInput vectorInput)
 {
     _vectorInput = vectorInput;
 }
コード例 #12
0
        private void CB_VesselName_SelectionChangeCommitted(object sender, EventArgs e)
        {
            string selVessel = (string)CB_VesselName.SelectedItem;
            Guid   ID        = vessels.First(x => x.Value == selVessel).Key;

            var userData = PluginManager.PluginManager.GetUserInputValues(ID);
            int i        = 0;

            GB_VesselData.Controls.Clear();
            Log.Write("VesselEdit: Clearing controls");

            // Loc (7, 20)
            // Size (457, 27)
            foreach (KeyValuePair <string, PluginManager.OrbVesselScenarioDataType> kvp in userData)
            {
                UserControl control = new UserControl();
                var         loc     = new Point(7, 20 + 27 * i);
                var         size    = new Size(457, 27);

                switch (kvp.Value)
                {
                case PluginManager.OrbVesselScenarioDataType.STRING:
                    var ti = new TextInput();
                    ti.Name  = kvp.Key;
                    ti.Value = string.Empty;
                    Log.Write(string.Format("VesselEdit: Adding '{0}' as TextInput", kvp.Key));
                    control = ti;
                    break;

                case PluginManager.OrbVesselScenarioDataType.INT:
                case PluginManager.OrbVesselScenarioDataType.DOUBLE:
                    var di = new DoubleInput();
                    di.Name  = kvp.Key;
                    di.Value = 0d;
                    Log.Write(string.Format("VesselEdit: Adding '{0}' as DoubleInput", kvp.Key));
                    control = di;
                    break;

                case PluginManager.OrbVesselScenarioDataType.VECTOR:
                    var vi = new VectorInput();
                    vi.Name  = kvp.Key;
                    vi.Value = new Vector3(0, 0, 0);
                    Log.Write(string.Format("VesselEdit: Adding '{0}' as VectorInput", kvp.Key));
                    control = vi;
                    break;

                case PluginManager.OrbVesselScenarioDataType.PERCENTAGE:
                    var pi = new PercentageInput();
                    pi.Name  = kvp.Key;
                    pi.Value = 1d;
                    Log.Write(string.Format("VesselEdit: Adding '{0}' as PercentageInput", kvp.Key));
                    control = pi;
                    break;
                }

                control.Location = loc;
                control.Size     = size;
                control.Tag      = kvp.Value;

                GB_VesselData.Controls.Add(control);

                i++;
            }
        }