Capacity + Health and Mana bars
This commit is contained in:
parent
b21d392ff6
commit
7d3b4ced0e
41 changed files with 1739 additions and 32 deletions
|
@ -44,12 +44,13 @@ public class AttackHandler : MonoBehaviour
|
|||
if (targetUnit.IsTeamA == _minecraftUnit.IsTeamA) continue;
|
||||
|
||||
targetUnit.TakeDamage(damage);
|
||||
_minecraftUnit.Capacity.AddMana(damage);
|
||||
hasHit = true;
|
||||
|
||||
Vector3 knockbackVector = knockbackHorizontalForce * (target.transform.position - transform.position).normalized
|
||||
+ knockbackVerticalForce * Vector3.up;
|
||||
|
||||
// Knockback logic specific to MinecraftUnit (can't force other team to do our weird impl)
|
||||
// logic specific if targetUnit is MinecraftUnit
|
||||
if (targetUnit is MinecraftUnit)
|
||||
{
|
||||
MinecraftUnit minecraftTarget = (MinecraftUnit)targetUnit;
|
||||
|
|
|
@ -17,6 +17,7 @@ public class Arrow : ProjectileHandler
|
|||
minecraftUnit.StartCoroutine(minecraftUnit.MovementHandler.TakeImpulse(knockback));
|
||||
}
|
||||
unit.TakeDamage(baseDamage);
|
||||
_minecraftUnitOrigin.Capacity.AddMana(baseDamage);
|
||||
}
|
||||
|
||||
Destroy(this.gameObject);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class AttackProjectile : AttackHandler
|
|||
Vector3 diffVector = Vector3.ProjectOnPlane(targetUnit.transform.position - spawnPos.position, Vector3.up);
|
||||
|
||||
Vector3 launchVectorNormalized = (localLaunchVector.x * diffVector.normalized + localLaunchVector.y * Vector3.up).normalized;
|
||||
projectileHandler.LaunchProjectile(launchVectorNormalized * arrowBaseSpeed, _minecraftUnit.IsTeamA);
|
||||
projectileHandler.LaunchProjectile(launchVectorNormalized * arrowBaseSpeed, _minecraftUnit.IsTeamA, _minecraftUnit);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class HealthPotion : ProjectileHandler
|
|||
if (targetUnit.IsTeamA != FromTeamA) continue;
|
||||
|
||||
targetUnit.Heal(healthAdd);
|
||||
|
||||
_minecraftUnitOrigin.Capacity.AddMana(healthAdd);
|
||||
}
|
||||
CoroutineManager.Instance.StartCoroutine(ExplodeVisual());
|
||||
Destroy(gameObject);
|
||||
|
|
|
@ -10,6 +10,7 @@ public class ProjectileHandler : MonoBehaviour
|
|||
[SerializeField] protected float _lifeSpan = 8.0f;
|
||||
protected Rigidbody RigidBody;
|
||||
protected bool FromTeamA;
|
||||
protected MinecraftUnit _minecraftUnitOrigin;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
|
@ -28,10 +29,12 @@ public class ProjectileHandler : MonoBehaviour
|
|||
if (RigidBody.linearVelocity.magnitude >= 1f) transform.forward = RigidBody.linearVelocity.normalized;
|
||||
}
|
||||
|
||||
public void LaunchProjectile(Vector3 baseSpeed, bool fromTeamA)
|
||||
public void LaunchProjectile(Vector3 baseSpeed, bool fromTeamA, MinecraftUnit minecraftUnit)
|
||||
{
|
||||
RigidBody.linearVelocity = baseSpeed;
|
||||
FromTeamA = fromTeamA;
|
||||
_minecraftUnitOrigin = minecraftUnit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue