Beispiel #1
0
 public override void OnStateChanged(GameState newState, GameState oldState)
 {
     // Start reading
     if (newState.HubaForest.IsReadingMap && (oldState == null || !oldState.HubaForest.IsReadingMap))
     {
         Map.SetActive(true);
         Handler.OpenBook();
         GameController.Instance.isUI = true;
     }
     // Stop reading
     else if (!newState.HubaForest.IsReadingMap && (oldState == null || oldState.HubaForest.IsReadingMap))
     {
         Map.SetActive(false);
         GameController.Instance.isUI = false;
     }
 }
Beispiel #2
0
 public override void OnStateChanged(GameState newState, GameState oldState)
 {
     // Start reading
     if (newState.AnnanaHouse.ReadingVeganBook && (oldState == null || !oldState.AnnanaHouse.ReadingVeganBook))
     {
         Book.SetActive(true);
         Handler.OpenBook();
         GameController.Instance.isUI = true;
     }
     // Stop reading
     else if (!newState.AnnanaHouse.ReadingVeganBook && (oldState == null || oldState.AnnanaHouse.ReadingVeganBook))
     {
         Book.SetActive(false);
         GameController.Instance.isUI = false;
     }
 }
Beispiel #3
0
    public override void OnStateChanged(GameState newState, GameState oldState)
    {
        // Start reading
        if (newState.AnnanaHouse.IsReadingFridgeNote && (oldState == null || !oldState.AnnanaHouse.IsReadingFridgeNote))
        {
            Book.SetActive(true);
            Handler.OpenBook();
            GameController.Instance.isUI = true;
        }
        // Stop reading
        else if (!newState.AnnanaHouse.IsReadingFridgeNote && (oldState == null || oldState.AnnanaHouse.IsReadingFridgeNote))
        {
            Book.SetActive(false);
            GameController.Instance.isUI = false;
        }

        // If note is picked up it is no longer on the fridge. We cannot destroy it however since we still need this script
        if (newState.AnnanaHouse.IsAddressPickedUp && (oldState == null || !oldState.AnnanaHouse.IsAddressPickedUp))
        {
            Destroy(gameObject.GetComponent <BoxCollider2D>());
            Destroy(gameObject.GetComponent <SpriteRenderer>());
        }
    }