Exemplo n.º 1
0
    public void GoToNextFloor()
    {
        UserInterface.DisplayLoadingScreen(true);
        UserInterface.HideMenu();
        if (Application.isMobilePlatform)
        {
            m_Player.SetInputMode(new InputMode_Movement());
        }
        else
        {
            m_Player.SetInputMode(new InputMode_MovementDebug());
        }
        Scene scene = SceneManager.GetActiveScene();

        SceneManager.LoadScene(scene.name);
    }
Exemplo n.º 2
0
 public override void ActivateEvent(I_Unit _UnitThatWalkedOnTile)
 {
     if (_UnitThatWalkedOnTile is UnitPlayer)
     {
         UnitPlayer player = _UnitThatWalkedOnTile as UnitPlayer;
         m_Player = player.GetComponent <ControllerPlayer>();
         if (Application.isMobilePlatform)
         {
             InputMode_Shake inputMode = new InputMode_Shake();
             inputMode.RegisterActivable(m_Activable);
             m_Player.SetInputMode(inputMode);
         }
         else
         {
             InputMode_ShakeDebug inputMode = new InputMode_ShakeDebug();
             inputMode.RegisterActivable(m_Activable);
             m_Player.SetInputMode(inputMode);
         }
     }
 }
Exemplo n.º 3
0
 public override void ActivateEvent(I_Unit _UnitThatWalkedOnTile)
 {
     if (_UnitThatWalkedOnTile is UnitPlayer)
     {
         UnitPlayer player = _UnitThatWalkedOnTile as UnitPlayer;
         m_Player = player.GetComponent <ControllerPlayer>();
         m_Player.SetInputMode(new InputMode_InMenu());
         List <KeyValuePair <string, OnUserInterfaceButtonPressed> > menuElements = new List <KeyValuePair <string, OnUserInterfaceButtonPressed> > {
             new KeyValuePair <string, OnUserInterfaceButtonPressed>("Proceed", GoToNextFloor), new KeyValuePair <string, OnUserInterfaceButtonPressed>("Exit", ExitMenu)
         };
         UserInterface.DisplayMenu(menuElements);
     }
 }
Exemplo n.º 4
0
 public void UpdateInputMode(UnitPlayer _Player, ControllerPlayer _Controller)
 {
     if (m_HasStartedShaking)
     {
         if (m_TimerBeforeCanChangeDirection > 0)
         {
             m_TimerBeforeCanChangeDirection -= Time.unscaledDeltaTime;
         }
         else
         {
             UserInterface.SetBellRing();
         }
         float newValue = Input.acceleration.z;
         if (m_WasGoingForward && newValue > m_LastValue + Time.unscaledDeltaTime * 3 || !m_WasGoingForward && newValue < m_LastValue - Time.unscaledDeltaTime * 3)
         {
             m_TimeGoingTheSameDirection += Time.unscaledDeltaTime;
         }
         else if (m_WasGoingForward && newValue < m_LastValue || !m_WasGoingForward && newValue > m_LastValue)
         {
             if (m_TimerBeforeCanChangeDirection <= 0)
             {
                 m_TimerBeforeCanChangeDirection = 0.25f;
                 if (m_TimeGoingTheSameDirection > 0.08f)
                 {
                     if (newValue < m_LastValue)
                     {
                         UserInterface.SetBellRingLeft();
                     }
                     else
                     {
                         UserInterface.SetBellRingRight();
                     }
                     m_NumberTimesShaked++;
                     if (m_NumberTimesShaked > 10)
                     {
                         m_HasStartedShaking = false;
                         for (int i = 0; i < m_Activables.Count; i++)
                         {
                             m_Activables[i].OnActivation();
                         }
                         _Controller.SetInputMode(new InputMode_Movement());
                     }
                 }
             }
             m_TimeGoingTheSameDirection = 0;
             m_WasGoingForward           = !m_WasGoingForward;
         }
         m_LastValue = newValue;
     }
 }
Exemplo n.º 5
0
 public void UpdateInputMode(UnitPlayer _Player, ControllerPlayer _Controller)
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         UserInterface.StartMagicalFormulaDrawing(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
     }
     if (Input.GetKeyUp(KeyCode.Mouse0))
     {
         List <int> magicalFormula = UserInterface.EndMagicalFormulaDrawing(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
         Spell      spellToCast    = _Player.GetCorrespondingSpell(magicalFormula);
         if (spellToCast != null)
         {
             _Controller.SetInputMode(new InputMode_MovementDebug());
             spellToCast.Cast(_Player);
         }
     }
     UserInterface.UpdateMagicalFormulaDrawing(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
 }
    public void UpdateInputMode(UnitPlayer _Player, ControllerPlayer _Controller)
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            if (m_GoingRight)
            {
                UserInterface.SetBellRingLeft();
                m_TimesShaked++;
            }
        }
        else if (Input.GetKey(KeyCode.A))
        {
            m_GoingRight = false;
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            if (!m_GoingRight)
            {
                UserInterface.SetBellRingRight();
                m_TimesShaked++;
            }
        }
        else if (Input.GetKey(KeyCode.E))
        {
            m_GoingRight = true;
        }
        else
        {
            UserInterface.SetBellRing();
        }

        if (m_TimesShaked > 10)
        {
            for (int i = 0; i < m_Activables.Count; i++)
            {
                m_Activables[i].OnActivation();
            }
            _Controller.SetInputMode(new InputMode_MovementDebug());
        }
    }