Exemplo n.º 1
0
        //Useful methods

        public String getVitalName(VitalType vt)
        {
            switch (vt)
            {
            case VitalType.Health:
                return(HEALTH_POINTS_NAME);

            case VitalType.BloodToxicity:
                return(BLOOD_TOXICITY_NAME);

            case VitalType.DiastolicBP:
                return(DIASTOLIC_NAME);

            case VitalType.SystolicBP:
                return(SYSTOLIC_NAME);

            case VitalType.O2Level:
                return(O2_NAME);

            case VitalType.Temperature:
                return(TEMPURATURE_NAME);

            case VitalType.HeartRate:
                return(HEART_BEAT_NAME);

            default:
                return("Update Util.getVitalName to have new vitals ;)");
            }
        }
Exemplo n.º 2
0
        public ConsoleColor getVitalColor(VitalType vt)
        {
            switch (vt)
            {
            case VitalType.Health:
                return(HEALTH_POINTS_COLOR);

            case VitalType.BloodToxicity:
                return(BLOOD_TOXICITY_COLOR);

            case VitalType.DiastolicBP:
                return(DIASTOLIC_COLOR);

            case VitalType.SystolicBP:
                return(SYSTOLIC_COLOR);

            case VitalType.O2Level:
                return(O2_COLOR);

            case VitalType.Temperature:
                return(TEMPURATURE_COLOR);

            case VitalType.HeartRate:
                return(HEART_BEAT_COLOR);

            default:
                throw new Exception("No vital found in Utilities.getVitalColor(VitalType vt)");
            }
        }
Exemplo n.º 3
0
    void OnVitalChanged(VitalType vt, int change)
    {
        if (vt == VitalType.Health)
        {
            GlobalEvents.Raise(GlobalEvent.PopupRequested, this.transform.position + (Vector3.up * 2), (change == 0 ? "<color=yellow>" : (change < 0 ? "<color=red>" : "<color=green>")) + change + "</color>");

            if (data.GetVital(vt).current <= 0)
            {
                OnDeath();
                return;
            }
        }
        else if (vt == VitalType.Corruption)
        {
            GlobalEvents.Raise(GlobalEvent.PopupRequested, this.transform.position + (Vector3.up * 2), "<color=purple>Corruption:</color> " + (change == 0 ? "<color=yellow>" : (change < 0 ? "<color=red>" : "<color=green>")) + change + "</color>");

            if (data.GetVital(vt).current == data.GetVital(vt).GetMax())
            {
                OnDeath();
                return;
            }
        }
        else if (vt == VitalType.Stamina)
        {
            UpdateMovementMap();
            UpdateActorStatus();
        }

        GlobalEvents.Raise(GlobalEvent.ActorVitalChanged, this, vt);
    }
Exemplo n.º 4
0
    public Vital(VitalType type, Func <int> getMax, Func <string> getTooltip)
    {
        this.type = type;

        _getMax     = getMax;
        _getTooltip = getTooltip;

        this.current = type == VitalType.Corruption ? 0 : _getMax();
    }
Exemplo n.º 5
0
    void OnVitalChange(VitalType v, float current)
    {
        OnVitalChanged?.Invoke(v, current);

        //hook in audio here
        if (v == VitalType.HullPoints && current <= 0f)
        {
            OnShipDestroyed();
        }
    }
Exemplo n.º 6
0
 void OnVitalChanged(VitalType vt, float currentInPercent)
 {
     if (vt == VitalType.HullPoints)
     {
         _hull.fillAmount = currentInPercent;
     }
     else if (vt == VitalType.ShieldPoints)
     {
         _shield.fillAmount = currentInPercent;
     }
 }
Exemplo n.º 7
0
        /*
         * private void writeEffect(Effect e){
         *  int writtenLen = 0;
         *  writtenLen += writeVitalNameInColor(e.VitalType);
         *
         *  string changeStr = "";
         *  if( e.ChangePerTurn.Peek() > 0){
         *      changeStr = " +" + e.ChangePerTurn.Peek();
         *  }
         *  else if(e.ChangePerTurn.Peek() < 0){
         *      changeStr = " -" + e.ChangePerTurn.Peek();
         *  }
         *  else{
         *      changeStr = " did not change";
         *  }
         *  Console.Write(changeStr);
         *  writtenLen += changeStr.Length;
         *
         *  writeBlanksNewLine( writtenLen ,5 );
         *
         * }
         */

        private int writeVitalNameInColor(VitalType vt)
        {
            int          writtenLen = 0;
            ConsoleColor color      = Game.Util.getVitalColor(vt);
            String       str        = Game.Util.getVitalName(vt);

            writtenLen += str.Length;

            writeStrInColor(str, color);
            return(writtenLen);
        }
Exemplo n.º 8
0
 void OnVitalChanged(VitalType v, float current)
 {
     if (v == VitalType.ShieldPoints)
     {
         _shield.fillAmount = _ship.GetVital(v).inPercent;
     }
     else if (v == VitalType.HullPoints)
     {
         _hull.fillAmount = _ship.GetVital(v).inPercent;
     }
 }
Exemplo n.º 9
0
 public Vital(VitalType type, int startingValue, int min, int max, int normalMin, int normalMax, ConsoleColor forgroundColor, string unit)
 {
     this.type      = type;
     this.min       = min;
     this.max       = max;
     this.normalMax = normalMax;
     this.normalMin = normalMin;
     this.textColor = forgroundColor;
     this.unit      = unit;
     //set last for reasons
     setCurrentValue(startingValue);
     //this.currentValue = startingValue;
     turnChangeStatus = "";
 }
