コード例 #1
0
 public void CopyFrom(AgentMarker other)
 {
     PositionInMap    = other.PositionInMap;
     PositionInWidget = other.PositionInWidget;
     AgentMarkerType  = other.AgentMarkerType;
     _agent           = other._agent;
 }
コード例 #2
0
        public static int GetLayer(this AgentMarkerType type)
        {
            switch (type)
            {
            case AgentMarkerType.PlayerTeamHuman:
            case AgentMarkerType.PlayerTeamEscapingHuman:
            case AgentMarkerType.PlayerAllyTeamHuman:
            case AgentMarkerType.PlayerAllyTeamEscapingHuman:
            case AgentMarkerType.PlayerEnemyTeamHuman:
            case AgentMarkerType.PlayerEnemyTeamEscapingHuman:
            case AgentMarkerType.Human:
            case AgentMarkerType.EscapingHuman:
                return(5);

            case AgentMarkerType.PlayerTeamHorse:
            case AgentMarkerType.PlayerTeamEscapingHorse:
            case AgentMarkerType.PlayerAllyTeamHorse:
            case AgentMarkerType.PlayerAllyTeamEscapingHorse:
            case AgentMarkerType.PlayerEnemyTeamHorse:
            case AgentMarkerType.PlayerEnemyTeamEscapingHorse:
            case AgentMarkerType.Horse:
            case AgentMarkerType.EscapingHorse:
                return(4);

            case AgentMarkerType.Animal:
                return(3);

            case AgentMarkerType.Inactive:
                return(2);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
        private SimpleMaterial CreateMaterial(TwoDimensionDrawContext drawContext, AgentMarkerType type)
        {
            var types    = type.GetColorAndTextureType();
            var material = Widgets.Utility.CreateMaterial(drawContext, this);

            material.Texture = types.TextureType.GetTexture();
            material.Color  *= types.ColorType.GetColor();
            return(material);
        }
コード例 #4
0
        private void UpdateMarker()
        {
            AgentMarkerType = _agent.GetAgentMarkerType();
            if (AgentMarkerType == AgentMarkerType.Inactive)
            {
                MakeDead();
                return;
            }

            var miniMap = MiniMap.Instance;

            if (!miniMap.IsValid && !BattleMiniMapConfig.Get().ShowMap)
            {
                return;
            }
            PositionInMap    = miniMap.WorldToMapF(_agent.Position.AsVec2);
            PositionInWidget = miniMap.MapToWidget(PositionInMap);
        }
コード例 #5
0
        public static ColorAndTexturePair GetColorAndTextureType(
            this AgentMarkerType type)
        {
            switch (type)
            {
            case AgentMarkerType.Inactive:
                return(new ColorAndTexturePair(AgentMarkerColorType.Inactive,
                                               AgentMarkerTextureType.Dead));

            case AgentMarkerType.PlayerTeamHuman:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerTeam,
                                               AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerTeamEscapingHuman:
                return(new ColorAndTexturePair(
                           AgentMarkerColorType.PlayerTeamEscaping, AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerTeamHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerTeam,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.PlayerTeamEscapingHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerTeamEscaping,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.PlayerAllyTeamHuman:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerAlly,
                                               AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerAllyTeamEscapingHuman:
                return(new ColorAndTexturePair(
                           AgentMarkerColorType.PlayerAllyTeamEscaping, AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerAllyTeamHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerAlly,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.PlayerAllyTeamEscapingHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerAllyTeamEscaping,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.PlayerEnemyTeamHuman:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerEnemy,
                                               AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerEnemyTeamEscapingHuman:
                return(new ColorAndTexturePair(
                           AgentMarkerColorType.PlayerEnemyTeamEscaping, AgentMarkerTextureType.Human));

            case AgentMarkerType.PlayerEnemyTeamHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerEnemy,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.PlayerEnemyTeamEscapingHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.PlayerEnemyTeamEscaping,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.Human:
                return(new ColorAndTexturePair(AgentMarkerColorType.Human,
                                               AgentMarkerTextureType.Human));

            case AgentMarkerType.EscapingHuman:
                return(new ColorAndTexturePair(AgentMarkerColorType.Human,
                                               AgentMarkerTextureType.Human));

            case AgentMarkerType.Horse:
                return(new ColorAndTexturePair(AgentMarkerColorType.Horse,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.EscapingHorse:
                return(new ColorAndTexturePair(AgentMarkerColorType.Horse,
                                               AgentMarkerTextureType.Horse));

            case AgentMarkerType.Animal:
                return(new ColorAndTexturePair(AgentMarkerColorType.Other,
                                               AgentMarkerTextureType.OtherAnimal));

            default:
            {
                if (_errorCount < 10)
                {
                    ++_errorCount;
                    MissionSharedLibrary.Utilities.Utility.DisplayMessageForced(
                        $"Error: Unexpected agent type '{type}'.");
                }
                return(new ColorAndTexturePair(AgentMarkerColorType.Other,
                                               AgentMarkerTextureType.OtherAnimal));
            }
            }
        }