当前位置: 首页>>代码示例>>C#>>正文


C# Entity.Get方法代码示例

本文整理汇总了C#中Entity.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Get方法的具体用法?C# Entity.Get怎么用?C# Entity.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateEntity

 protected override void UpdateEntity(float dt, Entity entity)
 {
     var position = entity.Get<Position>();
     var prev = entity.Get<PreviousPosition>();
     position.X.CopyTo(prev.X, 0);
     position.Y.CopyTo(prev.Y, 0);
 }
开发者ID:LorenzJ,项目名称:ComponentTest,代码行数:7,代码来源:PreviousPositionTracker.cs

示例2: Assign

 public static void Assign(this UpdatePositionMsg msg, Entity entity)
 {
     msg.Id = entity.Id;
     msg.X = entity.Get<Pos>().X;
     msg.Y = entity.Get<Pos>().Y;
     msg.Dir = entity.Get<Motion>().Dir;
     msg.Speed = entity.Get<Motion>().Dir;
 }
开发者ID:ktj007,项目名称:mmo,代码行数:8,代码来源:MessageEntityExtension.cs

示例3: GetEffectiveBody

        public static Body GetEffectiveBody(Entity e)
        {
            var body = e.Get(Body);
            if (body == null) {
                return null;
            }

            var position = e.Get(Located.Position);
            return body.Offset(position);
        }
开发者ID:strager,项目名称:SpermGame,代码行数:10,代码来源:Collidable.cs

示例4: UpdateEntity

        protected override void UpdateEntity(float dt, Entity entity)
        {
            var position = entity.Get<Position>();
            var direction = entity.Get<Direction>();

            for (int i = 0; i < entity.Count(); ++i)
            {
                position.X[i] += direction.X[i] * dt;
                position.Y[i] += direction.Y[i] * dt;
            }
        }
开发者ID:LorenzJ,项目名称:ComponentTest,代码行数:11,代码来源:Movement.cs

