Example #1
0
 public void Update(float delta)
 {
     State = Constants.Scene.SCENE_STATE.RUNNING;
     gameObjectManager.Update(delta);
     Camera.Update(gameObjectManager.unit);
     ParticlesProcessor.Update();
     UIProcessor.Update(delta);
 }
Example #2
0
 public void LoadContent(Game1 game)
 {
     State = Constants.Scene.SCENE_STATE.LOADING;
     gameObjectManager.LoadContent(game);
     ParticlesProcessor.LoadContent(game);
     AudioProcessor.LoadContentAndPlay(game);
     UIProcessor.LoadContent(game);
 }
Example #3
0
        public void Draw(Game1 game)
        {
            var spriteBatch = game.spriteBatch;

            game.GraphicsDevice.SetRenderTarget(game.nativeRenderTarget);
            game.GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.FrontToBack, samplerState: SamplerState.PointClamp);
            gameObjectManager.Draw(spriteBatch);
            ParticlesProcessor.Draw(spriteBatch);
            spriteBatch.End();

            game.GraphicsDevice.SetRenderTarget(null);
            spriteBatch.Begin(samplerState: SamplerState.PointClamp);
            spriteBatch.Draw(game.nativeRenderTarget, new Rectangle(0, 0, Constants.DEFAULT_ZOOMING_MODIFIER * Constants.RESOLUTION_WIDTH, Constants.DEFAULT_ZOOMING_MODIFIER * Constants.RESOLUTION_HEIGHT), Color.White);
            UIProcessor.Draw(spriteBatch, gameObjectManager.unit);
            spriteBatch.End();
        }
Example #4
0
        private bool Attack(GameObject unit, GameObject objective)
        {
            if (unit.StatsComponent.Clock > unit.StatsComponent.HitIntervalLastTicks + Constants.Unit.DEFAULT_UNIT_HIT_INTERVAL - unit.StatsComponent.IntervalModifier)
            {
                var targetPosition = unit.PhysicsComponent.position;

                switch (unit.PhysicsComponent.FacingDirection)
                {
                case FacingDirections.UP:
                    targetPosition -= new Vector2(0, Constants.TILESIZE);
                    break;

                case FacingDirections.DOWN:
                    targetPosition += new Vector2(0, Constants.TILESIZE);
                    break;

                case FacingDirections.LEFT:
                    targetPosition -= new Vector2(Constants.TILESIZE, 0);
                    break;

                case FacingDirections.RIGHT:
                    targetPosition += new Vector2(Constants.TILESIZE, 0);
                    break;
                }

                if (objective != null && StatsProcessor.CheckIfAlive(objective.StatsComponent) && PhysicsProcessor.GetDistanceFromUnit(unit.PhysicsComponent, objective.PhysicsComponent) <= 1)
                {
                    AudioProcessor.PlaySoundEffect(Constants.SoundEffects.FXSounds.HIT);
                    unit.StatsComponent.HitIntervalLastTicks = unit.StatsComponent.Clock;
                    StatsProcessor.TakeDamage(objective.StatsComponent, unit.StatsComponent.Damage);
                    ParticlesProcessor.NewParticleStreamAt(Constants.Particles.DEFAULT_ATTACK_PARTICLES_AMMOUNT, objective.PhysicsComponent.position, Constants.Particles.ParticlesStyle.ATTACK);
                    UIProcessor.SetFloatingText(Constants.UI.DEFAULT_FLOATING_TEXT_DURATION, "-" + unit.StatsComponent.Damage, objective.PhysicsComponent.position, Color.Red);
                    if (!StatsProcessor.CheckIfAlive(objective.StatsComponent))
                    {
                        StatsProcessor.GainExperience(unit, objective.StatsComponent.ExperienceReward);
                    }
                }
            }

            return(false);
        }
Example #5
0
        public string WorkflowProcess(string wid, DataSet PostDataSet)
        {
            Workflow.Core.Workflow wf = Workflow.Core.Workflow.CreateWorkflow(context, wid);
            WorkflowConfig.ConnString = PlugAreaRegistration.CONN;
            ManualStepConfig config = wf.CurrentStep.Config as ManualStepConfig;

            AtawDebug.AssertNotNull(config, "调用时机有误,当前的步骤必须是人工步骤,现在不是", this);

            WorkflowContent content = WorkflowInstUtil.CreateContent(wf.WorkflowRow);

            if (!string.IsNullOrEmpty(config.Process.UIOperation.RegName))
            {
                UIProcessor processor = AtawIocContext.Current.FetchInstance <UIProcessor>(
                    config.Process.UIOperation.PlugIn);
                processor.Config  = config;
                processor.Source  = context;
                processor.Content = content;

                processor.UIData = PostDataSet;
                processor.Execute(wf.WorkflowRow);
                WorkflowInstUtil.ManualSendWorkflow(wf.WorkflowRow, GlobalVariable.UserId, processor);
            }
            else
            {
                wf.WorkflowRow.WI_PROCESS_ID   = GlobalVariable.UserId.ToString();
                wf.WorkflowRow.WI_PROCESS_DATE = context.Now;
                wf.WorkflowRow.WI_STATUS       = (int)StepState.ProcessNotSend;
            }
            //context.Submit();
            wf.UpdateState(ManualPNSState.Instance);
            string url = wf.GetWorkflowUrl();
            JsResponseResult <string> res = new JsResponseResult <string>()
            {
                ActionType = JsActionType.Url,
                Content    = url
            };

            return(res.ToJSON());
        }