예제 #1
0
    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);
        }
    }
예제 #2
0
        public unsafe bool GetPstateFlag(PState flag)
        {
            if ((uint)flag >= RegisterConsts.FlagsCount)
            {
                throw new ArgumentException($"Invalid flag \"{flag}\" specified.");
            }

            return(GetStorage().Flags[(int)flag] != 0);
        }
예제 #3
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;
        }
예제 #4
0
    // 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>();
    }
예제 #5
0
 public virtual void Transition(PState nextState)
 {
     /* Only Allow one transition per Fixed Update.*/
     if (!isTransitioning)
     {
         isTransitioning = true;
         curState.OnStateExit();
         nextState.OnStateEnter();
         curState = nextState;
     }
 }
예제 #6
0
 public void GetNextPlayerState()
 {
     if (playerState != PState.Wait)
     {
         playerState += 1;
     }
     else
     {
         playerState = PState.CheckArrow;
         gameState   = GState.EnemyTurn;
     }
 }
예제 #7
0
 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;
     }
 }
예제 #8
0
        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);
        }
예제 #9
0
    void RpcTakeHit(Vector3 vel)
    {
        if (Mathf.Abs(vel.y) <= 0.001)
        {
            planeVel = vel;
        }
        else
        {
            rb.velocity = vel;
        }

        current = PState.KB;
        setSprint(false);
    }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
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;
        }
예제 #13
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);
            }
        }
예제 #14
0
 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);
     }
 }
예제 #15
0
 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);
 }
예제 #16
0
파일: Player.cs 프로젝트: fishtaco567/LD48
        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;
        }
예제 #17
0
        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;
         }
     }
 }
예제 #19
0
        /// <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);
        }
예제 #20
0
        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;
        }
예제 #21
0
 void Update()
 {
     horizontalAxis = playerControls.GetAxis("Horizontal");
     verticalAxis   = playerControls.GetAxis("Vertical");
     CurrentState   = EvaluateState();
 }
예제 #22
0
 public void AddState(PState s)
 {
     States.Add(s.State, s);
 }
예제 #23
0
        public static void SetFlag(ArmEmitterContext context, PState stateFlag, Operand value)
        {
            context.Copy(GetFlag(stateFlag), value);

            context.MarkFlagSet(stateFlag);
        }
예제 #24
0
 public static Operand GetFlag(PState stateFlag)
 {
     return(Register((int)stateFlag, RegisterType.Flag, OperandType.I32));
 }
예제 #25
0
 public override void Transition(PState nextState)
 {
     base.Transition(nextState);
 }
예제 #26
0
 public static void SetState(PState stateToSet)
 {
     playerState = stateToSet;
 }
예제 #27
0
 // Start is called before the first frame update
 void Start()
 {
     playerState = PState.CheckArrow;
     gameState   = GState.PlayerTurn;
     enemyState  = EState.Attack;
 }
예제 #28
0
 public void SetPstateFlag(PState flag, bool value) => _nativeContext.SetPstateFlag(flag, value);
예제 #29
0
 public bool GetPstateFlag(PState flag) => _nativeContext.GetPstateFlag(flag);
예제 #30
0
 public override void Transition(PState nextState)
 {
     base.Transition(nextState); // Calls exit and enter methods for prev and next state respectively.
 }