public ComplexTarget(Vector3 location) { TargetType = ComplexTargetType.Vector3; _target = null; _vector = location; _surface = DefualtSurface; }
public ComplexTarget(Vector3 location, IPlanarSurface surface) { TargetType = ComplexTargetType.Vector2; _target = null; _vector = location; _surface = surface; }
private void ValidateSurfaceData() { _surface = _surfaceData as IPlanarSurface; if (_surface == null) { _surface = XYPlanarSurface.Default; } }
public ComplexTarget(Transform target, IPlanarSurface surface) { if (target != null) { TargetType = ComplexTargetType.Transform; _target = target; } else { TargetType = ComplexTargetType.Null; _target = null; } _vector = Vector3.zero; _surface = surface; }
public ComplexTarget(IAspect aspect, IPlanarSurface surface) { if (aspect != null) { TargetType = ComplexTargetType.Aspect; _target = aspect; } else { TargetType = ComplexTargetType.Null; _target = null; } _vector = Vector3.zero; _surface = surface; }
public ComplexTarget(Transform target) { if (target != null) { TargetType = ComplexTargetType.Transform; _target = target; } else { TargetType = ComplexTargetType.Null; _target = null; } _vector = Vector3.zero; _surface = DefualtSurface; }
public ComplexTarget(IAspect aspect) { if (aspect != null) { TargetType = ComplexTargetType.Aspect; _target = aspect; } else { TargetType = ComplexTargetType.Null; _target = null; } _vector = Vector3.zero; _surface = DefualtSurface; }
public static Vector2 GetDirection(IPlanarSurface surface, ForceDirection dir, Trans forceOrigin, Trans forceTarget) { if (surface == null) { return(Vector2.zero); } switch (dir) { case ForceDirection.Relative: return(surface.ProjectVectorTo2D(forceOrigin.Position, (forceTarget.Position - forceOrigin.Position)).normalized); case ForceDirection.Random: return(RandomUtil.Standard.OnUnitCircle()); case ForceDirection.Forward: return(surface.ProjectVectorTo2D(forceOrigin.Position, forceOrigin.Forward).normalized); } return(Vector2.zero); }
public static Vector2 GetDirection(IPlanarSurface surface, ForceDirection dir, Trans forceOrigin, Trans forceTarget) { if (surface == null) return Vector2.zero; switch (dir) { case ForceDirection.Relative: return surface.ProjectVectorTo2D(forceOrigin.Position, (forceTarget.Position - forceOrigin.Position)).normalized; case ForceDirection.Random: return RandomUtil.Standard.OnUnitCircle(); case ForceDirection.Forward: return surface.ProjectVectorTo2D(forceOrigin.Position, forceOrigin.Forward).normalized; } return Vector2.zero; }