예제 #1
0
    protected new void Start()
    {
        this.randMin.x = UnityEngine.Random.Range(0f, 0.06f);
        this.randMin.y = UnityEngine.Random.Range(0f, 0.06f);
        this.randMin.z = UnityEngine.Random.Range(0f, 0.06f);
        this.randMin.w = UnityEngine.Random.Range(0f, 0.06f);
        this.randMax.x = UnityEngine.Random.Range(0.94f, 1f);
        this.randMax.y = UnityEngine.Random.Range(0.94f, 1f);
        this.randMax.z = UnityEngine.Random.Range(0.94f, 1f);
        this.randMax.w = UnityEngine.Random.Range(0.94f, 1f);
        int num = UnityEngine.Random.Range(0, 64);

        this.swapX     = (num & 1) == 1;
        this.inverseX  = (num & 8) == 8;
        this.swapY     = (num & 2) == 2;
        this.inverseY  = (num & 16) == 16;
        this.swapZ     = (num & 4) == 4;
        this.inverseZ  = (num & 32) == 32;
        this.speedModX = 1.12 - (1 - ((double)this.randMax.x - (double)this.randMin.x));
        this.speedModY = 1.12 - (1 - ((double)this.randMax.y - (double)this.randMin.y));
        this.speedModZ = 1.12 - (1 - ((double)this.randMax.z - (double)this.randMin.z));
        this.speedModW = 1.12 - (1 - ((double)this.randMax.w - (double)this.randMin.w));
        HUDDirectionalDamage hUDDirectionalDamage = this;

        hUDDirectionalDamage.speedModX = hUDDirectionalDamage.speedModX / this.speedModW;
        HUDDirectionalDamage hUDDirectionalDamage1 = this;

        hUDDirectionalDamage1.speedModY = hUDDirectionalDamage1.speedModY / this.speedModW;
        HUDDirectionalDamage hUDDirectionalDamage2 = this;

        hUDDirectionalDamage2.speedModZ = hUDDirectionalDamage2.speedModZ / this.speedModW;
        this.speedModW = 1;
        base.Start();
    }
예제 #2
0
    public void ClientHealthChange(float amount, GameObject attacker)
    {
        float health = base.health;

        base.AdjustClientSideHealth(amount);
        float num2           = amount;
        float num3           = Mathf.Abs((float)(num2 - health));
        bool  flag           = amount < health;
        float healthFraction = base.healthFraction;

        if (base.localControlled && (num3 >= 1f))
        {
            base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(healthFraction, attacker);
        }
        if ((((attacker != null) && flag) && (num3 >= 1f)) && ((hudDamagePrefab != null) || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out hudDamagePrefab)))
        {
            Vector3   vector;
            Character character;
            if (IDBase.GetMain <Character>(attacker, out character))
            {
                vector = base.eyesOrigin - character.eyesOrigin;
            }
            else
            {
                vector = base.origin - attacker.transform.position;
            }
            HUDDirectionalDamage.CreateIndicator(vector, (double)amount, NetCull.time, 1.6000000238418579, hudDamagePrefab);
        }
        RPOS.HealthUpdate(amount);
    }
예제 #3
0
 public static void CreateIndicator(Vector3 worldDamageDirection, double damageAmount, double timestamp, double duration, HUDDirectionalDamage prefab)
 {
     HUDDirectionalDamage hUDDirectionalDamage = (HUDDirectionalDamage)HUDIndicator.InstantiateIndicator(HUDIndicator.ScratchTarget.CenteredFixed3000Tall, prefab, HUDIndicator.PlacementSpace.DoNotModify, Vector3.zero);
     hUDDirectionalDamage.damageTime = timestamp;
     hUDDirectionalDamage.duration = duration;
     hUDDirectionalDamage.damageAmount = damageAmount;
     hUDDirectionalDamage.worldDirection = -worldDamageDirection;
     hUDDirectionalDamage.transform.localPosition = Vector3.zero;
     hUDDirectionalDamage.transform.localRotation = Quaternion.identity;
     hUDDirectionalDamage.transform.localScale = Vector3.one;
     hUDDirectionalDamage.texture.ForceReloadMaterial();
 }
예제 #4
0
    public static void CreateIndicator(Vector3 worldDamageDirection, double damageAmount, double timestamp, double duration, HUDDirectionalDamage prefab)
    {
        HUDDirectionalDamage damage = (HUDDirectionalDamage)HUDIndicator.InstantiateIndicator(HUDIndicator.ScratchTarget.CenteredFixed3000Tall, prefab, HUDIndicator.PlacementSpace.DoNotModify, Vector3.zero);

        damage.damageTime              = timestamp;
        damage.duration                = duration;
        damage.damageAmount            = damageAmount;
        damage.worldDirection          = -worldDamageDirection;
        damage.transform.localPosition = Vector3.zero;
        damage.transform.localRotation = Quaternion.identity;
        damage.transform.localScale    = Vector3.one;
        damage.texture.ForceReloadMaterial();
    }
예제 #5
0
    public void ClientHealthChange(float amount, GameObject attacker)
    {
        Vector3   vector3;
        Character character;
        float     single = base.health;

        base.AdjustClientSideHealth(amount);
        float single1 = Mathf.Abs(amount - single);
        bool  flag    = amount < single;
        float single2 = base.healthFraction;

        if (base.localControlled && single1 >= 1f)
        {
            base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(single2, attacker);
        }
        if (attacker && flag && single1 >= 1f && (ClientVitalsSync.hudDamagePrefab || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out ClientVitalsSync.hudDamagePrefab)))
        {
            vector3 = (!IDBase.GetMain <Character>(attacker, out character) ? base.origin - attacker.transform.position : base.eyesOrigin - character.eyesOrigin);
            HUDDirectionalDamage.CreateIndicator(vector3, (double)amount, NetCull.time, 1.60000002384186, ClientVitalsSync.hudDamagePrefab);
        }
        RPOS.HealthUpdate(amount);
    }