Exemplo n.º 1
0
    public void NewBiome(Biome biome, int minutesPassed)
    {
        if (_playerCharacter.GetTotalWeight() > _playerCharacter.WeightLimit)
        {
            minutesPassed *= 2;
        }
        Journey.UpdateTime(minutesPassed);
        _playerCharacter.RegenerationFromMinutes(minutesPassed);
        var remainingCards = GameObject.FindGameObjectsWithTag(Constants.TagGrabbableCard);

        foreach (var card in remainingCards)
        {
            Destroy(card);
        }
        _avoidBhv.EnableButton();
        Journey.CurrentBiomeChoice = 0;
        Journey.Step  = 1;
        Journey.Biome = biome;
        Instantiator.NewRandomCard(1, Journey.Day, Journey.Biome, _playerCharacter);
        _currentCard = GameObject.Find("Card1");
        Instantiator.PopText(Helper.TimeFromMinutes(minutesPassed), (Vector2)_currentCard.transform.position + new Vector2(0.0f, 1.6f), TextType.Normal);
        //backCard.GetComponent<CardBhv>().BringToFront();
        _avoidBhv.EndActionDelegate   = _currentCard.GetComponent <CardBhv>().Avoid;
        _ventureBhv.EndActionDelegate = _currentCard.GetComponent <CardBhv>().Venture;
        Instantiator.NewRandomCard(0, Journey.Day, Journey.Biome, _playerCharacter);
        UpdateDisplayJourneyAndCharacterStats();
    }
Exemplo n.º 2
0
 private void LoadPage(int pageId)
 {
     for (int i = 0; i < _maxPage; ++i)
     {
         var page = transform.Find($"Page{i.ToString("00")}");
         if (i == pageId)
         {
             page.transform.position = transform.position;
         }
         else
         {
             page.transform.position = _resetPagePosition;
         }
     }
     if (pageId <= 0)
     {
         _pageUp.DisableButton();
     }
     else
     {
         _pageUp.EnableButton();
     }
     if (pageId + 1 >= _maxPage)
     {
         _pageDown.DisableButton();
     }
     else
     {
         _pageDown.EnableButton();
     }
 }
Exemplo n.º 3
0
    private void LoadList(int start)
    {
        var spaceBetween = 12 * Constants.Pixel;

        var alreadyCount = _listStartPosition.transform.childCount;

        if (alreadyCount > 0)
        {
            for (int deadId = alreadyCount - 1; deadId >= 0; --deadId)
            {
                Destroy(_listStartPosition.GetChild(deadId).gameObject);
            }
        }
        int i = 0;
        int y = 0;

        foreach (var device in _devices)
        {
            if (i < start)
            {
                ++i;
                continue;
            }
            if (y >= 5)
            {
                break;
            }
            var tmpButtonObject   = Resources.Load <GameObject>("Prefabs/DevicePopupButton");
            var tmpButtonInstance = Instantiate(tmpButtonObject, _listStartPosition.position + new Vector3(-0.8557f, -spaceBetween * y, 0.0f), tmpButtonObject.transform.rotation);
            tmpButtonInstance.name = $"DeviceChoice{i}";
            string tmpName = device.Name;
            tmpButtonInstance.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = tmpName.ToLower();
            tmpButtonInstance.GetComponent <ButtonBhv>().EndActionDelegate = SelectDevice;
            tmpButtonInstance.transform.SetParent(_listStartPosition);
            ++i;
            ++y;
        }

        if (start <= 0)
        {
            _pageUp.DisableButton();
        }
        else
        {
            _pageUp.EnableButton();
        }
        if (start + y >= _devicesLength)
        {
            _pageDown.DisableButton();
        }
        else
        {
            _pageDown.EnableButton();
        }
    }
