Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public void Clear()
 {
     damageStringType        = "Not Defined";
     this.damageType         = 0;
     this.flatAmount         = 0f;
     currentHealthPercentage = 0f;
     maxHealthPercentage     = 0f;
     comment = "";
     source  = null;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 void OnEntityDestroyed(EiEntity entity)
 {
     if (this == null)
     {
         return;
     }
     if (spawnedReference == entity.gameObject)
     {
         spawnedReference = null;
         if (respawnIfReferenceIsGone)
         {
             ForceSpawn();
         }
     }
 }
Ejemplo n.º 6
0
 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);
     }
 }
Ejemplo n.º 7
0
        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);
 }
Ejemplo n.º 9
0
 public void ApplySource(EiEntity source)
 {
     this.source = source;
 }