Esempio n. 1
0
 void Start()
 {
     _worker          = GetComponent <Worker>();
     _factionCom      = GetComponent <FactionCom>();
     _beliefControler = GetComponent <BeliefControler>();
     _needs           = GetComponent <Needs>();
 }
Esempio n. 2
0
        public void ImplementationNotAvailableInDeferredNeeds()
        {
            var needs0 = new Needs();
            var needs1 = new Needs().Defer(needs0);

            Expect.Error <ImplementationUnresolvedException>(() => needs1.Get <ISomeInterface>());
        }
Esempio n. 3
0
    private void NeedFeedback(Needs need)
    {
        bool fulfilledNeed = false;

        switch (need)
        {
        case Needs.FoodNeed:
            fulfilledNeed = Eat();
            break;

        case Needs.DrinkNeed:
            fulfilledNeed = Drink();
            break;

        case Needs.RestNeed:
            break;

        case Needs.KillNeed:
            break;

        default:
            throw new ArgumentOutOfRangeException("need", need, null);
        }
        if (fulfilledNeed)
        {
            return;
        }

        PlayerController.Instance.PlayerIsSearching(this);
    }
Esempio n. 4
0
        public void ReferringToNestedClass()
        {
            var needs = new Needs().ReferChildren(typeof(ParentClass));

            Assert.IsInstanceOf <ParentClass.ImplementationX>(needs.Get <IInterfaceX>());
            Assert.IsInstanceOf <ParentClass.ImplementationY>(needs.Get <IInterfaceY>());
        }
Esempio n. 5
0
        public void ReferringToAssembly()
        {
            var needs = new Needs().Refer(typeof(DependencyInjection).Assembly);

            Assert.IsInstanceOf <ParentClass.ImplementationX>(needs.Get <IInterfaceX>());
            Assert.IsInstanceOf <ParentClass.ImplementationY>(needs.Get <IInterfaceY>());
        }
    private void CheckComfortLevel()
    {
        stressBar.value = currentComfortLevel;

        if (currentComfortLevel <= 0)
        {
            Instantiate(angryKitten, transform.position, Quaternion.identity);
            GameManager.kittensLeft--;
            Destroy(this.gameObject);
        }

        if (currentComfortLevel <= 50 && currentNeeds == Needs.None)
        {
            currentNeeds           = (Needs)UnityEngine.Random.Range(1, 4);
            currentNeedsText.text  = currentNeeds.ToString();
            currentComfortDecrease = comfortDecrease * 1.5f;
            stressBar.fillRect.GetComponent <Image>().color = stressedColor;
        }

        if (currentComfortLevel > 50 && currentNeeds != Needs.None)
        {
            currentNeeds           = Needs.None;
            currentNeedsText.text  = "";
            currentComfortDecrease = comfortDecrease;
            stressBar.fillRect.GetComponent <Image>().color = relaxedColor;
        }
    }
Esempio n. 7
0
        public Needs TimePassed()
        {
            _needs = new TimePasses();
            _needs.SendingNeeds();

            return(_needs);
        }
        private async void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            DisableErrors();
            if (!CheckInput())
            {
                return;
            }

            var need = new Needs
            {
                CenterId    = _centerId,
                Description = txtDescription.Text
            };
            var error = false;

            try
            {
                await Service.InsertItemAsync(need);
            }
            catch (Exception ex)
            {
                error = true;
            }

            if (error)
            {
                MessageBox.Show("Something went wrong!");
                return;
            }

            NavigationService.GoBack();
        }
Esempio n. 9
0
        public Needs Sleep()
        {
            _needs = new Sleep();
            _needs.SendingNeeds();

            return(_needs);
        }
Esempio n. 10
0
        public Needs MakeAPoop()
        {
            _needs = new MakeAPoop();
            _needs.SendingNeeds();

            return(_needs);
        }
Esempio n. 11
0
        public Needs Play()
        {
            _needs = new Play();
            _needs.SendingNeeds();

            return(_needs);
        }