Exemplo n.º 4
0
 public void ManagePlayerButtons()
 {
     if (State == FightState.PlayerTurn)
     {
         _buttonPass.EnableButton();
         _buttonRunAway.EnableButton();
         _buttonWeapon1.EnableButton();
         _buttonWeapon2.EnableButton();
         var skill = PlayerBhv.Character.Skills[0];
         if (!skill.IsUnderCooldown())
         {
             _buttonSkill1.EnableButton();
             _buttonSkill1.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = string.Empty;
         }
         else
         {
             _buttonSkill1.DisableButton();
             _buttonSkill1.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = skill.Cooldown <= skill.CooldownMax && skill.Cooldown > 0 ? skill.Cooldown.ToString() : string.Empty;
         }
         skill = PlayerBhv.Character.Skills[1];
         if (!skill.IsUnderCooldown())
         {
             _buttonSkill2.EnableButton();
             _buttonSkill2.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = string.Empty;
         }
         else
         {
             _buttonSkill2.DisableButton();
             _buttonSkill2.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = skill.Cooldown <= skill.CooldownMax && skill.Cooldown > 0 ? skill.Cooldown.ToString() : string.Empty;
         }
     }
     else
     {
         _buttonPass.DisableButton();
         _buttonRunAway.DisableButton();
         _buttonWeapon1.DisableButton();
         _buttonWeapon2.DisableButton();
         _buttonSkill1.DisableButton();
         _buttonSkill2.DisableButton();
     }
 }
Exemplo n.º 5
0
    private void LoadList(int start)
    {
        var spaceBetween = 12 * Constants.Pixel;

        _listLength = _list.Count;
        var alreadyCount = _listStartPosition.transform.childCount;

        if (alreadyCount > 0)
        {
            for (int i = alreadyCount - 1; i >= 0; --i)
            {
                Destroy(_listStartPosition.GetChild(i).gameObject);
            }
        }
        int y = 0;

        for (int i = start; i < _listLength && y < 5; ++i)
        {
            var tmpButtonObject   = Resources.Load <GameObject>("Prefabs/DevicePopupButton");
            var tmpButtonInstance = Instantiate(tmpButtonObject, _listStartPosition.position + new Vector3(-0.8557f, -spaceBetween * y, 0.0f), tmpButtonObject.transform.rotation);
            tmpButtonInstance.name = $"EnumChoice{i}";
            string tmpName = _list[i];
            tmpButtonInstance.transform.GetChild(0).GetComponent <TMPro.TextMeshPro>().text = tmpName.ToLower();
            tmpButtonInstance.GetComponent <ButtonBhv>().EndActionDelegate = SelectEnum;
            tmpButtonInstance.transform.SetParent(_listStartPosition);
            ++y;
        }
        if (start <= _startId)
        {
            _pageUp.DisableButton();
        }
        else
        {
            _pageUp.EnableButton();
        }
        if (start + y >= _listLength)
        {
            _pageDown.DisableButton();
        }
        else
        {
            _pageDown.EnableButton();
        }
    }
Exemplo n.º 6
0
 private void LoadList<EnumType>(int start) where EnumType : System.Enum
 {
     var spaceBetween = 12 * Constants.Pixel;
     var values = (EnumType[])System.Enum.GetValues(typeof(EnumType));
     _enumLength = values.Length;
     var alreadyCount = _listStartPosition.transform.childCount;
     if (alreadyCount > 0)
     {
         for (int i = alreadyCount - 1; i >= 0; --i)
             Destroy(_listStartPosition.GetChild(i).gameObject);
     }
     int y = 0;
     var reachedTheEnd = false;
     for (int i = start; i < _enumLength && y < 5; ++i)
     {
         if (values[i].GetHashCode() == -1)
         {
             reachedTheEnd = true;
             continue;
         }
         var tmpButtonObject = Resources.Load<GameObject>("Prefabs/EnumButton");
         var tmpButtonInstance = Instantiate(tmpButtonObject, _listStartPosition.position + new Vector3(0.0f, -spaceBetween * y, 0.0f), tmpButtonObject.transform.rotation);
         tmpButtonInstance.name = $"EnumChoice{values[i].GetHashCode()}";
         string tmpName = values[i].GetDescription();
         tmpButtonInstance.transform.GetChild(0).GetComponent<TMPro.TextMeshPro>().text = tmpName.ToLower();
         tmpButtonInstance.GetComponent<ButtonBhv>().EndActionDelegate = SelectEnum;
         tmpButtonInstance.transform.SetParent(_listStartPosition);
         ++y;
     }
     if (start <= _startId)
         _pageUp.DisableButton();
     else
         _pageUp.EnableButton();
     if (start + y >= _enumLength || reachedTheEnd)
         _pageDown.DisableButton();
     else
         _pageDown.EnableButton();
 }