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


C# Entity.AddTags方法代码示例

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


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

示例1: Decoration

        public Entity Decoration(int mX, int mY, string mTextureName, string mTilesetName, string mLabelName,
                                 float mRotation = 0)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 1600, 1600, true);
            var cRender = Render(cBody, mTextureName, mTilesetName, mLabelName, mRotation);

            cBody.Body.AddGroups(Groups.Decoration);

            result.AddComponents(cBody, cRender);
            result.AddTags(Tags.Decoration);

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:15,代码来源:Factory.cs

示例2: BlueDoor

        public static Entity BlueDoor(bool mIsOff = false)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Door};

            var cRender = TDLComponentFactory.Render(@"environment\door\blue\closed", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.DoorClosed, TDLRecalculations.RecalculateDoorSprite);
            var cSwitch = TDLComponentFactory.SwitchTexture(cRender, mIsOff, @"environment\door\blue\open", @"environment\door\blue\closed");
            cSwitch.OnlyOffTags.Add(TDLTags.BlueDoorOpen);
            cSwitch.OnlyOnTags.AddRange(new[] {TDLTags.BlueDoorClosed, TDLTags.Solid, TDLTags.GroundPathmapObstacle});
            var cSwitchRecalculateTagAI = new TDCSwitchRecalculateTagAI(cSwitch, cRecalculateSprites, TDLTags.BlueDoorOpen, TDLTags.BlueDoorClosed);
            var cDoor = new TDCDoor(TDCDoor.DoorType.Blue, mIsOff, Game, cSwitch, cRecalculateSprites);

            result.AddTags(TDLTags.BlueDoor);
            result.AddComponents(cRender, cSwitch, cSwitchRecalculateTagAI, cRecalculateSprites, cDoor);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:17,代码来源:TDLFactory.cs

示例3: BreakableWall

        public Entity BreakableWall(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cHealth = new CHealth(85);
            var cBody = Body(new SSVector2I(mX, mY), 16.ToUnits(), 16.ToUnits(), true);
            var cRender = Render(cBody, Textures.Wall, Tilesets.Wall, "breakable");

            cBody.Body.AddGroups(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cRender);
            result.AddTags(Tags.Wall, Tags.DamagedByAny);

            cRender.Sprite.Rotation = Utils.Random.Next(0, 4)*90;

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:17,代码来源:Factory.cs

示例4: BigEnemy

        public Entity BigEnemy(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cHealth = Health(12);
            var cBody = Body(new SSVector2I(mX, mY), 2000, 2000);
            var cMovement = Movement(cBody);
            var cTargeter = Targeter(cBody, Tags.Friendly);
            var cRender = Render(cBody, Textures.BigCharBlack, Tilesets.BigChar, "normal");
            var cAI = AI(cBody, cMovement, cTargeter, cRender, true);

            cBody.Body.AddGroups(Groups.Character, Groups.Enemy);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cMovement, cTargeter, cRender, cAI);
            result.AddTags(Tags.Char, Tags.Enemy, Tags.DamagedByWhite);

            Aura(result, mX, mY, true);

            return result;
        }
开发者ID:SuperV1234,项目名称:TestGenericShooter,代码行数:21,代码来源:Factory.cs

示例5: Arrow

        public static Entity Arrow(int mDirection = 0, bool mIsOff = false, List<int> mIDs = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\arrow", "onoffdirtiles", "on_n");
            var cDirection = new TDCDirection(mDirection);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Arrow);
            var cID = TDLComponentFactory.ID(mIDs);
            var cSwitch = new TDCSwitch(cRender, mIsOff);
            cSwitch.SetOffTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("off_" + cDirection.DirectionString));
            cSwitch.SetOnTextureRect(Assets.GetTileset("onoffdirtiles").GetTextureRect("on_" + cDirection.DirectionString));
            var cIDSwitchAI = new TDCIDSwitchAI(cSwitch, cID);
            var cArrow = new TDCArrow(cSpecialSquare, cDirection, cSwitch);

            cSwitch.OnlyOnTags.Add(TDLTags.GroundPathmapObstacle);

            result.AddTags(TDLTags.Arrow);
            result.AddComponents(cRender, cDirection, cSpecialSquare, cID, cSwitch, cIDSwitchAI, cArrow);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:21,代码来源:TDLFactory.cs

