public List <Shitter> GenerateShitters(int quantity, float maxShitAmmount)
    {
        var result = new List <Shitter>(quantity);

        var toAdd = new List <SocialPosition>();

        for (int i = 0; i < _socialPositionValues.Count; i++)
        {
            var chance = ScriptableObjectHolder.Instance.GameConfiguration.SocialPositionByChance.Find(s => s.SocialPosition == _socialPositionValues[i]).Chance;
            for (int j = 0; j < chance; j++)
            {
                toAdd.Add(_socialPositionValues[i]);
            }
        }

        var random = new Random();

        for (int i = 0; i < quantity; i++)
        {
            var shitter = new Shitter();

            var name = ScriptableObjectHolder.Instance.GameDatabase.Names[random.Next(0, ScriptableObjectHolder.Instance.GameDatabase.Names.Count)];

            shitter.Name           = name;
            shitter.ShitAmmount    = .5f + (float)(random.NextDouble() * maxShitAmmount);
            shitter.SpriteShitter  = Images[random.Next(0, Images.Count)];
            shitter.SocialPosition = toAdd[random.Next(0, toAdd.Count)];

            result.Add(shitter);
        }

        return(result);
    }
 public void AskPermition(Shitter shitter)
 {
     InnerPlayeMessage(shitter, shitter.GetMessageForPlayer(), () =>
     {
         SetButtons(true);
     });
 }
 private void InnerPlayeMessage(Shitter shitter, string message, Action callback, bool waitForClick = false)
 {
     TextMessage.text = string.Empty;
     StartCoroutine(CoroutineHelper.Instance.ShowText(message, (text) =>
     {
         TextMessage.text = text;
     }, callback, waitForClickToCallback: waitForClick));
 }
 public void ShitterArrive(Shitter shitter)
 {
     _currentShitter = shitter;
     QueueManager.RemovePeople(_currentShitter);
     WorkGuiManager.ShitterArrive(shitter, () =>
     {
         WorkGuiManager.AskPermition(shitter);
     });
 }
    private IEnumerator ShitterShiting(Shitter shitter)
    {
        var shitAmmountPerTick = shitter.ShitAmmount / 100f;
        var timeToWait         = shitter.TimeShitting / 100f;

        StartCoroutine(MakeFartNoises(shitter.TimeShitting));
        for (int i = 0; i < 100; i++)
        {
            yield return(new WaitForSeconds(timeToWait));

            GameManager.Instance.ShitAmmount += shitAmmountPerTick;
        }
        ShitterLeave(false);
    }
Пример #6
0
    public void RemovePeople(Shitter shitter)
    {
        var shitterItem = Shitters.Find(i => i.Shitter == shitter);

        if (shitter == null)
        {
            return;
        }

        Shitters.Remove(shitterItem);
        shitterItem.FadeOut();
        shitterItem.transform.DOScale(Vector3.zero, .3f).OnComplete(() =>
        {
            Destroy(shitterItem.gameObject);
        });
    }
    public void Setup(Shitter shitter)
    {
        Shitter = shitter;

        if (ShitterNameText != null)
        {
            StartCoroutine(SetName());
        }

        ShitterImage.sprite = shitter.SpriteShitter;

        var scaleValue = shitter.ShitAmmount / (ScriptableObjectHolder.Instance.GameConfiguration.MaxShitAmmount / (GameManager.Instance.TodaysShitters.Count * 1f));

        scaleValue = Mathf.Min(scaleValue, 1f);
        ImageShitAmmount.transform.localScale = new Vector3(scaleValue, scaleValue, 1f);

        SocialPosition.sprite = ScriptableObjectHolder.Instance.GameDatabase.SpriteBySocialPosition.Find(t => t.SocialPosition == shitter.SocialPosition).Sprite;
    }
 public void ShitterArrive(Shitter shitter, Action callback)
 {
     ImageShitter.sprite = shitter.SpriteShitter;
     DOTween.ToAlpha(() => ImageShitter.color, (color) =>
     {
         ImageShitter.color = color;
     }, 1f, 1f);
     ImageShitter.transform.DOScale(Vector3.one, .5f).OnComplete(() =>
     {
         if (callback != null)
         {
             callback();
         }
     });
     CurrentShitterItem.Setup(shitter);
     CurrentShitterItem.FadeIn();
     SetButtons(false);
 }
Пример #9
0
    public void AddPeople(Shitter shitter)
    {
        if (Shitters.Exists(i => i.Shitter == shitter))
        {
            return;
        }

        var people = (GameObject)Instantiate(PeoplePrefab);

        people.transform.SetParent(LayoutGroup.transform);
        var shitterItem = people.GetComponent <ShitterQueueItem>();

        shitterItem.Setup(shitter);

        people.transform.localScale = Vector3.zero;
        people.transform.DOScale(Vector3.one, .3f).OnComplete(() =>
        {
            Shitters.Add(shitterItem);
        });
    }
    public void ShowMessage(Shitter shitter, string message, Action callback, bool fromPlayer = false, bool accepted = true)
    {
        Color cached = TextMessage.color;

        if (fromPlayer)
        {
            TextMessage.color = ColorForPlayerMessage;
        }
        InnerPlayeMessage(shitter, message, () =>
        {
            if (fromPlayer)
            {
                TextMessage.color = cached;
            }

            if (callback != null)
            {
                callback();
            }
        }, !accepted);
    }
Пример #11
0
 void Start()
 {
     CurrentDay = 0;
     Shitter.BakeDialogs();
 }
Пример #12
0
 private void Start()
 {
     shitter = this;
 }