Example #1
0
 private void OnCollision(CollisionData data)
 {
     if (data.OtherRigidbody != null && data.OtherRigidbody.gameObject != null)
     {
         AIActor     actorness  = data.OtherRigidbody.gameObject.GetComponent <AIActor>();
         HealthHaver healthness = data.OtherRigidbody.gameObject.GetComponent <HealthHaver>();
         if (actorness != null || healthness != null)
         {
             if (healthness.IsVulnerable)
             {
                 HitStreak += 1;
             }
         }
         else if (data.OtherRigidbody.name != null && !AcceptableNonEnemyTargets.Contains(data.OtherRigidbody.name))
         {
             ETGModConsole.Log(data.OtherRigidbody.name);
             EndStreak(data.MyRigidbody.projectile);
         }
         else if (data.OtherRigidbody.name == null)
         {
             EndStreak(data.MyRigidbody.projectile);
         }
     }
     else
     {
         EndStreak(data.MyRigidbody.projectile);
     }
     if (data.MyRigidbody.projectile != null)
     {
         PunishmentRayHitOnce hitonce = data.MyRigidbody.projectile.gameObject.AddComponent <PunishmentRayHitOnce>();
     }
 }
Example #2
0
 private void EndStreak(Projectile projectileResponsible)
 {
     if (projectileResponsible != null)
     {
         PunishmentRayHitOnce baseProj = projectileResponsible.GetComponent <PunishmentRayHitOnce>();
         if (baseProj != null)
         {
             return;
         }
     }
     if (this.gun.CurrentOwner != null && this.gun.CurrentOwner is PlayerController)
     {
         if (HitStreak > 0)
         {
             VFXToolbox.DoStringSquirt("STREAK LOST", this.gun.CurrentOwner.transform.position, Color.red);
         }
         int damageThreshold = 10;
         if ((this.gun.CurrentOwner as PlayerController).PlayerHasActiveSynergy("Spare The Rod"))
         {
             damageThreshold = 20;
         }
         if (HitStreak >= damageThreshold)
         {
             this.gun.CurrentOwner.healthHaver.ApplyDamage(0.5f, Vector2.zero, "STREAK LOST", CoreDamageTypes.None, DamageCategory.Normal, true, null, false);
         }
     }
     HitStreak = 0;
 }