Update() public method

public Update ( ) : void
return void
Ejemplo n.º 1
0
        public override void Update()
        {
            base.Update();

            Back.Update();
            if (Back.Press())
            {
                Options.SaveOptions();
                SceneManager.ChangeScene(SceneManager.menuScene);
            }

            Controls.Update();
            if (Controls.Press())
            {
                SceneManager.ChangeScene(SceneManager.controlScene);
            }

            TutorialTips.Update();
            if (TutorialTips.Press())
            {
                TipsEnable               = !TipsEnable;
                TutorialTips.Write       = "Tips: " + TipsEnable.ToString();
                TutorialTips.NormalColor = TipsEnable ? Color.Green : Color.Red;
            }

            StarChanceSlider.Update();
            SoundVolumeSlider.Update();
            MusicVolumeSlider.Update();
        }
Ejemplo n.º 2
0
        private void Graphics_Update(object sender, EventArgs e)
        {
            if (!Active)
            {
                return;
            }

            // upate controls
            using (Profiler.StartSample("update controls"))
            {
                Controls.Update();
            }

            // update gamestate
            using (Profiler.StartSample("update app"))
            {
                _app.Update();
            }

            // update scene
            using (Profiler.StartSample("update scene"))
            {
                Scene.Update((float)Interval);
            }
        }
Ejemplo n.º 3
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     Controls.Update(gameTime);
     if (Game.isActive && EnableEvent)
     {
         UpdateEvent(gameTime);
     }
 }
Ejemplo n.º 4
0
        public void Update(GameTime gameTime)
        {
            if (WorldView.GameStatus == GameStatus.CityView)
            {
                return;
            }

            Controls["frmHudView.btnEndTurn"].Enabled = WorldView.AllStacksHaveBeenGivenOrders;

            Controls.Update(Input, gameTime, Viewport);
            WorldView.GetActionButtons.Update(Input, gameTime, Viewport);
        }
Ejemplo n.º 5
0
 protected void btnAdd_Click(Object Sender, EventArgs e)
 {
     if (Request.Form[hdnId.UniqueID] == "0")
     {
         oControl.Add(txtName.Text, txtDescription.Text, txtPath.Text, (chkSuper.Checked == true ? 1 : 0), (chkEnabled.Checked == true ? 1 : 0));
     }
     else
     {
         oControl.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, txtDescription.Text, txtPath.Text, (chkSuper.Checked == true ? 1 : 0), (chkEnabled.Checked == true ? 1 : 0));
     }
     Response.Redirect(Request.Path);
 }
Ejemplo n.º 6
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            Controls.Update();

            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            ObjectUtils.UpdateObjects(objects, deltaTime);

            Camera.Update(deltaTime);

            world.Step(deltaTime);

            base.Update(gameTime);
        }
Ejemplo n.º 7
0
Archivo: Game1.cs Proyecto: dgorb/Hex
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            GameManager.camera.applyOffset();
            GameManager.camera.enableControls();
            Controls.Update();
            GameManager.hexGrid.Visible   = true;
            UIManager.turnDisplay.Visible = true;
            UIManager.unitInfo.Visible    = true;

            if (TurnManager.currentTurn != null)
            {
                UIManager.turnDisplayText.Text = "Current turn: " + TurnManager.currentTurn.name;
            }
            UIManager.unitInfoText.Text = UnitManager.GetCurrentUnit().GetInformationString();
            MoveManager.MoveUpdate(UnitManager.GetCurrentUnit());
            base.Update(gameTime);
        }
Ejemplo n.º 8
0
        internal override void Update(GameTime _GT)
        {
            mControls.Update(PlayerIndex);
            if (Pawn is DummyPawn && mControls.AnyKey)
            {
                EventManager.Fire(Event.OnDummyPawnControlledPlayerClick, this); base.Update(_GT); return;
            }


            //DEBUG
            if (!(Pawn is DummyPawn))
            {
                if (InputManager.IsKeyClicked(Microsoft.Xna.Framework.Input.Keys.J))
                {
                    List <PsEmitterSpawnInstruction> instructions = new List <PsEmitterSpawnInstruction>();
                    instructions.Add(new PsEmitterSpawnInstruction(0, 10, new PsEmitterSettings(10 - 0, 5, 0.25, 10, PsPspCircle.Instance, ContentManager.Explosion(Pawn))));
                    ParticleEngine.Instance.SpawnCustomParticleSystem(Pawn.Position, instructions);
                }
            }


            base.Update(_GT);
        }
