Combat & Visibility & Collisions
Converted entity materials to new fade shader Implemented visibility system Refactored per-instance entity code to run inside monobehavior on entity instances Created state machine AI for enemy ships with basic patrol and combat routines Removed legacy AI code (controller item behaviors) Added automatic trigger group assignment for matched weapons Created ship collision system Created shield VFX and colliders
This commit is contained in:
parent
8d4bd04891
commit
b53e4aec8c
204 changed files with 8182 additions and 1919 deletions
|
|
@ -289,14 +289,10 @@ public static class Extensions
|
|||
return t * (t * (a * t + b) + c) + d;
|
||||
}
|
||||
|
||||
public static float AngleDiff(this float2 a, float2 b)
|
||||
public static float Angle(this float2 from, float2 to)
|
||||
{
|
||||
var directionAngle = atan2(b.y, b.x);
|
||||
var currentAngle = atan2(a.y, a.x);
|
||||
var d1 = directionAngle - currentAngle;
|
||||
var d2 = directionAngle - 2 * PI - currentAngle;
|
||||
var d3 = directionAngle + 2 * PI - currentAngle;
|
||||
return abs(d1) < abs(d2) ? abs(d1) < abs(d3) ? d1 : d3 : abs(d2) < abs(d3) ? d2 : d3;
|
||||
var num = sqrt(lengthsq(from) * lengthsq(to));
|
||||
return num < 1.00000000362749E-15 ? 0.0f : acos(clamp(dot(from, to) / num, -1f, 1f)) * 57.29578f;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/3188835
|
||||
|
|
|
|||
Loading…
Reference in a new issue