示例5: Kill

        public static bool Kill(Entity zombie, Vector2? explosionVelocity)
        {
            const float LotsOfDamage = 1000 * 1000;
            zombie.Get<CHealth>().TakeDamage(LotsOfDamage);
            if (explosionVelocity.HasValue)
            {
                ZombieHelper.TriggerBloodExplosion(zombie.Transform, explosionVelocity.Value);
            }

            zombie.Get<CZombieInfo>().SetKillReason(KillReason.Instakill);
            return true;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:12,代码来源:ZombieHelper.cs

示例6: Attach

	public static void Attach(Entity result, Property<Matrix> property = null)
	{
		AkGameObjectTracker tracker = result.Get<AkGameObjectTracker>();
		if (tracker == null)
		{
			tracker = new AkGameObjectTracker();
			result.Add(tracker);
			if (property == null)
				property = result.Get<Transform>().Matrix;
			tracker.Add(new Binding<Matrix>(tracker.Matrix, property));
		}
	}
开发者ID:sparker,项目名称:Lemma,代码行数:12,代码来源:AkGameObjectTracker.cs

示例7: OnTick

        internal void OnTick(Entity entity, TickMessage tick)
        {
            // 로그아웃 한 상태에서 Tickable이 남아있는 유저는 Tick을 수행하지 않도록 한다.
            if (entity.Has<Player>() && !entity.Get<Player>().Logged)
            {
                entity.Detach<Tickable>();
                return;
            }

            if (entity.Has<Fightable>())
            {
                var fightable = entity.Get<Fightable>();
                if (fightable.IsAlive)
                {
                    if (++fightable.RecoveryCurrentTick >= fightable.RecoveryTickCount)
                    {
                        var recovery = DataCenter.Instance.GetDatum<InteractTemplate>((int)InteractTemplate.Ids.Recovery);
                        EffectSystem.Affect(entity, recovery);

                        fightable.RecoveryCurrentTick = 0;
                    }
                }
            }

            if (entity.Has<Eatable>())
            {
            }

            if (entity.Has<EntityGenerate>())
            {
                var entityGenerate = entity.Get<EntityGenerate>();
                if (entityGenerate.IsGeneratable)
                {
                    if (entityGenerate.Resource >= entityGenerate.NeededResourceToGen)
                    {
                        // generate!

                        entityGenerate.Resource -= entityGenerate.NeededResourceToGen;
                    }

                    entityGenerate.Resource += entityGenerate.IncResource;
                }
            }

            // 다음 Tick을 요청한다.
            if (entity.Has<Tickable>())
            {
                var nextMsg = new TickMessage {Id = entity.Id};
                nextMsg.ExecuteDelayed(entity, entity.Get<Tickable>().Interval);
            }
        }
开发者ID:ktj007,项目名称:mmo,代码行数:51,代码来源:Tick.cs

示例8: Initialize

        public override void Initialize()
        {
            this.RegisterSystems();

            FPSCamera camera = new FPSCamera(new Vector3(0f, 0f, 0f), Vector3.Zero,
                Blackboard.Get<GraphicsDevice>("GraphicsDevice").Viewport.AspectRatio, 0.05f, 100f);

            Entity fpscounter = new Entity();
            fpscounter.AddComponent(new Transform2DComponent() { Position = new Vector2(5, 150) });
            fpscounter.AddComponent(new FPSCounterComponent());
            fpscounter.AddComponent(new GUITextComponent());

            Entity pos = new Entity();
            pos.AddComponent(new PositionalTrackingComponent() { Target = camera.Get<Transform3DComponent>() });
            pos.AddComponent(new GUITextComponent());
            pos.AddComponent(new Transform2DComponent() { Position = new Vector2(5, 180) });

            Entity model = new Entity();
            model.AddComponent(new Transform3DComponent(new Vector3(0f, -1f, 2f)));
            model.Get<Transform3DComponent>().Rotation = new Vector3(0f, MathHelper.PiOver2, 3f*MathHelper.PiOver2);
            Model m = Blackboard.Get<ContentManager>("ContentManager").Load<Model>("dragon");
            model.AddComponent(new ModelComponent() { Model = m });

            this.AddEntity(model);
            this.AddEntity(pos);
            this.AddEntity(fpscounter);
            this.AddEntity(camera);
        }
开发者ID:TheCommieDuck,项目名称:Pancakes,代码行数:28,代码来源:WaffleCatWorld.cs

示例9: OnEntityAdded

 public override void OnEntityAdded(Entity entity)
 {
     if (entity.ComponentTypes.Contains(typeof(InputComponent)))
     {
         _inputComponent = entity.Get<InputComponent>();
     }
 }
开发者ID:LorenzJ,项目名称:ComponentTest,代码行数:7,代码来源:Input.cs

示例10: TakeDamage

        public static bool TakeDamage(Entity zombie, float damage, Vector2? explosionVelocity)
        {
            CHealth health = zombie.Get<CHealth>();
            if (!health.IsAlive)
            {
                return true;
            }

            IBoosterState boosterState = zombie.EntityWorld.Services.Get<IBoosterState>();
            bool killed = health.TakeDamage(damage * BoosterHelper.GetZombieDamageRedcutionMultiplier(boosterState));
            if (explosionVelocity.HasValue)
            {
                if (killed)
                {
                    ZombieHelper.TriggerBloodExplosion(zombie.Transform, explosionVelocity.Value);
                }
                else
                {
                    ZombieHelper.TriggerBloodSplatter(zombie.Transform, Vector2.Zero);
                }
            }

            if (killed)
            {
                zombie.Get<CZombieInfo>().SetKillReason(KillReason.Normal);
            }

            return killed;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:29,代码来源:ZombieHelper.cs

示例11: UpdateEntity

        protected override void UpdateEntity(float dt, Entity entity)
        {
            if (entity.Count() == 0)
            {
                return;
            }
            var direction = entity.Get<Direction>();
            var position = entity.Get<Position>();
            var input = entity.Get<InputComponent>();
            var hotspots = entity.Get<Hotspots>();

            float accel = dt * 0.8f;
            if (input.Right)
            {
                direction.X[0] = direction.X[0] + accel * (24.0f - direction.X[0]);
            }
            if (input.Left)
            {
                direction.X[0] = direction.X[0] + accel * (-24.0f - direction.X[0]);
            }
            if (!(input.Left || input.Right))
            {
                if (hotspots.BottomHit[0])
                {
                    direction.X[0] = direction.X[0] + dt * (0 - direction.X[0]);
                }
                else
                {
                    direction.X[0] = direction.X[0] + dt * .1f * (0 - direction.X[0]);
                }
            }
            if (input.Jump && hotspots.BottomHit[0])
            {
                if (input.Down)
                {
                    direction.Y[0] = 1.5f;
                    entity.Transform(0, input.DroppingPlayer);
                    input.DroppingPlayer.Get<TypeChanger>().Transformation = entity;
                    input.DroppingPlayer.Get<TypeChanger>().TTL = 0.8f;
                }
                else
                {
                    direction.Y[0] = -32.0f;
                }
            }
        }
开发者ID:LorenzJ,项目名称:ComponentTest,代码行数:46,代码来源:Input.cs

示例12: Update

 public override void Update()
 {
     if(Game.IsRunning && Entity.Components.Get<UIComponent>(UIComponent.Key).Enabled)
     {
         castle = (from entities in SceneSystem.SceneInstance where entities.Name == "Castle" select entities).FirstOrDefault();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(4)).Text = "Złoto: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).gold.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(5)).Text = "Zdrowie: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).health.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(6)).Text = "Jednostki: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).units.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(7)).Text = "Kilofy: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).pickaxes.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(8)).Text = "Miecze: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).swords.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(9)).Text = "Łuki: " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).bowArrows.ToString();
         ((TextBlock)Entity.Components.Get<UIComponent>(UIComponent.Key).RootElement.VisualChildren.ElementAt(10)).Text = "Różdżki " + ((CastleController)castle.Get<ScriptComponent>(ScriptComponent.Key).Scripts[0]).wands.ToString();
         //Keyboard Input
         if(Input.IsKeyReleased(Keys.Escape))
         {
             ((Game)Game).Exit();
         }
         if(Input.IsKeyReleased(Keys.K))
         {
             ProduceUnit("KILOF");
         }
         if(Input.IsKeyReleased(Keys.M))
         {
             ProduceUnit("MIECZ");
         }
         if(Input.IsKeyReleased(Keys.L))
         {
             ProduceUnit("ŁUK");
         }
         if(Input.IsKeyReleased(Keys.R))
         {
             ProduceUnit("RÓŻDŻKA");
         }
     }
 }
