public void Launch(EiEntity entity) { if (!entity || !entity.Body) { return; } var force = launchForce; if (setVelocity) { entity.Body.velocity = (this.transform.rotation * direction) * force; if (preLaunchObject) { entity.transform.localPosition += (entity.Body.velocity * Time.fixedDeltaTime); } } else { var launchDir = (this.transform.rotation * direction); if (relativeToMass) { force *= entity.Body.mass; } entity.Body.AddForce(launchDir * force, ForceMode.Impulse); if (preLaunchObject) { entity.transform.localPosition += launchDir * (Time.fixedDeltaTime); } } onLaunch.Trigger(); onLaunchEntity.Trigger(entity); }
public void Clear() { damageStringType = "Not Defined"; this.damageType = 0; this.flatAmount = 0f; currentHealthPercentage = 0f; maxHealthPercentage = 0f; comment = ""; source = null; }
public EiCombatData(int damageType, float flatAmount, float currentHealthPercentage, float maxHealthPercentage, EiEntity source) { damageStringType = "Not Defined"; this.damageType = damageType; this.flatAmount = flatAmount; this.currentHealthPercentage = currentHealthPercentage; this.maxHealthPercentage = maxHealthPercentage; this.comment = ""; this.source = source; }
public EiCombatData(int damageType, float flatAmount) { damageStringType = "Not Defined"; this.damageType = damageType; this.flatAmount = flatAmount; this.currentHealthPercentage = 0f; this.maxHealthPercentage = 0f; this.comment = ""; this.source = null; }
void OnEntityDestroyed(EiEntity entity) { if (this == null) { return; } if (spawnedReference == entity.gameObject) { spawnedReference = null; if (respawnIfReferenceIsGone) { ForceSpawn(); } } }
public void ReleaseEntity() { onReleaseEntity.Trigger(targetObject); isGrabbing = false; if (targetObject) { targetObject.UnfreezePhysics(); targetObject = null; } if (targetRigidbody) { targetRigidbody.useGravity = didHaveGravity; targetRigidbody = null; } if (forceCalculation) { Destroy(forceCalculation); } }
public void GrabEntity(EiEntity entity) { if (!entity || !entity.Body) { return; } if (targetObject) { ReleaseEntity(); } targetObject = entity; targetRigidbody = entity.Body; didHaveGravity = targetRigidbody.useGravity; targetRigidbody.useGravity = false; forceCalculation = targetObject.AddComponent <EiGravityGunForceCalculation> (); isGrabbing = true; onGrabEntity.Trigger(entity); }
public void DestroyOnTrigger(EiEntity entity) { Destroy(entity.gameObject, delay); }
public void ApplySource(EiEntity source) { this.source = source; }