Пример #1
0
        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);
        }
Пример #2
0
        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);
        }