Example #1
0
 public void Clear()
 {
     isOccupied = false;
     idStored = -1;
     if (boxLockedAt != null) {
         boxLockedAt.SetFree();
         boxLockedAt =null;
     }
 }
Example #2
0
 public void Clear()
 {
     isOccupied = false;
     idStored   = -1;
     if (boxLockedAt != null)
     {
         boxLockedAt.SetFree();
         boxLockedAt = null;
     }
 }
Example #3
0
 int GetTouchedBeacon(PatternBox box)
 {
     for (int i = 0;i< this.beacons.Count; i++) {
         var dis = beacons[i].transform.position - box.transform.position;
         if(dis.sqrMagnitude < BEACON_ACTIVE_DISTANCE_SQRT ){
             return i;
         }
     }
     return -1;
 }
Example #4
0
 int GetTouchedBeacon(PatternBox box)
 {
     for (int i = 0; i < this.beacons.Count; i++)
     {
         var dis = beacons[i].transform.position - box.transform.position;
         if (dis.sqrMagnitude < BEACON_ACTIVE_DISTANCE_SQRT)
         {
             return(i);
         }
     }
     return(-1);
 }
Example #5
0
    void BoxTouchedBeacon(PatternBox box, PatternBeacon beacon)
    {
        if (beacon == null) {
            box.SetFree ();
        } else {
            if(box.State == PatternBox.KState.LOCKED)
                box.beaconLockedAt.Clear();
            beacon.Clear();
            box.SetLock(beacon);
            beacon.Lock(box);

        }
    }
Example #6
0
 bool UpdateWaitingForInput()
 {
     if (!Input.GetMouseButtonDown(0))
     {
         return(false);
     }
     boxSelected = GetCollidedBox();
     //boxSelectedPositionInit = boxSelected.transform.position;
     if (boxSelected == null)
     {
         return(false);
     }
     meState = KState.Processing;
     return(true);
 }
Example #7
0
        private void PatternBox_Click(object sender, EventArgs e)
        {
            var loc = ((MouseEventArgs)e).Location;

            PatternSelectedTile = GetCurrentPattern().GetTile(
                loc.X / CELL_SIZE,
                loc.Y / CELL_SIZE
                );
            IsChangingPattern = true;
            PatternDirectionsPanel.Enabled = true;
            PatternSelectedTile.Directions = GetPatternDirections();
            RefreshPatternButtons(PatternSelectedTile);
            IsChangingPattern = false;
            PatternBox.Invalidate();
        }
Example #8
0
 void BoxTouchedBeacon(PatternBox box, PatternBeacon beacon)
 {
     if (beacon == null)
     {
         box.SetFree();
     }
     else
     {
         if (box.State == PatternBox.KState.LOCKED)
         {
             box.beaconLockedAt.Clear();
         }
         beacon.Clear();
         box.SetLock(beacon);
         beacon.Lock(box);
     }
 }
Example #9
0
        private void DeletePatternButton_Click(object sender, EventArgs e)
        {
            if (PatternBox.SelectedItem == null)
            {
                return;
            }

            patternDic.Remove((string)PatternBox.SelectedItem);
            PatternBox.Items.Remove(PatternBox.SelectedItem);
            PatternBox.SelectedItem = null;
            PatternBox.Update();
            PatternBox.Refresh();
            patternCounter--;
            patternCounterLabel.Text = "Pattern count: " + patternCounter;

            // Reset weights and retrain
            weights = new double[gridSize, gridSize];
            Train();
        }
Example #10
0
 public void Lock(PatternBox box)
 {
     boxLockedAt = box;
     isOccupied  = true;
     idStored    = box.id;
 }
Example #11
0
 bool UpdateWaitingForInput()
 {
     if(!Input.GetMouseButtonDown(0) ) return false;
     boxSelected = GetCollidedBox();
     //boxSelectedPositionInit = boxSelected.transform.position;
     if(boxSelected == null) return false;
     meState = KState.Processing;
     return true;
 }
Example #12
0
 public void Lock(PatternBox box)
 {
     boxLockedAt = box;
     isOccupied = true;
     idStored = box.id;
 }