Shielding
Shield behavior now provides protection from damage at the expense of heat and energy usage Weapon scripts check for the presence of a shield when detecting collisions (TODO: TEST ALL WEAPON TYPES) Shields can be toggled on/off (G key) Database cache now included in repo (saves some confusion)
This commit is contained in:
parent
273095afec
commit
8920b48977
19 changed files with 377 additions and 95 deletions
|
|
@ -30,7 +30,7 @@ public class ShieldManager : MonoBehaviour
|
|||
|
||||
var v1np = PostCollisionVelocity(v1n, Entity.Mass, v2n, otherShield.Entity.Mass);
|
||||
Entity.Velocity = tangent * v1t + normal * v1np;
|
||||
if(Entity.ShieldEnabled) ShowHit(contact.point, CollisionHitDuration);
|
||||
if(Entity.Shield != null && Entity.Shield.Item.Active) ShowHit(contact.point, CollisionHitDuration);
|
||||
}
|
||||
|
||||
private float PostCollisionVelocity(float v1, float m1, float v2, float m2)
|
||||
|
|
@ -41,7 +41,7 @@ public class ShieldManager : MonoBehaviour
|
|||
public void ShowHit(Vector3 point, float duration)
|
||||
{
|
||||
var shield = ShieldPrototype.Instantiate<ShieldAnimation>();
|
||||
shield.Direction = shield.transform.InverseTransformPoint(point);
|
||||
shield.Direction = normalize(shield.transform.InverseTransformPoint(point));
|
||||
shield.Duration = duration;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue