Exemple #1
0
 private void ForceWallAgreement(ZapBlockScript target_block_script, Direction source_direction, bool on)
 {
     if (source_direction == Direction.Up)
     {
         target_block_script.SetLightDirection(Direction.Down, on, true, false);
         return;
     }
     if (source_direction == Direction.Down)
     {
         target_block_script.SetLightDirection(Direction.Up, on, true, false);
         return;
     }
     if (source_direction == Direction.Left)
     {
         target_block_script.SetLightDirection(Direction.Right, on, true, false);
         return;
     }
     if (source_direction == Direction.Right)
     {
         target_block_script.SetLightDirection(Direction.Left, on, true, false);
         return;
     }
 }
Exemple #2
0
 public void SetLightDirection(Direction direction, bool on, bool record_change = true, bool force_agreement = true)
 {
     if (direction == Direction.Up)
     {
         ZapBlockScript target_block = findOtherZapBlock(new Vector2Int(0, 1));
         if (target_block != null)
         {
             ChangeLightList(UpperWallLights, on);
             ChangeIndicatorLight(UpperWarning, on);
             if (record_change)
             {
                 UpOn = on;
             }
             if (force_agreement)
             {
                 ForceWallAgreement(target_block, direction, on);
             }
         }
         else
         {
             ChangeLightList(UpperWallLights, false);
             ChangeIndicatorLight(UpperWarning, false);
             if (record_change)
             {
                 UpOn = false;
             }
         }
         return;
     }
     if (direction == Direction.Down)
     {
         ZapBlockScript target_block = findOtherZapBlock(new Vector2Int(0, -1));
         if (target_block != null)
         {
             ChangeLightList(LowerWallLights, on);
             ChangeIndicatorLight(LowerWarning, on);
             if (record_change)
             {
                 DownOn = on;
             }
             if (force_agreement)
             {
                 ForceWallAgreement(target_block, direction, on);
             }
         }
         else
         {
             ChangeLightList(LowerWallLights, false);
             ChangeIndicatorLight(LowerWarning, false);
             if (record_change)
             {
                 DownOn = false;
             }
         }
         return;
     }
     if (direction == Direction.Left)
     {
         ZapBlockScript target_block = findOtherZapBlock(new Vector2Int(-1, 0));
         if (target_block != null)
         {
             ChangeLightList(LeftWallLights, on);
             ChangeIndicatorLight(LeftWarning, on);
             if (record_change)
             {
                 LeftOn = on;
             }
             if (force_agreement)
             {
                 ForceWallAgreement(target_block, direction, on);
             }
         }
         else
         {
             ChangeLightList(LeftWallLights, false);
             ChangeIndicatorLight(LeftWarning, false);
             if (record_change)
             {
                 LeftOn = false;
             }
         }
         return;
     }
     if (direction == Direction.Right)
     {
         ZapBlockScript target_block = findOtherZapBlock(new Vector2Int(1, 0));
         if (target_block != null)
         {
             ChangeLightList(RightWallLights, on);
             ChangeIndicatorLight(RightWarning, on);
             if (record_change)
             {
                 RightOn = on;
             }
             if (force_agreement)
             {
                 ForceWallAgreement(target_block, direction, on);
             }
         }
         else
         {
             ChangeLightList(RightWallLights, false);
             ChangeIndicatorLight(RightWarning, false);
             if (record_change)
             {
                 RightOn = false;
             }
         }
         return;
     }
 }