| | | 1 | | using UnityEngine; |
| | | 2 | | |
| | | 3 | | // The fixed hierarchical object represents a hierarchical object with a fixed position, velocity, |
| | | 4 | | // and acceleration and should primarily be used for testing. |
| | | 5 | | public class FixedHierarchical : HierarchicalBase, IHierarchical { |
| | | 6 | | // Shadowing is necessary because the parent's position, velocity, and acceleration are not |
| | | 7 | | // settable. The speed must be shadowed to prevent using the parent's velocity property. |
| | 0 | 8 | | public new Vector3 Position { get; set; } |
| | 0 | 9 | | public new Vector3 Velocity { get; set; } |
| | 0 | 10 | | public new float Speed => Velocity.magnitude; |
| | 0 | 11 | | public new Vector3 Acceleration { get; set; } |
| | 0 | 12 | | public override bool IsTerminated => false; |
| | | 13 | | |
| | 0 | 14 | | public FixedHierarchical() : this(position: Vector3.zero) {} |
| | | 15 | | public FixedHierarchical(in Vector3 position) |
| | 0 | 16 | | : this(position: position, velocity: Vector3.zero) {} |
| | | 17 | | public FixedHierarchical(in Vector3 position, in Vector3 velocity) |
| | 0 | 18 | | : this(position: position, velocity: velocity, acceleration: Vector3.zero) {} |
| | 0 | 19 | | public FixedHierarchical(in Vector3 position, in Vector3 velocity, in Vector3 acceleration) { |
| | 0 | 20 | | Position = position; |
| | 0 | 21 | | Velocity = velocity; |
| | 0 | 22 | | Acceleration = acceleration; |
| | 0 | 23 | | } |
| | | 24 | | } |