Пример #1
0
    private void OnCollision(Entity entity)
    {
        if (spawned)
        {
            EntityCreature creature = entity as EntityCreature;

            if (creature != null && creature != _owner)
            {
                creature.ApplyDamage(_damage);
                Hit();
            }
        }
    }
Пример #2
0
    private void EffectEntity(Entity entity)
    {
        Vector3 delta = entity.worldPosition - _position;

        if (entity.physics != null)
        {
            entity.physics.AddForce(delta.normalized * _power / delta.magnitude);
        }

        EntityCreature creature = entity as EntityCreature;

        if (creature != null)
        {
            creature.ApplyDamage(new Damage(entity, _power / delta.magnitude));
        }
    }