Esempio n. 12
0
        public Needs Feed()
        {
            _needs = new Feed();
            _needs.SendingNeeds();

            return(_needs);
        }
Esempio n. 13
0
        public void DeferringToAnotherNeeds()
        {
            var needs0 = new Needs().Add <ISomeInterface>(new SomeImplementation());
            var needs1 = new Needs().Defer(needs0);

            Assert.IsInstanceOf <SomeImplementation>(needs1.Get <ISomeInterface>());
        }
Esempio n. 14
0
 public Need(Needs name)
 {
     this.name      = name;
     amountReceived = 0;
     maxAmount      = 100;
     active         = false;
 }
Esempio n. 15
0
 public entityNeed(Needs _Need, int _maxCapacity, int _Value, int _Decrement)
 {
     Need        = _Need;
     maxCapacity = _maxCapacity;
     Value       = _Value;
     Increment   = _Decrement;
 }
Esempio n. 16
0
 // Use this for initialization
 public void CreateNeed(Needs type, float decreaseRate)
 {
     need     = type;
     value    = 70f;
     decrease = decreaseRate;
     InvokeRepeating("UpdateNeed", 2, 5);
 }
Esempio n. 17
0
    void Decay()
    {
        if (!inProgress)
        {
            needs = Needs.Idle;
            if (PlayerStats.instance.energy <= low)
            {
                needs = Needs.Energy;
            }

            if (PlayerStats.instance.hunger <= low)
            {
                needs = Needs.Hunger;
            }

            if (PlayerStats.instance.hygene <= low)
            {
                needs = Needs.Hygene;
            }

            if (PlayerStats.instance.thirst <= low)
            {
                needs = Needs.Thirst;
            }
        }
    }
        public NeedsRefactorAttribute(params Needs[] neededActions)
        {
#if UNITY_EDITOR
            Needs finalNeed = 0;
            neededActions.Foreach(need => finalNeed |= need);
            NeededAction = finalNeed.ToString();
#endif
        }
Esempio n. 19
0
            public void ImplementationsCanBeDeterminedByNewType()
            {
                var needs = new Needs();

                needs.Add(new PearVariant(new SomeImplementation()));
                needs.Add(new PlumVariant(new SomeImplementation()));
                Assert.AreNotEqual(needs.Get <PearVariant>().Value, needs.Get <PlumVariant>().Value);
            }
Esempio n. 20
0
 void Start()
 {
     aiCharacterControl = GetComponent <AICharacterControl>();
     gameController     = FindObjectOfType <GameController>();
     needs           = GetComponent <Needs>();
     randomDistance  = Random.Range(2f, 5f);
     randomWalkSpeed = Random.Range(0.4f, 0.65f);
     ResetTimer();
 }
    public virtual void SetupActionForMe(Needs _needs)
    {
        needs = _needs; // sets the player and is now occupied

        if (myObject != null)
        {
            myObject.GetAdvertisedActions().Remove(this);
        }
    }
Esempio n. 22
0
 void OnTriggerExit(Collider collider)
 {
     if (collider.gameObject == user)
     {
         occupied = false;
         user     = null;
         needs    = null;
     }
 }
Esempio n. 23
0
    void UpdateNeed()
    {
        sortedNeeds = sortedNeeds.OrderBy(o => o.value).ToList();

        highestPriority = sortedNeeds.First();
        currentNeed     = highestPriority.need;

        CalculateOverallHapiness();
        SetTargetToMoveTo();
    }
Esempio n. 24
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.GetComponent <Needs>())
     {
         user      = collider.gameObject;
         needs     = collider.gameObject.GetComponent <Needs>();
         occupied  = true;
         userQueue = null;
         //TODO pee animation, ReduceWcNeed() on end
     }
 }
Esempio n. 25
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.GetComponent <Needs>())
     {
         user      = collider.gameObject;
         needs     = collider.gameObject.GetComponent <Needs>();
         occupied  = true;
         userQueue = null;
         //TODO set animation, AddComfort() on end
     }
 }
