Ejemplo n.º 1
0
 public void InvokeUpdateHP(float newHP)
 {
     HealthCurr = newHP;
     if (HealthCurr <= 0)
     {
         MapController.RemoveUnit(this);
     }
     HPChange.Invoke(HealthCurr / HealthMax);
 }
Ejemplo n.º 2
0
    public int OnNotifyHPChange(HPChange pMsg)
    {
        UInt64  sGUID     = pMsg.guid;
        int     crticalHp = pMsg.hp;//当前血量
        Player  entity;
        Vector3 posInWorld = Vector3.zero;

        if (PlayersManager.Instance.PlayerDic.TryGetValue(sGUID, out entity))
        {
            posInWorld = entity.RealEntity.transform.position + new Vector3(0.0f, 2.0f, 0.0f);
            //更新实体的血条
            entity.UpdateHpChange((byte)pMsg.reason, (float)crticalHp);
            entity.UpdateHp(entity);
        }
        return((Int32)ErrorCodeEnum.Normal);
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a text description of all significant values
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string res = "";

            if (HPChange != 0)
            {
                res += "\nHP change per day: " + HPChange.ToString("F2");
            }
            if (Space != 0)
            {
                res += "\nSpace: " + Space.ToString("F1");
            }
            if (RecuperationPower != 0)
            {
                res += "\nRecuperation Power: " + RecuperationPower.ToString("F1") + "% (max " + MaxRecuperaction.ToString("F1") + "%)";
            }
            if (Decay != 0)
            {
                res += "\nDecay: " + Shielding.ToString("F1") + "%";
            }
            if (Shielding != 0)
            {
                res += "\nShielding: " + Shielding.ToString("F1");
            }
            if (PartsRadiation != 0)
            {
                res += "\nParts radiation: " + PartsRadiation.ToString("F0");
            }

            foreach (HealthFactor f in Core.Factors)
            {
                if (BonusSums[f.Name] != 0)
                {
                    res += "\n" + f.Name + " bonus sum: " + BonusSums[f.Name];
                }
                if (FreeMultipliers[f.Name] != 1)
                {
                    res += "\n" + f.Name + " free multiplier: " + FreeMultipliers[f.Name];
                }
                if (MinMultipliers[f.Name] != 1)
                {
                    res += "\n" + f.Name + " min multiplier: " + MinMultipliers[f.Name];
                }
                if (MaxMultipliers[f.Name] != 1)
                {
                    res += "\n" + f.Name + " max multiplier: " + MaxMultipliers[f.Name];
                }
            }

            if (BonusSums["All"] != 0)
            {
                res += "\nWildcard bonus sum: " + BonusSums["All"];
            }
            if (FreeMultipliers["All"] != 1)
            {
                res += "\nWildcard free multiplier: " + FreeMultipliers["All"];
            }
            if (MinMultipliers["All"] != 1)
            {
                res += "\nWildcard min multiplier: " + MinMultipliers["All"];
            }
            if (MaxMultipliers["All"] != 1)
            {
                res += "\nWildcard max multiplier: " + MaxMultipliers["All"];
            }

            return(res.Trim());
        }