Murder Satellites
Created TurretController, which performs basic combat for fixed orbital installations Projectiles self-destruct at maximum range Created turret prefab Outfitted turret in game manager Entity position is now 3D Entities responsible for updating their own position and orientation Barrel positions and orientations available from entity code Inventory code will display modal dialog for invalid item moves instead of breaking Yaw articulation working (full 360 rotation still borked)
This commit is contained in:
parent
8aaccac2b5
commit
ef816cc7e0
60 changed files with 2536 additions and 244 deletions
|
|
@ -11,13 +11,16 @@ public class Projectile : MonoBehaviour
|
|||
public float Gravity;
|
||||
|
||||
private bool _alive;
|
||||
|
||||
public Zone Zone { get; set; }
|
||||
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 Velocity { get; set; }
|
||||
public float Damage { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public Entity SourceEntity { get; set; }
|
||||
|
||||
public float Range { get; set; }
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
|
@ -34,20 +37,25 @@ public class Projectile : MonoBehaviour
|
|||
{
|
||||
if (SourceEntity == null) return;
|
||||
|
||||
var position = transform.position;
|
||||
Velocity += Vector3.up * (sign(Zone.GetHeight(float2(position.x,position.z)) - position.y) * Gravity * Time.deltaTime);
|
||||
var ray = new Ray(position, Velocity);
|
||||
if (Physics.Raycast(ray, out var hit, Velocity.magnitude, LayerMask.NameToLayer("Combat")))
|
||||
{
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull)
|
||||
{
|
||||
hull.SendHit(Damage, DamageType, SourceEntity, hit);
|
||||
}
|
||||
StartCoroutine(Kill());
|
||||
}
|
||||
if(_alive)
|
||||
{
|
||||
var position = transform.position;
|
||||
Velocity += Vector3.up * (sign(Zone.GetHeight(float2(position.x,position.z)) - position.y) * Gravity * Time.deltaTime);
|
||||
var ray = new Ray(position, Velocity);
|
||||
if (Physics.Raycast(ray, out var hit, Velocity.magnitude, LayerMask.NameToLayer("Combat")))
|
||||
{
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull)
|
||||
{
|
||||
hull.SendHit(Damage, DamageType, SourceEntity, hit);
|
||||
}
|
||||
StartCoroutine(Kill());
|
||||
}
|
||||
|
||||
transform.position += Velocity;
|
||||
if((transform.position - StartPosition).magnitude > Range)
|
||||
StartCoroutine(Kill());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Kill()
|
||||
|
|
|
|||
Loading…
Reference in a new issue