public void changeState(PState newState) { velX = 0; velY = 0; accX = 0; accY = 0; state = newState; if (state == PState.Attacking) { switch (getMove()) { case Move.Charge: collider.offset = new Vector2(0f, -0.06f); collider.size = new Vector2(0.9f, 0.9f); break; case Move.Block: collider.offset = new Vector2(0f, -0.06f); collider.size = new Vector2(1.1f, 0.8f); break; case Move.Push: collider.offset = new Vector2(0f, -0.2f); collider.size = new Vector2(2.5f, 0.95f); break; } } else { collider.offset = new Vector2(0f, -0.06f); collider.size = new Vector2(0.6f, 0.6f); } }
public unsafe bool GetPstateFlag(PState flag) { if ((uint)flag >= RegisterConsts.FlagsCount) { throw new ArgumentException($"Invalid flag \"{flag}\" specified."); } return(GetStorage().Flags[(int)flag] != 0); }
public unsafe void SetPstateFlag(PState flag, bool value) { if ((uint)flag >= RegisterConsts.FlagsCount) { throw new ArgumentException($"Invalid flag \"{flag}\" specified."); } GetStorage().Flags[(int)flag] = value ? 1u : 0u; }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); col = GetComponent <CapsuleCollider>(); hp = GetComponent <Health>(); current = PState.Free; look = LookState.Free; vis = GetComponent <Visuals>(); buffholder = GetComponent <BuffableLoose>(); }
public virtual void Transition(PState nextState) { /* Only Allow one transition per Fixed Update.*/ if (!isTransitioning) { isTransitioning = true; curState.OnStateExit(); nextState.OnStateEnter(); curState = nextState; } }
public void GetNextPlayerState() { if (playerState != PState.Wait) { playerState += 1; } else { playerState = PState.CheckArrow; gameState = GState.EnemyTurn; } }
public void MarkFlagSet(PState stateFlag) { // Set this only if any of the NZCV flag bits were modified. // This is used to ensure that when emiting a direct IL branch // instruction for compare + branch sequences, we're not expecting // to use comparison values from an old instruction, when in fact // the flags were already overwritten by another instruction further along. if (stateFlag >= PState.VFlag) { _optOpLastFlagSet = CurrOp; } }
public void SetPstateFlag(PState flag, bool value) { if ((uint)flag >= RegisterConsts.FlagsCount) { throw new ArgumentException($"Invalid flag \"{flag}\" specified."); } int offset = RegisterConsts.IntRegsCount * IntSize + RegisterConsts.VecRegsCount * VecSize + (int)flag * FlagSize; Marshal.WriteInt32(BasePtr, offset, value ? 1 : 0); }
void RpcTakeHit(Vector3 vel) { if (Mathf.Abs(vel.y) <= 0.001) { planeVel = vel; } else { rb.velocity = vel; } current = PState.KB; setSprint(false); }
void loadInput(IStatement input) { System.Console.WriteLine("\n...... LOADING: " + input.ToString() + '\n'); repo.clearAll(); IStack <IStatement> exe_stack = new MyStack <IStatement>(); IMap <string, int> sym_table = new MyMap <string, int>(); IMap <int, FileTuple> files_table = new MyMap <int, FileTuple>(); IList <int> out_stream = new MyList <int>(); exe_stack.push(input); PState state = new PState(exe_stack, sym_table, out_stream, files_table); repo.addPState(state); }
public bool GetPstateFlag(PState flag) { if ((uint)flag >= RegisterConsts.FlagsCount) { throw new ArgumentException($"Invalid flag \"{flag}\" specified."); } int offset = RegisterConsts.IntRegsCount * IntSize + RegisterConsts.VecRegsCount * VecSize + (int)flag * FlagSize; int value = Marshal.ReadInt32(BasePtr, offset); return(value != 0); }
public void Initalize(Vector2 pos) { mCurrentSequence = new SpriteSequence(); mSequenceMap = new Dictionary <string, SpriteSequence>(); mPosition = pos; mLives = 3; mBombs = 3; mScore = 0; mSpeed = 5; mPlayerState = PState.idle; mHitbox = new Rectangle(0, 0, 4, 4); mTick = 0.0; }
public PState runStep(PState state) { IStack <IStatement> stk = state.getStack(); // error if (stk.isEmpty()) { throw new MyException("CON_ERR: reached empty stack"); } try { IStatement stm = stk.pop(); return(stm.execute(state)); } catch (MyException myEx) { throw new MyException("EVAL_ERR: \\ " + myEx.Message); } }
public void allStep() { try { PState state = repo.getPState(); // print System.Console.WriteLine(state.ToString()); while (!state.getStack().isEmpty()) { runStep(state); // print System.Console.WriteLine(state.ToString()); } } catch (MyException myEx) { throw new MyException("CON_ERR: run step \\ " + myEx.Message); } }
public void SetState(PlayerState s) { if (State != null && State.State == s) { return; } if (!States.ContainsKey(s)) { Debug.Log("ATTEMPTED TO USE INVALID STATE: " + s); return; } if (State != null) { State.OnEnd(this); } State = States[s]; State.OnStart(this); }
public override void Start() { base.Start(); rand = new Utils.SRandom((uint)System.DateTime.Now.Millisecond); velocity = Vector2.zero; state = PState.Normal; stateTime = 0; runDirection = Vector2.right; info.yHeight = 0; playerYVelocity = 0; curBombs = maxBombs; grounded = true; rePlayer = ReInput.players.GetPlayer(0); results = new Collider2D[5]; interactFilter = new ContactFilter2D(); interactFilter.SetLayerMask(LayerMask.GetMask("Interact")); hittableFilter = new ContactFilter2D(); hittableFilter.SetLayerMask(hittable); timeSinceLastBomb = bombDelay; curDir = Direction.Up; effects = new List <Effect>(); isDead = false; maxPowerups = 0; var res = GetComponent <Resources>(); res.OnDeath += OnDeath; res.OnHit += OnHit; }
public override void Update(GameTime gameTime) { KeyboardState state = Keyboard.GetState(); // Pause/Unpause and pause/resume music if (state.IsKeyDown(Keys.P) && PState.IsKeyUp(Keys.P)) { IsPaused = !IsPaused; SLocator.AManager.PauseOrResume(); } // Check of we faded an start sound effect play if (IsFaded && !IsSoundOver) { IsSoundOver = true; SLocator.AManager.Play(SongTypes.LAUGH); } if (IsFaded && !IsSongStart && !SLocator.AManager.IsSoundPlaying) { IsSongStart = true; SLocator.AManager.Play(SongTypes.INGAME); } this.PState = state; // If not paused, update world if (!IsPaused) { WCore.Update(gameTime); } //If player is dead start fade out if (!WCore.IsPlayerAlive) { StartFade(); } // switch to dead screen if faded if (!WCore.IsPlayerAlive && IsFaded) { SManager.SwitchScreen(ScreenTypes.DEAD, WCore.PSCore); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.GetComponent <PBehaviour>() is PBehaviour) { if (triggerType.Equals("Stop Player")) { PScytheMovement player = collision.gameObject.GetComponent <PScytheMovement>(); PState Waiting = new PState(); player.Transition(Waiting); player.velocity = Vector2.zero; StartCoroutine(WaitForParticleSpawn()); } else if (triggerType.Equals("Start Bloom")) { StartCoroutine(DoBloomSmoothing()); //mainBloom.softKnee = .4f; } } }
/// <summary> /// Получить состояние /// </summary> /// <param name="guid">GUID состояния</param> /// <returns>возвращает состояние или NULL, если состояние не найдено</returns> public static PState GetState(Guid guid) { PState state = _states.FirstOrDefault(s => s.Guid == guid); if (state != null) { return(state); } List <MUserState> states = Global.DALContext.Repository.GetStates(); MUserState mUserState = states.FirstOrDefault(s => s.Id == guid); if (mUserState == null) { return(null); } state = new PState(mUserState); _states.Add(state); return(state); }
public override void Update(GameTime gameTime) { KeyboardState state = Keyboard.GetState(); // Start fading out if (state.IsKeyDown(Keys.Space) && PState.IsKeyUp(Keys.Space) && IsFaded) { StartFade(); IsReady = true; } // switch to game screen when pressed if (IsReady && IsFaded) { SManager.SwitchScreen(ScreenTypes.GAME); } else if (IsReady && !IsFaded) { SLocator.AManager.Mute(FadeRatio); } this.PState = state; }
void Update() { horizontalAxis = playerControls.GetAxis("Horizontal"); verticalAxis = playerControls.GetAxis("Vertical"); CurrentState = EvaluateState(); }
public void AddState(PState s) { States.Add(s.State, s); }
public static void SetFlag(ArmEmitterContext context, PState stateFlag, Operand value) { context.Copy(GetFlag(stateFlag), value); context.MarkFlagSet(stateFlag); }
public static Operand GetFlag(PState stateFlag) { return(Register((int)stateFlag, RegisterType.Flag, OperandType.I32)); }
public override void Transition(PState nextState) { base.Transition(nextState); }
public static void SetState(PState stateToSet) { playerState = stateToSet; }
// Start is called before the first frame update void Start() { playerState = PState.CheckArrow; gameState = GState.PlayerTurn; enemyState = EState.Attack; }
public void SetPstateFlag(PState flag, bool value) => _nativeContext.SetPstateFlag(flag, value);
public bool GetPstateFlag(PState flag) => _nativeContext.GetPstateFlag(flag);
public override void Transition(PState nextState) { base.Transition(nextState); // Calls exit and enter methods for prev and next state respectively. }