static Core() { Inputs = new InputCollection (); CurrentCulture = CultureInfo.CurrentCulture; FixedUpdateTimeStep = TimeSpan.FromSeconds ( 1.0f / 60 ); FixedDrawTimeStep = TimeSpan.FromSeconds ( 1.0f / 60 ); }
public QueriesCore(string instance, bool distinctNeeded) { // TODO: Complete member initialization this._distinctNeeded = distinctNeeded; _cepServer = Server.Create(instance); _cepApplication = _cepServer.CreateApplication("Monitor"); _pingSource = new InputCollection<PageRequest>(); _pingSourceGathering = new InputCollection<PageRequest>(); _pingInputStream = _pingSource.ToPointStream( _cepApplication, s => PointEvent.CreateInsert(DateTime.UtcNow, s), AdvanceTimeSettings.IncreasingStartTime, "PagePingStream"); _pingInputStreamGathering = _pingSourceGathering.ToPointStream( _cepApplication, s => PointEvent.CreateInsert(DateTime.UtcNow, s), AdvanceTimeSettings.IncreasingStartTime, "PagePingStream"); }
//This takes care of moving the player public void move(InputCollection col) { //rotate player arms if(playerArms != null) { float armRot = playerArms.localRotation.eulerAngles.x - col.turnUp; if(!((armRot <= 60 && armRot >= -5) || (armRot >= 270 && armRot <= 365))) { col.turnUp = 0.0f; } playerArms.Rotate(new Vector3(-col.turnUp,0,0)); } Vector3 playerMotion = new Vector3(col.straff, 0, col.forward) * playerStats.speed;//transform.TransformDirection(new Vector3(col.straff, 0, col.forward)) * playerStats.speed;//inial player speed //Gravity isn't always down. We cannot trust unitys built in "grounded" function, instead we use its "raycast" function to see what is below us. if(col.jump) { if(Physics.Raycast(transform.position, -transform.up, 1.0f)) { playerMotion += playerStats.jump * Vector3.up;//objectStats.unitOppGrav; //JUMP IS NOT RELATIVE TO PLAYER } // var toRotateLine = Quaternion.FromToRotation(objectStats.unitOppGrav, objectStats.normalOfLastHit); // playerMotion = toRotateLine * playerMotion; } //Moves the player according to the input move(playerMotion, Quaternion.Euler(0,col.turnRight,0)); }
public XnaMenu(string alias, InputCollection inputs, List <XnaMenuItem> xnaMenuItems) : this(alias, inputs) { XnaItems.AddRange(xnaMenuItems); }
public XnaMenu(string alias, InputCollection inputs) : base(alias) { Inputs = inputs; }
public virtual void InitializeInputs() { keyMapCollections = GetDefaultControls(); inputManager = new InputManager(this.name, keyMapCollections); }
public void Setup() { canPlay = true; stateMachine = new StateMachine(StateCollection.FromEnum <States>(), InputCollection.FromEnum <Input>(), new DictionaryStateTransitionTable(), States.Begin.ToString()); stateMachine.Define(new BinaryTransition(States.Begin.ToString(), Input.Play.ToString(), States.Playing.ToString(), States.End.ToString(), () => { if (canPlay) { return(new BinaryTransitionResult(BinaryChoice.Left, "Started Playing")); } else { return(new BinaryTransitionResult(BinaryChoice.Right, "Could not start playing")); } }, "Start Playing")); stateMachine.Define(new InvalidTransition(States.Begin.ToString(), Input.Pause.ToString(), "Must be Playing to Pause")); stateMachine.Define(new UnaryTransition(States.Begin.ToString(), Input.Stop.ToString(), States.End.ToString(), () => { return(new UnaryTransitionResult("Stopped")); }, "Stop before playing")); stateMachine.Define(new UnaryTransition(States.Playing.ToString(), Input.Play.ToString(), States.Playing.ToString(), () => { return(new UnaryTransitionResult("Kept playing")); }, "Already Playing")); stateMachine.Define(new UnaryTransition(States.Playing.ToString(), Input.Pause.ToString(), States.Paused.ToString(), () => { return(new UnaryTransitionResult("Paused playback")); }, "Already Playing")); stateMachine.Define(new UnaryTransition(States.Playing.ToString(), Input.Stop.ToString(), States.End.ToString(), () => { return(new UnaryTransitionResult("Stopped")); }, "Stopped")); stateMachine.Define(new BinaryTransition(States.Paused.ToString(), Input.Play.ToString(), States.Playing.ToString(), States.End.ToString(), () => { if (canPlay) { return(new BinaryTransitionResult(BinaryChoice.Left, "Resumed Playback")); } else { return(new BinaryTransitionResult(BinaryChoice.Right, "Could not Resumed Playback")); } }, "Resume Playback")); stateMachine.Define(new UnaryTransition(States.Paused.ToString(), Input.Pause.ToString(), States.Paused.ToString(), () => { return(new UnaryTransitionResult("Already Paused")); }, "Already Paused")); stateMachine.Define(new UnaryTransition(States.Paused.ToString(), Input.Stop.ToString(), States.End.ToString(), () => { return(new UnaryTransitionResult("Stopped")); }, "Stopped")); stateMachine.Define(new InvalidTransition(States.End.ToString(), Input.Play.ToString(), "Cannot play from end state")); stateMachine.Define(new InvalidTransition(States.End.ToString(), Input.Pause.ToString(), "Cannot pause from end state")); stateMachine.Define(new InvalidTransition(States.End.ToString(), Input.Stop.ToString(), "Cannot stop from end state")); }