Compare commits

..

No commits in common. "87e455827c0c563da6dcd74ab2afdbd1fc725f27" and "813d034fc50bd7359586deea2ba305405a794bde" have entirely different histories.

2 changed files with 2 additions and 44 deletions

View File

@ -2,59 +2,18 @@ namespace GameDev.CoreSystems
{
public interface IPowerSystem
{
/// <summary>
/// This entity generates power
/// </summary>
public bool IsGenerator { get; }
/// <summary>
/// This entity consumes power
/// </summary>
public bool IsConsumer { get; }
/// <summary>
/// True if consumer demand exceed generator capacity
/// </summary>
public bool PowerLost { get; set; }
public void SetMaxPower(int newValue);
/// <summary>
/// Initialize the power configuration of the entity with the <see cref="SoPowerConfig"/>
/// </summary>
/// <param name="config">Power config for the entity</param>
public void Initialize(SoPowerConfig config);
/// <summary>
/// Max power for the entity
/// Generator capacity or max consumption depending on
/// the set type <see cref="IsGenerator"/> or <see cref="IsConsumer"/>
/// </summary>
/// <param name="newMaxPowerValue"></param>
public void SetMaxPower(int newMaxPowerValue);
/// <summary>
/// Current power for the entity
/// </summary>
/// <param name="newCurrentPowerValue">current power generated/consumed power for this entity [W]</param>
public void SetCurrentPower(int newCurrentPowerValue);
/// <summary>
/// Get Max power for the entity
/// Generator capacity or max consumption depending on
/// the set type <see cref="IsGenerator"/> or <see cref="IsConsumer"/>
/// </summary>
/// <returns>The max power that can be generated/consumed by this entity [W]</returns>
public int GetMaxPower();
/// <summary>
/// Get current power for the entity.
/// </summary>
/// <returns>The power generated/consumed by this entity right now [W]</returns>
public int GetCurrentPower();
/// <summary>
/// Get the power factor for the entity
/// </summary>
/// <returns>The ratio between current power and max power [factor]</returns>
public float GetPowerFactor();
}
}

View File

@ -27,13 +27,12 @@ namespace GameDev.CoreSystems
var position = BarrelEndPoint.position;
var forward = BarrelEndPoint.forward;
var ray = new Ray(position, forward);
Debug.DrawRay(position, forward * 10, Color.green);
if (Physics.Raycast(ray, out RaycastHit hitInfo))
{
if (hitInfo.transform.TryGetComponent(out Targetable target))
{
Debug.DrawRay(position, forward * Vector3.Distance(position, target.GetCenterPosition()),
Color.red, 0.1f);
target.Damageable.ModifyHealth(Mathf.RoundToInt(-Damage));
}
}