示例#1
0
    /// <summary>
    /// Reflects the given directional laser in a reflected direction at the hit position
    /// </summary>
    /// <param name="dirLaser"> Directional laser to be reflected </param>
    /// <param name="hitPosition"> Position where the given directional laser hits </param>
    public void ReflectLaser(DirectionalLaser dirLaser, Vector3 hitPosition)
    {
        var mirroredDirection = LaserUtil.GetMirroredDirection(FaceDirection, dirLaser.Direction);

        if (mirroredDirection != null)
        {
            LaserUtil.SendLaser(this, dirLaser.Laser, mirroredDirection.Value, hitPosition);
        }
    }
示例#2
0
 private void Update()
 {
     if (laserObject.IsPowered)
     {
         for (int i = 0; i < outputLasers.Length; i++)
         {
             if (!outputLasers[i].IsNullLaser)
             {
                 LaserUtil.SendLaser(this, outputLasers[i], (Direction)i);
             }
         }
     }
 }
示例#3
0
    protected override void Awake()
    {
        base.Awake();

        base.UpdateLaser(new DirectionalLaser(starterLaser, LaserUtil.GetDirection(transform.forward)));
    }
示例#4
0
 /// <summary>
 /// Processes the combined input lasers and updates output lasers (default: Updates front facing output laser to combined laser)
 /// </summary>
 /// <param name="combinedLaser"> Laser to be processed </param>
 public virtual void ProcessLaserInput(Laser combinedLaser)
 {
     UpdateLaser(new DirectionalLaser(combinedLaser, LaserUtil.GetDirection(transform.forward)));
 }
    /// <summary>
    /// Splits combined laser into RGB components. Red to the left, Green forward, Blue to the right.
    /// If a component isn't part of the laser, just sends a null laser
    /// </summary>
    /// <param name="combinedLaser"> Laser to be processed </param>
    public override void ProcessLaserInput(Laser combinedLaser)
    {
        var red   = new DirectionalLaser(Laser.Filter(combinedLaser, LaserColor.Red), LaserUtil.GetNextDirection(FaceDirection, false));
        var green = new DirectionalLaser(Laser.Filter(combinedLaser, LaserColor.Green), FaceDirection);
        var blue  = new DirectionalLaser(Laser.Filter(combinedLaser, LaserColor.Blue), LaserUtil.GetNextDirection(FaceDirection, true));

        UpdateLaser(red);
        UpdateLaser(green);
        UpdateLaser(blue);
    }
示例#6
0
 protected bool IsFrontHitFrom(Direction laserDirection)
 {
     return(LaserUtil.IsObtuse(laserDirection, FaceDirection));
 }
示例#7
0
 /// <summary>
 /// Filters the given laser and sends the filtered laser out in the same direction from the hit position
 /// </summary>
 /// <param name="dirLaser"> Directional laser to be filtered </param>
 /// <param name="hitPosition"> Position where the given directional laser hits </param>
 public void FilterLaser(DirectionalLaser dirLaser, Vector3 hitPosition)
 {
     LaserUtil.SendLaser(this, Laser.Filter(dirLaser.Laser, filterColor), dirLaser.Direction, hitPosition);
 }