Ejemplo n.º 9
0
        public virtual void Update(GameTime gameTime)
        {
            mMouseState = Mouse.GetState();

            mMousePos.X = mMouseState.X;
            mMousePos.Y = mMouseState.Y;

            if (Visible && (Form.TopForm == this || Form.TopForm == null || Form.TopForm.CanLostFocus == true))
            {
                if (!Form.InUse)
                {
                    CheckFocus();
                }

                if (BtnClose != null)
                {
                    BtnClose.Update(gameTime);
                }
                if (BtnMini != null)
                {
                    BtnMini.Update(gameTime);
                }
                if (BtnMaxi != null)
                {
                    BtnMaxi.Update(gameTime);
                }
                if (BtnRestore != null)
                {
                    BtnRestore.Update(gameTime);
                }

                if (Controls.Count > 0)
                {
                    Controls.Update(gameTime, FormPos, FormSize);
                }

                if (CanDrag)
                {
                    if (mMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
                    {
                        if (!mDragging && !Form.InUse)
                        {
                            CheckDrag();
                        }
                        else if (mDragging)
                        {
                            if (mFormAlpha > 0.5f)
                            {
                                mFormAlpha -= 0.02f;
                            }
                            Drag();
                        }
                    }
                    else if (mDragging)
                    {
                        StopDrag();
                        mFormAlpha = 1f;
                    }
                }

                if (mCanResize)
                {
                    CheckResize();
                }

                if (Controls.Count > 0)
                {
                    Controls.Update(gameTime, FormPos, FormSize);
                }

                if (FormState == EFormState.Maximizing)
                {
                    Maximize();
                }
                else if (FormState == EFormState.Minimizing)
                {
                    Minimize();
                }
                else if (FormState == EFormState.Restoring)
                {
                    Restore();
                }

                if (Form.TopForm == this)
                {
                    CheckKeyboardState();
                }

                UpdateVisibility();
            }
        }
Ejemplo n.º 10
0
    private void Update()
    {
        if (!GameManager.Instance.running || _isDead)
        {
            if (_isDead)
            {
                if (_audioSource1.clip != dyingAudio)
                {
                    _audioSource1.clip = dyingAudio;
                    _audioSource1.loop = false;
                    _audioSource1.Play();
                }
            }

            return;
        }

        Controls.Update();

        float speed = baseSpeed;

        if (Controls.Sprinting() && sprintBar.Percent > 0)
        {
            speed = sprintSpeed;
            if (!_particleSystem.isPlaying)
            {
                _particleSystem.Play();
            }
            _animator.SetBool("Running", true);
            sprintBar.DecreaseBy(Time.deltaTime * staminaDepleteSpeed);

            _staminaLastUsedTimeStamp = Time.time;

            if (!_audioSource1.isPlaying)
            {
                _audioSource1.Play();
            }
            _audioSource1.pitch = 1.5f;
        }
        else
        {
            if (_particleSystem.isPlaying)
            {
                _particleSystem.Stop();
            }

            _animator.SetBool("Running", false);

            if (Time.time - _staminaLastUsedTimeStamp >= timeBeforeStaminaRegen)
            {
                sprintBar.DecreaseBy(-Time.deltaTime * staminaRegenSpeed);
            }

            _audioSource1.Stop();
        }

        _rigidbody.velocity = Vector3.zero;

        //if (Controls.Moving())
        // Always moving?
        transform.position += transform.forward * Time.deltaTime * speed;

        transform.Rotate(0, Controls.GetTurnBy() * Time.deltaTime, 0);
    }
Ejemplo n.º 11
0
    protected override void Update()
    {
        if (Owner.BlackBoard.Stop)
        {
            Controls.Update();
            return;
        }

        base.Update();

        Controls.Update();

        if (Owner.IsAlive == false)
        {
            return;
        }

        if (Camera.main == null)
        {
            return;
        }

        if (Controls.Use)
        {
            CreateOrderUse();
        }

        if (Controls.Move.Enabled && Controls.Move.Direction != Vector3.zero)
        {
            //Debug.DrawLine(Agent.Position + Vector3.up, Agent.Position + Vector3.up + Controls.MoveJoystick.Direction * Controls.MoveJoystick.Force * 4);

            bool canMove = true;

            if (Owner.IsEnteringToCover || IsLeavingCover || IsRolling || Owner.IsInKnockdown)
            {
                canMove = false;
            }
            else if (Owner.IsInCover)
            {
                float dotRight   = Vector3.Dot(Owner.BlackBoard.Cover.Right, Controls.Move.Direction);
                float dotForward = Vector3.Dot(Owner.BlackBoard.Cover.Forward, Controls.Move.Direction);

                //AgentActionCoverMove.E_Direction DesiredDirection;

                canMove = false;
                if (dotForward > 0.75f)
                {
                    canMove = true;
                }
                else if (dotForward < -0.75f)                 //move
                {
                    canMove = true;
                }
                else
                {
                    if (dotRight > 0)
                    {
                        Vector3 edgePos = Owner.BlackBoard.Cover.RightEdge;
                        edgePos.y = Owner.Position.y;

                        if ((Owner.Position - edgePos).magnitude > Mathf.Epsilon)
                        {
                            canMove = Owner.RestrictedCoverMove(AgentActionCoverMove.E_Direction.Right, 0.1f, true);
                        }
                    }
                    else if (dotRight < 0)
                    {
                        Vector3 edgePos = Owner.BlackBoard.Cover.LeftEdge;
                        edgePos.y = Owner.Position.y;

                        if ((Owner.Position - edgePos).magnitude > Mathf.Epsilon)
                        {
                            canMove = Owner.RestrictedCoverMove(AgentActionCoverMove.E_Direction.Left, 0.1f, true);
                        }
                    }
                }
            }

            if (canMove)
            {
                Owner.BlackBoard.Desires.MoveDirection = Controls.Move.Direction;

                Owner.BlackBoard.Desires.MoveSpeedModifier = Controls.Move.Force;
                if (Owner.BlackBoard.Desires.MoveSpeedModifier > 1)
                {
                    Owner.BlackBoard.Desires.MoveSpeedModifier = 1;
                }

                Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, false);
            }
            else
            {
                Owner.BlackBoard.Desires.MoveDirection     = Vector3.zero;
                Owner.BlackBoard.Desires.MoveSpeedModifier = 0;
                Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, true);
            }
        }
        else
        {
            Owner.BlackBoard.Desires.MoveDirection     = Vector3.zero;
            Owner.BlackBoard.Desires.MoveSpeedModifier = 0;
            Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, true);
        }

        if (Owner.BlackBoard.MotionType != E_MotionType.Roll)
        {
            Vector3 add = new Vector3(Controls.View.PitchAdd, Controls.View.YawAdd);

            add *= GameCamera.Instance.GetFovRatioExp();

            Owner.BlackBoard.Desires.Rotation.eulerAngles += add;
            ClipRotation();
        }

        //remove sprint of gadget is empty
        if (Owner.IsInCover || Owner.IsEnteringToCover || Owner.IsLeavingToCover ||
            (Owner.GadgetsComponent.IsPerkAvailableForUse(E_PerkID.Sprint) == false &&
             Owner.GadgetsComponent.IsPerkAvailableForUse(E_PerkID.SprintII) == false &&
             Owner.GadgetsComponent.IsPerkAvailableForUse(E_PerkID.SprintIII) == false)
            )
        {
            Owner.BlackBoard.Desires.Sprint = false;
        }

        // Debug.Log(Controls.View.YawAdd + " " + Controls.View.PitchAdd);

        //UpdateIdealFireDir();
        UpdateWeaponFireDir();

        // reset controls
        Controls.Move.ZeroInput();
        Controls.View.ZeroInput();
        Controls.Use = false;
    }