Ejemplo n.º 1
0
    public override bool GiveWarning()
    {
        if (Reason2Warn())
        {
            // reset warn counter
            reportedWarning = false;
            WarnCounter     = MaxWaitTime;

            // give warning
            StationLogger.Alert(
                new List <StationAlertType>()
            {
                StationAlertType.Console_Line_Station, StationInfo()
            },
                Alert.SeverityLevel.Warning,
                this
                );
            // TODO: create custom warning messages

            // warning has indeed happened
            return(true);
        }

        // no reason for a warning was found, no warning has happened
        return(false);
    }
Ejemplo n.º 2
0
    public override void GiveUpdate()
    {
        // collect the different parts of the update in a list
        var alerts = new List <StationAlertType>()
        {
            StationAlertType.Console_Line_Station
        };

        alerts.AddRange(GiveUpdate_DataLines());
        alerts.AddRange(GiveUpdate_Usage());
        alerts.AddRange(behaveTwin.GiveUpdate_Usage());

        // collect every instance that might know how a placeholder in the alert shall be replaced
        var replacements = new List <IAlertReplacements>()
        {
            this
        };

        if (Assignees.Count > 0)
        {
            replacements.Add(Assignees[0]);
        }

        StationLogger.Alert(alerts, Alert.SeverityLevel.Info, replacements.ToArray());
    }
Ejemplo n.º 3
0
    public override void GiveUpdate()
    {
        var myAlert = new List <StationAlertType>()
        {
            StationAlertType.Console_Line_Astronaut
        };
        var replacements = new List <IAlertReplacements>()
        {
            this
        };

        switch (myStats.myState)
        {
        case AstroStats.AIStates.MoveToBehaving:
            myAlert.Add(StationAlertType.Astronaut_Moving_Behaving);
            replacements.Add(myStats.myBehaveStation);
            break;

        case AstroStats.AIStates.Behaving:
            myAlert.Add(myStats.myBehaveStation.AstronautInfo());
            replacements.Add(myStats.myBehaveStation);
            break;

        case AstroStats.AIStates.MoveToMisbehaving:
            myAlert.Add(StationAlertType.Astronaut_Moving_Misbehaving);
            replacements.Add(myStats.myMisbehaveStation);
            break;

        case AstroStats.AIStates.Misbehaving:
            myAlert.Add(myStats.myMisbehaveStation.AstronautInfo());
            replacements.Add(myStats.myMisbehaveStation);
            break;

        case AstroStats.AIStates.Fleeing:
            myAlert.Add(StationAlertType.Astronaut_Fleeing);
            break;

        case AstroStats.AIStates.Idle:
            myAlert.Add(StationAlertType.Astronaut_Idle);
            break;

        case AstroStats.AIStates.Dead:
            myAlert.Add(StationAlertType.Astronaut_Dead_Generic);
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        StationLogger.Alert(myAlert, Alert.SeverityLevel.Info, replacements.ToArray());
    }
Ejemplo n.º 4
0
        public bool GiveWarning()
        {
            reportedWarning = false;
            WarnCounter     = MaxWaitTime;

            if (Math.Abs(Speed - MaxSpeed) < 1f)
            {
                StationLogger.Alert(StationAlertType.Station_TooFast, Alert.SeverityLevel.Warning);
                return(true);
            }

            if (Math.Abs(Speed - MinSpeed) < 1f)
            {
                StationLogger.Alert(StationAlertType.Station_TooSlow, Alert.SeverityLevel.Warning);
                return(true);
            }

            // no reason to raise a warning has been found
            WarnCounter /= 2f;
            return(false);
        }