示例6: WoodenSword

        public static Entity WoodenSword()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Weapon};

            var cRender = TDLComponentFactory.Render(@"weapon\woodensword", "dirtiles", "n", true);
            var cDirection = new TDCDirection(0);
            var cWeapon = new TDCWeapon();
            var cRenderDirectionAI = new TDCRenderDirectionAI(cRender, cDirection, "dirtiles");

            result.AddTags(TDLTags.Solid, TDLTags.Weapon, TDLTags.DoesNotTriggerPlate);
            result.AddComponents(cRender, cDirection, cWeapon, cRenderDirectionAI);

            Instance.AddEntity(result);
            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:15,代码来源:TDLFactory.cs

示例7: Water

        public static Entity Water()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Pit};

            var cRender = TDLComponentFactory.Render(@"environment\water", "doortiles", "single");
            var cRecalculateSprites = new TDCRecalculateSprites(TDLTags.Water, TDLRecalculations.RecalculateDoorSprite);

            result.AddTags(TDLTags.Solid, TDLTags.Water, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cRecalculateSprites);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:12,代码来源:TDLFactory.cs

示例8: Tunnel

        public static Entity Tunnel(int mDirection = 0)
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Arrow};

            var cRender = TDLComponentFactory.Render(@"elements\tunnel");
            var cDirection = new TDCDirection(mDirection);
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cTunnel = new TDCTunnel(cRender, cDirection, cSpecialSquare);

            result.AddTags(TDLTags.Tunnel, TDLTags.GroundPathmapObstacle);
            result.AddComponents(cRender, cSpecialSquare, cDirection, cTunnel);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:14,代码来源:TDLFactory.cs

示例9: RoachEgg

        public static Entity RoachEgg()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Roach};

            var cRender = TDLComponentFactory.Render(@"monster\roachegg", "roachtiles", "n", true);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.Kill);
            var cEgg = new TDCEgg(cRender, 4);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);

            result.AddTags(TDLTags.Solid, TDLTags.SideBad, TDLTags.HitByWeapon, TDLTags.RequiredKill);
            result.AddComponents(cRender, cHitByWeapon, cEgg, cPathmapper);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:14,代码来源:TDLFactory.cs

示例10: PressurePlateSingleUse

        public static Entity PressurePlateSingleUse(List<int> mTargetIDs = default(List<int>), List<int> mTargetEffects = default(List<int>))
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Floor, UpdateOrder = TDLOrders.Trapdoor};

            var cRender = TDLComponentFactory.Render(@"environment\pressureplate", "pressureplatetiles", "single");
            var cSpecialSquare = new TDCSpecialSquare(TDLPriorities.Trapdoor);
            var cIDCaller = new TDCIDCaller(mTargetIDs, mTargetEffects);
            var cFloodFiller = new TDCFloodFiller(TDLTags.PressurePlateSingleUse);
            var cPressurePlate = new TDCPressurePlate(TDCPressurePlate.PressurePlateType.Single, cRender, cFloodFiller, cIDCaller, cSpecialSquare, "triggered_single", "single");

            result.AddTags(TDLTags.PressurePlateSingleUse);
            result.AddComponents(cRender, cPressurePlate, cSpecialSquare, cIDCaller, cFloodFiller);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:15,代码来源:TDLFactory.cs

示例11: Brain

        public static Entity Brain()
        {
            var result = new Entity(Tile) {Layer = TDLLayers.Roach, UpdateOrder = TDLOrders.Roach};

            var cRender = TDLComponentFactory.Render(@"monster\brain", true);
            var cHitByWeapon = new TDCHitByWeapon(TDCHitByWeapon.HitActions.KillBrain);
            var cPathmapper = new TDCPathmapper(Instance, TDLPathmaps.SideBad);

            result.AddTags(TDLTags.Solid, TDLTags.SideBad, TDLTags.HitByWeapon,
                           TDLTags.RequiredKill, TDLTags.WeightLow, TDLTags.Brain);
            result.AddComponents(cRender, cHitByWeapon, cPathmapper);

            result.Field.TurnActions[TDLTurnActions.StartBrainCheck] += () => TDLMethods.CheckForBrains(result.Field);

            return result;
        }
