示例#1
0
        public void SetGrappleTarget(HurtBox target)
        {
            Debug.Log("Attempting to set grapple target to " + target.name);
            myBody = GetComponent <CharacterBody>(); //This should probably go somewhere else
            GrappleTarget newTarget = new GrappleTarget();

            newTarget.grappleTarget       = target;
            newTarget.grappleTargetHealth = newTarget.grappleTarget.healthComponent;
            newTarget.grappleTargetBody   = newTarget.grappleTarget.healthComponent.body;
            newTarget.tether = GameObject.Instantiate(WispSurvivor.WispSurvivor.tetherPrefab);
            newTarget.tether.AddComponent <AnimateTether>();
            Debug.Log("Set grapple target to " + newTarget.grappleTargetBody);

            GrappleTargets.Add(newTarget);
            hasTarget = true;
            if (Vector3.Distance(base.transform.position, newTarget.grappleTarget.transform.position) > 20f)
            {
                flyToTarget = true;
            }
            if (newTarget.grappleTargetHealth == null)
            {
                Debug.LogError("Could not add grapple target health!");
            }
            UpdateTether();
        }
示例#2
0
 public void ClearGrappleTarget(GrappleTarget target)
 {
     Destroy(target.tether);
     if (TETHER_TYPE == TETHER_TYPE.TETHER)
     {
         myBody.RemoveBuff(WispSurvivor.Modules.Buffs.sustainSelf);
         target.grappleTargetBody.RemoveBuff(WispSurvivor.Modules.Buffs.sustainTarget);
     }
     else if (TETHER_TYPE == TETHER_TYPE.SIPHON)
     {
         GetComponent <CharacterBody>().RemoveBuff(WispSurvivor.Modules.Buffs.siphonSelf);
         target.grappleTargetBody.RemoveBuff(WispSurvivor.Modules.Buffs.siphonTarget);
     }
     GrappleTargets.Remove(target);
     if (GrappleTargets.Count <= 0)
     {
         hasTarget = false;
     }
 }
示例#3
0
        private void Siphon(GrappleTarget target)
        {
            float fullHealth   = target.grappleTargetHealth.fullCombinedHealth;
            float damageAmount = fullHealth * .0033f;   //.33% of max health per .33 seconds - 1% of max health / second

            DamageInfo damageInfo = new DamageInfo();

            damageInfo.position  = target.grappleTarget.transform.position;
            damageInfo.attacker  = this.gameObject;
            damageInfo.inflictor = this.gameObject;
            damageInfo.crit      = false;
            //damageInfo.damage = base.damageStat * this.damageCoefficient;
            damageInfo.damage           = damageAmount;
            damageInfo.damageColorIndex = DamageColorIndex.Default;
            damageInfo.damageType       = DamageType.NonLethal;
            damageInfo.procCoefficient  = 0f;

            target.grappleTargetHealth.TakeDamage(damageInfo);

            float barrierAmount = healthComponent.fullBarrier * .033f;

            healthComponent.AddBarrier(barrierAmount);
        }