Пример #1
0
 public ComplexTarget(Vector3 location)
 {
     TargetType = ComplexTargetType.Vector3;
     _target    = null;
     _vector    = location;
     _surface   = DefualtSurface;
 }
Пример #2
0
 public ComplexTarget(Vector3 location, IPlanarSurface surface)
 {
     TargetType = ComplexTargetType.Vector2;
     _target    = null;
     _vector    = location;
     _surface   = surface;
 }
Пример #3
0
 private void ValidateSurfaceData()
 {
     _surface = _surfaceData as IPlanarSurface;
     if (_surface == null)
     {
         _surface = XYPlanarSurface.Default;
     }
 }
Пример #4
0
 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;
 }
Пример #5
0
 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;
 }
Пример #6
0
 public ComplexTarget(Transform target)
 {
     if (target != null)
     {
         TargetType = ComplexTargetType.Transform;
         _target    = target;
     }
     else
     {
         TargetType = ComplexTargetType.Null;
         _target    = null;
     }
     _vector  = Vector3.zero;
     _surface = DefualtSurface;
 }
Пример #7
0
 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;
 }