Exemplo n.º 10
0
    public static string ToStringFormat(VitalType type)
    {
        switch (type)
        {
        case VitalType.Health:
            return("<color=red>Health</color>");

        case VitalType.Corruption:
            return("<color=purple>Corruption</color>");

        case VitalType.Stamina:
            return("<color=green>Stamina</color>");

        default:
            return("Vital N/A");
        }
    }
Exemplo n.º 11
0
    public static Color ToColor(VitalType type)
    {
        switch (type)
        {
        case VitalType.Health:
            return(Color.red);

        case VitalType.Corruption:
            return(new Color(.5f, 0f, .5f));

        case VitalType.Stamina:
            return(Color.green);

        default:
            return(Color.white);
        }
    }
Exemplo n.º 12
0
    public static string Format(VitalType type)
    {
        switch (type)
        {
        case VitalType.MovementSpeed:
            return("Movement Speed");

        case VitalType.RotationSpeed:
            return("Rotational Speed");

        case VitalType.ScanRadius:
            return("Scan Range");

        case VitalType.ScanRate:
            return("Scan Rate");

        case VitalType.HullPoints:
            return("Hull Hitpoints");

        case VitalType.ShieldPoints:
            return("Shield Hitpoints");

        case VitalType.GasStorage:
            return("Gas Storage");

        case VitalType.OreStorage:
            return("Ore Storage");

        case VitalType.FuelStorage:
            return("Fuel Storage");

        case VitalType.GoodsStorage:
            return("Goods Storage");

        default:
            return("No format specified for " + type.ToString());
        }
    }
Exemplo n.º 13
0
    public static string FormatTooltip(VitalType type)
    {
        switch (type)
        {
        case VitalType.MovementSpeed:
            return("Forward movement speed.");

        case VitalType.RotationSpeed:
            return("Rotational movement speed.");

        case VitalType.ScanRadius:
            return("Range of proximity scan.");

        case VitalType.ScanRate:
            return("Update rate for proximity scan.");

        case VitalType.HullPoints:
            return("Hull hitpoints, only damaged after shield reaches zero.");

        case VitalType.ShieldPoints:
            return("Shield hitpoints.");

        case VitalType.GasStorage:
            return("Contributes to the fleet maximum cap of " + FleetVital.Format(FleetVitalType.NebulaGas) + ".");

        case VitalType.OreStorage:
            return("Contributes to the fleet maximum cap of  " + FleetVital.Format(FleetVitalType.Veldspar) + " and " + FleetVital.Format(FleetVitalType.Tritanite) + ".");

        case VitalType.FuelStorage:
            return("Contributes to the fleet maximum cap of  " + FleetVital.Format(FleetVitalType.ProcessedFuel) + ".");

        case VitalType.GoodsStorage:
            return("Contributes to the fleet maximum cap of  " + FleetVital.Format(FleetVitalType.Ammunition) + " and " + FleetVital.Format(FleetVitalType.CivilianSupplies) + ".");

        default:
            return("No tooltipformat for " + type.ToString());
        }
    }
Exemplo n.º 14
0
        public void applyVitalEffectNow(VitalType vt, int ammount)
        {
            foreach (VitalType minVt in this.MinorVitalMap.Keys)
            {
                if (vt == minVt)
                {
                    this.MinorVitalMap[vt].CurrentValue += ammount;
                    setDeltaHealth();
                    return;
                }
            }

            foreach (VitalType majVt in this.MajorVitalMap.Keys)
            {
                if (vt == majVt)
                {
                    this.MajorVitalMap[vt].CurrentValue += ammount;
                    setDeltaHealth();
                    return;
                }
            }
            //if we don't find the vitral in Minor/Major throw this soft error.
            throw new Exception("Need to update the Enums map to add the new vital");
        }
Exemplo n.º 15
0
 public VitalNameType(VitalType vitalType)
 {
     this.type = vitalType;
     this.name = System.Enum.GetName(typeof(VitalType), vitalType);
     this.hash = name.GetHashCode();
 }
Exemplo n.º 16
0
 public VitalCommand(Actor actor, VitalType type, int amount) : base(actor)
 {
     _type   = type;
     _amount = amount;
 }
Exemplo n.º 17
0
 public Vital(float maxValue, VitalType type)
 {
     _maxValue     = maxValue;
     _currentValue = maxValue;
     _type         = type;
 }
Exemplo n.º 18
0
 public VitalModifier(int value, VitalType type)
 {
     _value = value;
     _type  = type;
 }
Exemplo n.º 19
0
 void OnActorVitalChanged(Actor a, VitalType vt)
 {
     UpdateVital(_items[a].transform.Find(vt.ToString().ToLower()), a.data.GetVital(vt).current, a.data.GetVital(vt).GetMax(), Vital.ToColor(vt));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="VitalAnnouncement"/> struct.
 /// </summary>
 /// <param name="vitalType">The type of vital.</param>
 public VitalAnnouncement(VitalType vitalType)
 {
     VitalType = vitalType;
 }
Exemplo n.º 21
0
 public Effect(VitalType vt, Queue <int> changePerTurn, string flavorText)
 {
     this.VitalType     = vt;
     this.ChangePerTurn = changePerTurn;
     this.FlavorText    = flavorText;
 }
Exemplo n.º 22
0
 public VitalNameType(string name)
 {
     this.type = (VitalType)NameTypeUtils.GetVitalTypeForName(name, enumNames);
     this.name = name;
     this.hash = name.GetHashCode();
 }
Exemplo n.º 23
0
 public float GetVital(VitalType vt)
 {
     return(_vitals[(int)vt]);
 }
Exemplo n.º 24
0
 public VitalModifier(VitalType type, float value, ModifierMode mode, ModifierTarget target) : base(value, mode, target)
 {
     _type = type;
 }