开发者ID:CoconutPirate,项目名称:SpeechRecognition,代码行数:35,代码来源:UIScript.cs

示例13: OnBulletHitCallback

        public override bool OnBulletHitCallback(UpdateContext updateContext, CBullet bullet, Entity entityHit)
        {
            if (entityHit.Get<CHealth>().IsAlive && ZombieHelper.TakeDamage(entityHit, updateContext.DeltaSeconds * 10f, null))
            {
                ZombieHelper.TriggerBloodExplosion(entityHit.Transform, Vector2.Zero);
            }

            return false;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:9,代码来源:Flamethrower.cs

示例14: Main

        static void Main(string[] args)
        {
            ReplaceInFile("C:\\Users\\Javier\\Desktop\\hola.txt", "C:\\Users\\Javier\\Desktop\\hola3.txt", "las personas","el mundo");
            ///////////////////////////
            //Se prueba objeto entity
            ///////////////////////////

            //Método Set (no case sensitive)
            Entity e = new Entity();
            e.Set("Nombre", "Javier");
            e.Set("Nombre", "Alonso");
            e.Set("Apellido", "Alvarez");
            e.Set("edad", 20);
            e.Set("fecha_nacimiento", new DateTime(1992,2,2));

            //Método Get (no case sensitive)
            Console.WriteLine("Información de Javier:");
            Console.WriteLine("Nombre: " + (string)e.Get("Nombre"));
            Console.WriteLine("Apellido: " + (string)e.Get("apellido"));
            Console.WriteLine("Edad: " + (int)e.Get("edad"));
            Console.WriteLine("Fecha de Nacimiento: " + (DateTime)e.Get("fecha_nacimiento"));

            ///////////////////////////
            ///////////////////////////

            ManejadorBaseDatos.Instancia.EjecutarScript("AYA");
            ///////////////////////////
            //Se prueba DA
            ///////////////////////////

            // Prueba Carga XML con DA
            Entities sp = new XMLLoader().loadXML("C://Users//Javier//.netbeans//7.1.2//config//GF3//domain1//tmsite//da//da.xml");

            // Prueba Ejecutar SP con objeto entity
            Entity parametros = new Entity();
            parametros.Set("pID", 1);
            parametros.Set("pCarro","Toyota");
            parametros.Set("pNombre","Javier");

            ///////////////////////////
            ///////////////////////////

            Console.ReadKey();
        }
开发者ID:jaalvarez92,项目名称:SIA,代码行数:44,代码来源:Program.cs

示例15: UpdateEntity

 protected override void UpdateEntity(float dt, Entity entity)
 {
     var tc = entity.Get<TypeChanger>();
     if ((tc.TTL -= dt) <= 0)
     {
         for (int i = 0; i < entity.Count(); ++i)
         {
             entity.Transform(i, tc.Transformation);
         }
     }
 }
开发者ID:LorenzJ,项目名称:ComponentTest,代码行数:11,代码来源:TypeChanging.cs


注:本文中的Entity.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。