예제 #1
0
 //CONSTRUCTORS
 public Minon(string nName, int nAoE, int nAoB)
 {
     this.Name            = nName;
     this.AmountOfEyes    = nAoE;
     this.AmountOfBananas = nAoB;
     this.Happiness       = SetHappiness(nAoB);
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     bar.fillAmount            = .52f;
     happinesssprites[0].color = disabled;
     happinesssprites[2].color = disabled;
     Happiness  = happiness.happy;
     startscale = happinesssprites[1].transform.localScale;
     bigscale   = happinesssprites[1].transform.localScale * 1.25f;
     happinesssprites[1].transform.localScale = bigscale;
 }
예제 #3
0
        public void EatBanana()
        {
            if (this.AmountOfBananas >= 1)
            {
                this.AmountOfBananas--;
            }
            else
            {
                this.AmountOfBananas = 0;
            }

            this.Happiness = SetHappiness(this.AmountOfBananas);
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        if (bar.fillAmount <= 0)
        {
            //Game Over
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            var += .1f;
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            var -= .1f;
        }

        if (bar.fillAmount != var)
        {
            float tempvar = Mathf.SmoothDamp(bar.fillAmount, var, ref vel, Time.deltaTime * 40);
            txt.text = (((int)(tempvar * 100)).ToString() + "%");
            int oldval = (int)(bar.fillAmount * 100);

            if ((int)(var * 100) < oldval)
            {
                if (oldval <= 30)
                {
                    if (Happiness != happiness.bored)
                    {
                        Happiness = happiness.bored;
                        switchHappiness(1, 0);
                    }
                }
                else if (oldval > 30 && oldval < 70)
                {
                    if (Happiness != happiness.neutral)
                    {
                        Happiness = happiness.neutral;
                        switchHappiness(2, 1);
                    }
                }
            }
            else
            {
                if (oldval >= 70)
                {
                    if (Happiness != happiness.happy)
                    {
                        Happiness = happiness.happy;
                        switchHappiness(1, 2);
                    }
                }
                else if (oldval > 30 && oldval < 70)
                {
                    if (Happiness != happiness.neutral)
                    {
                        Happiness = happiness.neutral;
                        switchHappiness(0, 1);
                    }
                }
            }
        }

        bar.color      = Color.Lerp(lowColor, fullColor, bar.fillAmount);
        bar.fillAmount = Mathf.SmoothDamp(bar.fillAmount, (float)var, ref vel, Time.deltaTime * 40);
    }
예제 #5
0
        public void EatAllBananas()
        {
            this.AmountOfBananas = 0;

            this.Happiness = SetHappiness(this.AmountOfBananas);
        }