开发者ID:SuperV1234,项目名称:TimeDRODPOF,代码行数:16,代码来源:TDLFactory.cs

示例12: Enemy

        public Entity Enemy(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cStats = new CStats(1, 1, 1, 75);
            var cHealth = new CHealth(cStats);
            var cBody = Body(new SSVector2I(mX, mY), 10.ToUnits(), 10.ToUnits());
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, Textures.CharEnemy, Tilesets.Char, "normal");
            var cShadower = new CShadower(_game, cBody, false, new Color(125, 255, 125, 125));
            var cLineOfSight = new CLineOfSight(_game, cBody, cShadower) {TargetTag = Tags.Friendly, Angle = 90, Amplitude = 65};
            var cAI = AI(cStats, cBody, cMovement, cRender, cLineOfSight);

            cBody.Body.AddGroups(Groups.Character, Groups.Enemy);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cHealth, cBody, cMovement, cRender, cShadower, cLineOfSight, cAI);
            result.AddTags(Tags.Char, Tags.Enemy, Tags.DamagedByFriendly);

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:21,代码来源:Factory.cs

示例13: BulletBase

        private Entity BulletBase(int mX, int mY, float mDegrees, int mSpeed, string mTextureName, bool mEnemy)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 250, 250);
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, mTextureName);

            cBody.Body.AddGroupsToCheck(Groups.Obstacle, Groups.Character);
            cBody.Body.AddGroupsToIgnoreResolve(Groups.Obstacle, Groups.Character);
            cBody.OnCollision += (mCollisionInfo) =>
                                 {
                                     var entity = (Entity) mCollisionInfo.UserData;
                                     var cHealth = entity.GetComponent<CHealth>();

                                     if (entity.HasTag(Tags.DamagedByAny))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }
                                     else if (result.HasTag(Tags.BulletFriendly) &&
                                              entity.HasTag(Tags.DamagedByFriendly))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }
                                     else if (result.HasTag(Tags.BulletEnemy) &&
                                              entity.HasTag(Tags.DamagedByEnemy))
                                     {
                                         cHealth.Health--;
                                         result.Destroy();
                                     }

                                     if (entity.HasTag(Tags.DestroysBullets)) result.Destroy();
                                 };

            cMovement.Angle = mDegrees;
            cMovement.Speed = mSpeed;

            cRender.Torque = 8;

            result.AddComponents(cBody, cMovement, cRender);
            result.AddTags(Tags.Bullet);

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:46,代码来源:Factory.cs

示例14: Wall

        public Entity Wall(int mX, int mY, string mLabelName = "fill", float mRotation = 0)
        {
            var result = new Entity(_manager);

            var cBody = Body(new SSVector2I(mX, mY), 16.ToUnits(), 16.ToUnits(), true);
            var cRender = Render(cBody, Textures.Wall, Tilesets.Wall, mLabelName, mRotation);

            cBody.Body.AddGroups(Groups.Obstacle);

            result.AddComponents(cBody, cRender);
            result.AddTags(Tags.Wall, Tags.DestroysBullets);

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:14,代码来源:Factory.cs

示例15: Player

        public Entity Player(int mX, int mY)
        {
            var result = new Entity(_manager);

            var cStats = new CStats(1, 1, 1, 50);
            var cHealth = new CHealth(cStats);
            var cBody = Body(new SSVector2I(mX, mY), 10.ToUnits(), 10.ToUnits());
            var cMovement = Movement(cBody);
            var cRender = Render(cBody, Textures.CharPlayer, Tilesets.Char, "normal");
            var cControl = Control(cBody, cStats, cMovement, cRender);
            var cShadower = new CShadower(_game, cBody, true, new Color(77, 77, 175, 255), 1);

            cBody.Body.AddGroups(Groups.Character, Groups.Friendly);
            cBody.Body.AddGroupsToCheck(Groups.Obstacle);

            result.AddComponents(cStats, cHealth, cBody, cMovement, cControl, cRender, cShadower);
            result.AddTags(Tags.Char, Tags.Friendly, Tags.DamagedByEnemy);

            return result;
        }
开发者ID:SuperV1234,项目名称:Specimen,代码行数:20,代码来源:Factory.cs


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