Esempio n. 26
0
 void OnTriggerEnter(Collider collider)
 {
     if (!occupied && collider.GetComponent <Needs>())
     {
         user      = collider.gameObject;
         needs     = collider.gameObject.GetComponent <Needs>();
         occupied  = true;
         userQueue = null;
         //TODO buyfood animation, BuyDrink() on end
     }
 }
Esempio n. 27
0
    // Start is called before the first frame update
    void Start()
    {
        _prevousStates = new Stack <State>();
        personList.Add(this);
        ChangeState(State.Wandering);
        _talkingToOtherCD = Random.Range(0, 120);
        _worker           = GetComponent <Worker>();
        _needs            = GetComponent <Needs>();
        _factionCom       = GetComponent <FactionCom>();

        _fightingLine = new Stack <GameObject>();
    }
Esempio n. 28
0
    //GonstruKtor for Road
    public Building(string name, TileBase tileBase, Sprite sprite, int buildingCost)
    {
        this.name         = name;
        this.tileBase     = tileBase;
        this.sprite       = sprite;
        this.buildingCost = buildingCost;
        this.buildingType = BuildingType.Road;

        fulfilledNeed = Needs.None;

        borderLength = 1;
    }
 void Awake()
 {
     player             = GameObject.Find("Player");
     _sleepingAndWaking = player.GetComponent <SleepingAndWaking>();
     _needs             = player.GetComponent <Needs>();
     _FPSController     = player.GetComponent <FirstPersonController>();
     _dreamText         = GameObject.Find("Dream Canvas").GetComponent <DreamText>();
     _dayManager        = GetComponent <DayManager>();
     m_CamBackground    = Camera.main.gameObject.GetComponent <CamBackgroundColor>();
     r_sleepScript      = GameObject.Find("Player").GetComponent <SleepingAndWaking>();
     LoadScene(Scenes.Cell);
 }
Esempio n. 30
0
 public virtual bool satisfyNeed(Needs _Need)
 {
     for (int i = 0; i < satisfiesNeeds.Length; i++)
     {
         if (_Need == satisfiesNeeds[i].Need)
         {
             satisfiesNeeds[i].satisfyNeed(-1);
             return(true);
         }
     }
     return(false);
 }
Esempio n. 31
0
        public void LookupAllExplicit()
        {
            var x = new WS();
            var y = new DbW();
            var z = new DbR();
            var w = new UI();

            var needs = new Needs();
            needs.Set<IWebService>(x);
            needs.Set<IDatabaseCommand>(y);
            needs.Set<IDatabaseQuery>(z);
            needs.Set<IUserInterface>(w);

            Expect.Some(z, needs.Get<IDatabaseQuery>());
            Expect.Some(y, needs.Get<IDatabaseCommand>());
            Expect.Some(w, needs.Get<IUserInterface>());
            Expect.Some(x, needs.Get<IWebService>());
        }
Esempio n. 32
0
 public void DefaultImplOfLookup()
 {
     var needs = new Needs();
     var thing = needs.Get<ISomeInterface>().OrElseThrow(() => new Exception("No impl found"));
     Assert.IsInstanceOf<SomeImplementation>(thing);
 }
Esempio n. 33
0
 public float GetNeedValue(Needs need)
 {
     return _needs[need].GetValue();
 }
Esempio n. 34
0
 public void SetEntityNeed(Needs need, float value)
 {
     _needs[need].SetValue(value);
     if (_needs[_highestNeed].GetValue() < _needs[need].GetValue())
     {
         _highestNeed = need;
     }
     if (_needs[_lowestNeed].GetValue() > _needs[need].GetValue())
     {
         _lowestNeed = need;
     }
 }
Esempio n. 35
0
 public void MultipleDefaultImplsLookup()
 {
     var needs = new Needs();
     Expect.Error(() => needs.Get<IMyInterface>());
 }
Esempio n. 36
0
 public void NoImplAvailable()
 {
     var needs = new Needs();
     Expect.None(needs.Get<IOtherInterface>());
 }