Exemplo n.º 1
0
    private void TSHandleLokiEvent(LokiZone zone, LokiEventType lEvent)
    {
      Console.WriteLine("LokiEvent: {0} in {1}", lEvent, zone);
      foreach (LokiZone tmpZ in labels.Keys)
      {
        Label tmpL = (Label)labels[tmpZ];
        tmpL.Content = String.Empty;
      }

      Label zoneLabel = (Label)labels[zone];
      zoneLabel.Content = lEvent;
    }
Exemplo n.º 2
0
 public void HandleLokiEvent(LokiZone zone, LokiEventType lEvent)
 {
   Dispatcher.Invoke((Action<LokiZone, LokiEventType>)TSHandleLokiEvent, zone, lEvent);
 }
 private void HandleInteractiveModeEvent(LokiZone zone, LokiEventType lEvent)
 {
   if (lEvent == LokiEventType.ZoneReleased)
   {
     if (zone == LokiUtil.LokiManager.Zone2)
       Elephant.Trunk = false;
     if (zone == LokiUtil.LokiManager.Zone4)
       Elephant.YellowEar = false;
     if (zone == LokiUtil.LokiManager.Zone6)
       Elephant.GreenEar = false;
     if (zone == LokiUtil.LokiManager.Zone7)
       Elephant.BlueHand = false;
     if (zone == LokiUtil.LokiManager.Zone9)
       Elephant.GreenHand = false;
     if (zone == LokiUtil.LokiManager.Zone8)
       Elephant.Belly = false;
   }
   else if (lEvent == LokiEventType.ZonePressed)
   {
     if (zone == LokiUtil.LokiManager.Zone2)
       Elephant.Trunk = true;
     if (zone == LokiUtil.LokiManager.Zone4)
       Elephant.YellowEar = true;
     if (zone == LokiUtil.LokiManager.Zone6)
       Elephant.GreenEar = true;
     if (zone == LokiUtil.LokiManager.Zone7)
       Elephant.BlueHand = true;
     if (zone == LokiUtil.LokiManager.Zone9)
       Elephant.GreenHand = true;
     if (zone == LokiUtil.LokiManager.Zone8)
       Elephant.Belly = true;
   }
 }
    private void HandleLokiInputEvent(LokiZone zone, LokiEventType lEvent)
    {
      if (lEvent == LokiEventType.ZoneReleased)
        return;

      BodyPart part = BodyPartConverter.GetBodyPart(zone);
      if (CurrentLevel.CurrentStep.Gesture == lEvent && CurrentLevel.CurrentStep.Part == part)
      {
        if (CurrentLevel.CurrentStepIndex != CurrentLevel.Steps.Count)
        {
          CurrentLevel.CurrentStepIndex++;
        }
        else  //finished the level
        {
          if (CurrentLevelIndex != Levels.Count)
          {
            CurrentLevelIndex++;
            CurrentState = GameState.LevelStart;
          }
          else //finished the game, starts all over again
          {
            CurrentLevelIndex = 1;
            Levels.ForEach(delegate(Level level)
            {
              level.CurrentStepIndex = 1;
            });
            CurrentState = GameState.LevelStart;
          }
        }
      }
      else //wrong combination
      {
        CurrentState = GameState.ErrorAlert;
        eaTimer.Start();
      }
    }
    public void HandleLokiEvent(LokiZone zone, LokiEventType lEvent)
    {
      if (CurrentState != GameState.LokiInput && CurrentState != GameState.ErrorAlert && CurrentState != GameState.InteractiveMode)
        return;

      lock (this)
      {
        if (CurrentState == GameState.InteractiveMode)
          HandleInteractiveModeEvent(zone, lEvent);
        else if (CurrentState == GameState.LokiInput || CurrentState == GameState.ErrorAlert)
          HandleLokiInputEvent(zone, lEvent);
        Console.WriteLine("LokiEvent: {0} in {1}", lEvent, zone);
      }
    }