Exemplo n.º 1
0
    RabbitLogic CanGetFemale()
    {
        Dictionary <RabbitLogic, int> ladies = new Dictionary <RabbitLogic, int>();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Rabbit"))
        {
            RabbitLogic rl = go.GetComponent <RabbitLogic>();
            if (rl.sex == FEMALE && rl.ready_for_mate)
            {
                List <Vertex> d = rf.FindPath(mySquare, currentDestination, wg.GetPathfindingCosts());
                if (d != null)
                {
                    ladies[rl] = d.Count;
                }
            }
        }
        int         lowest     = -1;
        RabbitLogic lucky_lady = null;

        foreach (RabbitLogic rl in ladies.Keys)
        {
            if (lowest == -1 || ladies[rl] < lowest)
            {
                lucky_lady = rl;
                lowest     = ladies[rl];
            }
        }
        return(lucky_lady);
    }
Exemplo n.º 2
0
    public void BirthRabbit(RabbitLogic father, RabbitLogic mother)
    {
        rabbit.SetActive(false);
        GameObject r = (GameObject)Instantiate(rabbit, transform.position, transform.rotation);

        r.GetComponent <RabbitLogic>().mySquare   = mother.mySquare;
        r.GetComponent <RabbitLogic>().profession = "Guard";
        r.SetActive(true);
    }
Exemplo n.º 3
0
 void Mate(RabbitLogic male)
 {
     sexing         = true;
     sex_start      = Time.time;
     horny          = false;
     last_mating    = Time.time;
     ready_for_mate = false;
     father         = male;
     anim.SetBool("Mating", false);
 }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     eating               = GameObject.Find("Eat Sound Effect").GetComponent <AudioSource>();
     drinking             = GameObject.Find("Drink Sound Effect").GetComponent <AudioSource>();
     cam                  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     thirdPersonLogic     = gameObject.GetComponent <RabbitLogic>();
     thirdPersonLogicLion = gameObject.GetComponent <LionLogic>();
     //get character controller
     controller = GetComponent <CharacterController>();
     AddAnimals.worldRabbit++;
     //InvokeRepeating("decreaseHunger", 1.0f, 1.0f);
 }
Exemplo n.º 5
0
 bool AreThereMales()
 {
     foreach (GameObject go in GameObject.FindGameObjectsWithTag("Rabbit"))
     {
         RabbitLogic rl = go.GetComponent <RabbitLogic>();
         if (rl.sex == MALE)
         {
             return(true);
         }
     }
     return(false);
 }
    // Start is called before the first frame update. Each rabbit has the script so it runs for each one
    void Awake()
    {
        theLogic = gameObject.GetComponent <RabbitLogic>();


        controller = GetComponent <CharacterController>();

        //Set random initial rotation. Which way rabbit is facing
        heading = Random.Range(0, 360);
        //Changes the angle
        transform.eulerAngles = new Vector3(0, heading, 0);
        //Delays 1 sec
        StartCoroutine(NewHeading());
    }
    // Start is called before the first frame update
    void Start()
    {
        populationRabbit = rabbitPopulation.GetComponent <Text>();
        populationLion   = lionPopulation.GetComponent <Text>();
        hungerSlide      = hunger.GetComponent <Slider>();
        thirstSlide      = thirst.GetComponent <Slider>();
        timeText         = timeObject.GetComponent <Text>();
        attraction       = attractionObject.GetComponent <Slider>();

        //gets the third person camera and uses the hunger and thirst values based on which gameobject the camera is looking at
        freeLookCamera = thirdPersonCamera.GetComponent <CinemachineFreeLook>();

        rabbitHungerThirstValues = freeLookCamera.Follow.gameObject.GetComponent <RabbitLogic>();
    }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     if (reload)
     {
         game_over = false;
         reload    = false;
     }
     if (!game_over)
     {
         scroll        = Screen.height - 300;
         myPastRabbits = null;
         profession    = Guard;
         wl            = GameObject.FindGameObjectWithTag("world").GetComponent <WorldLogic>();
         currentRabbit = GameObject.FindGameObjectsWithTag("Rabbit")[0].GetComponent <RabbitLogic>();
     }
 }
Exemplo n.º 9
0
Arquivo: Enemy.cs Projeto: 9volt/ld29
 void FindTarget()
 {
     GameObject[] rabbits = GameObject.FindGameObjectsWithTag("Rabbit");
     float distance = 9999f;
     target = null;
     foreach(GameObject r in rabbits){
         RabbitLogic rl = r.GetComponent<RabbitLogic>();
         if(Vertex.Distance(pos, rl.mySquare) < distance
            && (wg.VertexToType(rl.mySquare) == WorldGen.AIR
                  || wg.VertexToType(rl.mySquare) == WorldGen.CARROT
                  || wg.VertexToType(new Vertex(rl.mySquare.x, rl.mySquare.y - 1)) == WorldGen.AIR)){
             target = rl;
             distance = Vertex.Distance(pos, rl.mySquare);
         }
     }
 }
Exemplo n.º 10
0
 void UpdateTarget()
 {
     if (target != null)
     {
         if (Time.time > last_action + speed)
         {
             foreach (GameObject go in GameObject.FindGameObjectsWithTag("Rabbit"))
             {
                 RabbitLogic r = go.GetComponent <RabbitLogic>();
                 if (target.Contains(r.mySquare))
                 {
                     r.Damage("ferret", str);
                 }
             }
             last_action = Time.time;
         }
     }
 }
Exemplo n.º 11
0
Arquivo: Enemy.cs Projeto: 9volt/ld29
    void FindTarget()
    {
        GameObject[] rabbits  = GameObject.FindGameObjectsWithTag("Rabbit");
        float        distance = 9999f;

        target = null;
        foreach (GameObject r in rabbits)
        {
            RabbitLogic rl = r.GetComponent <RabbitLogic>();
            if (Vertex.Distance(pos, rl.mySquare) < distance &&
                (wg.VertexToType(rl.mySquare) == WorldGen.AIR ||
                 wg.VertexToType(rl.mySquare) == WorldGen.CARROT ||
                 wg.VertexToType(new Vertex(rl.mySquare.x, rl.mySquare.y - 1)) == WorldGen.AIR))
            {
                target   = rl;
                distance = Vertex.Distance(pos, rl.mySquare);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (freeLookCamera.Follow.gameObject.CompareTag("lion") && freeLookCamera.Follow.gameObject != null)
        {
            lionHungerThirstValues = freeLookCamera.Follow.gameObject.GetComponent <LionLogic>();
            hungerSlide.value      = lionHungerThirstValues.hunger / 100;
            thirstSlide.value      = lionHungerThirstValues.thirst / 100;
            attraction.value       = lionHungerThirstValues.attraction / 100;
            Debug.Log(lionHungerThirstValues.hunger);
        }
        else if (freeLookCamera.Follow.gameObject.CompareTag("rabbit") && freeLookCamera.Follow.gameObject != null)
        {
            rabbitHungerThirstValues = freeLookCamera.Follow.gameObject.GetComponent <RabbitLogic>();
            hungerSlide.value        = rabbitHungerThirstValues.hunger / 100;
            thirstSlide.value        = rabbitHungerThirstValues.thirst / 100;
            attraction.value         = rabbitHungerThirstValues.attraction / 100;
        }

        time += Time.deltaTime;

        if (AddAnimals.worldRabbit >= 0)
        {
            populationRabbit.text = "Rabbits: " + AddAnimals.worldRabbit;
        }
        else
        {
            populationRabbit.text = "Rabbits: " + 0;
        }

        if (AddAnimals.worldLion >= 0)
        {
            populationLion.text = "Lions: " + AddAnimals.worldLion;
        }
        else
        {
            populationLion.text = "Lions: " + 0;
        }

        timeText.text = "" + Mathf.Round(time * 100) / 100;
    }
Exemplo n.º 13
0
Arquivo: Enemy.cs Projeto: 9volt/ld29
 void UpdateTarget()
 {
     if (hp <= 0 && currentDestination == pos)
     {
         gameObject.SetActive(false);
     }
     else if (hp <= 0)
     {
         for (int h = 0; h < wg.height; h++)
         {
             if (wg.VertexToType(new Vertex(wg.width - 1, h)) == WorldGen.DIRT)
             {
                 currentDestination = new Vertex(wg.width - 1, h);
                 h = wg.height;
             }
         }
     }
     else if (target != null)
     {
         if (pos == target.mySquare && Time.time > last_action + speed)
         {
             anim.SetTrigger("Pounce");
             last_action = Time.time;
             bool b = target.Damage(type, str);
             if (b)
             {
                 hp    -= str;
                 target = null;
             }
         }
         else
         {
             currentDestination = target.mySquare;
         }
     }
 }
Exemplo n.º 14
0
 void Mate(RabbitLogic male)
 {
     sexing = true;
     sex_start = Time.time;
     horny = false;
     last_mating = Time.time;
     ready_for_mate = false;
     father = male;
     anim.SetBool("Mating", false);
 }
Exemplo n.º 15
0
    void OnGUI()
    {
        if(PlayerPrefs.GetInt("Mute", 0) == 0){
             if(GUI.Button(new Rect(Screen.width - 42, 0, 42, 42), mute)){
                PlayerPrefs.SetInt("Mute", 1);
                PlayerPrefs.Save();
             }
        }else{
            if(GUI.Button(new Rect(Screen.width - 42, 0, 42, 42), unmute)){
                PlayerPrefs.SetInt("Mute", 0);
                PlayerPrefs.Save();
            }
        }
         if(!game_over){
            // Draw season and Burrow Stats
            GUI.Box(new Rect(0, 0, 400,42), "");
            GUI.DrawTexture(new Rect(5,5,32,32), season_art[wl.season]);
            GUI.DrawTexture(new Rect(70,0,32,32), bunny);
            GameObject[] g = GameObject.FindGameObjectsWithTag("Rabbit");

            if (g.Length <= 0){
                gameOver();
            }
            /*else if(wl.year == 4){
                won = true;
                gameOver();
            }*/

            GUI.Label(new Rect(100,10,100,32),"" + g.Length + " / " + wl.BurrowSleepCapacity() );
            GUI.DrawTexture(new Rect(150,0,32,32), houses);
            GUI.DrawTexture(new Rect(260,0,32,32), food);
            GUI.Label(new Rect(290,10,100,32),"" + wl.FoodCount() + " / " + wl.FoodCapacity() );
            GUI.DrawTexture(new Rect(340,2,32,32), foodcap);

            if(currentRabbit != null && currentRabbit.gameObject.activeSelf){

                //Targeted Rabbit InfoBox
                GUI.Box(new Rect(Screen.width - 220, Screen.height - 100, 220,100), currentRabbit.myname);
                if(currentRabbit.sex == RabbitLogic.FEMALE){
                    GUI.DrawTexture(new Rect(Screen.width - 28, Screen.height - 100, 30,30), female);
                }else{
                    GUI.DrawTexture(new Rect(Screen.width - 28, Screen.height - 100, 30,30), male);
                }

                //profession switching button
                if(GUI.Button(new Rect(Screen.width - 215, Screen.height - 93, 1.5f * profession.width, 1.5f * profession.height), profession)){
                    if(currentRabbit.profession == "Burrower"){
                        currentRabbit.profession = "Forager";
                    }else if(currentRabbit.profession == "Forager"){
                        currentRabbit.profession = "Guard";
                    }else{
                        currentRabbit.profession = "Burrower";
                    }
                }

                //stats
                GUI.Label(new Rect(Screen.width - 220 + 1.8f * profession.width, Screen.height - 80, 180,30),"I'm " + currentRabbit.WhatAmIDoing());
                GUI.Label(new Rect(Screen.width - 220 + 1.8f * profession.width, Screen.height - 60, 120,20), "Str:" + currentRabbit.str + "     Spd:" + currentRabbit.spd);
                //hunger and hp bars
                GUI.Label(new Rect(Screen.width - 195,Screen.height - 35, 100,20), "Hunger:");
                GUI.Label(new Rect(Screen.width - 195,Screen.height - 20, 100,20), "HP:");
                GUI.DrawTexture(new Rect(Screen.width - 145,Screen.height - 30, 100,10), emptytexture);
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 30, (float)(currentRabbit.hunger/(float)currentRabbit.full) * 100,10), hungertexture);
                GUI.DrawTexture(new Rect(Screen.width - 145,Screen.height - 15, 100,10), emptytexture);
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 15, (float)(currentRabbit.hp/(float)currentRabbit.maxhp) * 100,10), hptexture);

                //To indicate your rabbit
                currentRabbit.gameObject.GetComponent<SpriteRenderer>().color = Color.gray;
            }
        }else{

            //play again button
            if(GUI.Button(new Rect(Screen.width - 215, Screen.height - 160, 150, 150), "Play Again?")){
                reload = true;
                Application.LoadLevel("opening");//change to start scene
            }

            //credits
            int i;

            GUI.Label(new Rect(Screen.width/2 - 160, scroll + 50, 500, 40), "Your warren survived " + (((wl.year - 1) * 4) + (wl.season)) + " seasons and had a total of " + (myPastRabbits.Length -1) + " rabbits.");

            GUI.Label(new Rect(Screen.width/2 - 120, scroll +  120, 300, 40 ), "Gone, but not forgotten:");
            for(i = 0; i < myPastRabbits.Length-1; i++){ // -1 becuase the bunnyhop prefab is also caught by FindObjectsOfTypeAll
                currentRabbit = myPastRabbits[i];
                //if(!(currentRabbit.hp > 0)){

                //}else{
                //	currentRabbit.gameObject.SetActive(false);
                //	GUI.Label(new Rect(Screen.width/2 - 120, scroll + ((i+1)* 130), 300,40), "The Great Survivor");
                //}
                GUI.Label(new Rect(Screen.width/2 - 120, scroll + 20 + ((i+1)* 130), 300,40), currentRabbit.myname);
                GUI.DrawTexture(new Rect(Screen.width/2 - 120,  scroll + 40 + ((i+1)* 130), bunny.width, bunny.height), bunny);
                GUI.Label(new Rect(Screen.width/2 - 120 + bunny.width + 10,  scroll + 40 + ((i+1)* 130), 300, 40), currentRabbit.cause_of_death);

            }

            GUI.Label(new Rect(Screen.width/2 - 120, scroll + 40 + ((i+1)* 130), 500, 40), "Game created by Joseph and Sonya Utecht.");
            GUI.Label(new Rect(Screen.width/2 - 120, scroll + 60 + ((i+1)* 130), 300, 40), "Music by Jeff Craft.");
            GUI.Label(new Rect(Screen.width/2 - 120, scroll + 100 + ((i+1)* 130), 300, 40), "Thank you for playing!");

            scroll= scroll -.5f;

        }
    }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     if(reload){
         game_over = false;
         reload = false;
     }
     if(!game_over){
         scroll = Screen.height - 300;
         myPastRabbits = null;
         profession = Guard;
         wl = GameObject.FindGameObjectWithTag("world").GetComponent<WorldLogic>();
         currentRabbit = GameObject.FindGameObjectsWithTag("Rabbit")[0].GetComponent<RabbitLogic>();
     }
 }
Exemplo n.º 17
0
 public void BirthRabbit(RabbitLogic father, RabbitLogic mother)
 {
     rabbit.SetActive(false);
     GameObject r = (GameObject)Instantiate(rabbit, transform.position, transform.rotation);
     r.GetComponent<RabbitLogic>().mySquare = mother.mySquare;
     r.GetComponent<RabbitLogic>().profession = "Guard";
     r.SetActive(true);
 }
Exemplo n.º 18
0
Arquivo: Enemy.cs Projeto: 9volt/ld29
 void UpdateTarget()
 {
     if(hp <= 0 && currentDestination == pos){
         gameObject.SetActive(false);
     } else if(hp <= 0){
         for(int h = 0; h < wg.height; h++){
             if(wg.VertexToType(new Vertex(wg.width - 1, h)) == WorldGen.DIRT){
                 currentDestination = new Vertex(wg.width - 1, h);
                 h = wg.height;
             }
         }
     } else if(target != null){
         if(pos == target.mySquare && Time.time > last_action + speed){
             anim.SetTrigger("Pounce");
             last_action = Time.time;
             bool b = target.Damage(type, str);
             if(b){
                 hp -= str;
                 target = null;
             }
         } else {
             currentDestination = target.mySquare;
         }
     }
 }
Exemplo n.º 19
0
 public static void Main(string[] args)
 {
     RabbitLogic.GetInstance();
     CreateHostBuilder(args).Build().Run();
 }
Exemplo n.º 20
0
 void PickDestination()
 {
     if (need_sleep && CanGetSleep())
     {
         ready_for_mate = false;
         // Find closest burrow with sleeping room
         Burrow b = wl.GetClosestBurrowSleep(mySquare);
         if (b != null)
         {
             currentDestination = b.main_block;
             if (mySquare == currentDestination && Time.time > last_action + speed)
             {
                 anim.SetBool("Sleep", true);
                 if (wl.StartSleep(mySquare))
                 {
                     current_action = "sleeping";
                     sleeping       = true;
                     last_sleep     = Time.time;
                 }
             }
             else
             {
                 current_action = "finding sleep";
             }
         }
     }
     else if (need_food && CanGetFood())
     {
         ready_for_mate = false;
         // Find closest burrow with food
         Burrow b = wl.GetClosestBurrowFood(mySquare);
         if (b != null)
         {
             currentDestination = b.GetRandomBlock(rrand);
             if (mySquare == currentDestination && Time.time > last_action + speed)
             {
                 anim.SetTrigger("Dig");
                 if (wl.EatFood(mySquare))
                 {
                     current_action = "eating";
                     hunger         = full;
                     need_food      = false;
                 }
             }
             else
             {
                 current_action = "finding food";
             }
         }
     }
     else if (ready_for_mate && AreThereMales())
     {
         // animation???
         anim.SetBool("Mating", true);
         current_action = "waiting for mate";
     }
     else if (horny && sex == FEMALE && CanGetSleep() && AreThereMales())
     {
         Burrow b = wl.GetClosestBurrowSleep(mySquare);
         if (b != null)
         {
             currentDestination = b.main_block;
             if (mySquare == currentDestination && Time.time > last_action + speed)
             {
                 ready_for_mate = true;
             }
             else
             {
                 current_action = "finding mating burrow";
             }
         }
     }
     else if (horny && sex == MALE && CanGetFemale() != null)
     {
         RabbitLogic female = CanGetFemale();
         if (female.mySquare == mySquare)
         {
             anim.SetBool("Hump", true);
             current_action = "mating";
             sexing         = true;
             sex_start      = Time.time;
             female.Mate(this);
             last_mating = Time.time;
         }
         else
         {
             currentDestination = female.mySquare;
             current_action     = "moving to female";
         }
         //else pick new Destination or work
     }
     else
     {
         if (profession == "Burrower")
         {
             // First try to find a square to dig
             currentDestination = wl.GetClosestDig(mySquare);
             if (currentDestination == null)
             {
                 // If that fails find a square to fill in
                 currentDestination = wl.GetClosestFill(mySquare);
                 if (currentDestination != null)
                 {
                     current_action = "moving to fill";
                     filling        = true;
                 }
                 else
                 {
                     current_action = "idle";
                 }
             }
             else
             {
                 current_action = "moving to dig";
                 digging        = true;
             }
             if (mySquare == currentDestination && Time.time > last_action + speed)
             {
                 anim.SetTrigger("Dig");
                 if (digging)
                 {
                     current_action = "digging";
                     wl.Dig(mySquare, str);
                     digging = false;
                 }
                 else if (filling)
                 {
                     current_action = "filling";
                     wl.Fill(mySquare, str);
                     filling = false;
                 }
             }
         }
         else if (profession == "Forager")
         {
             if (food_hold == 0)
             {
                 currentDestination = wl.GetClosestFood(mySquare);
                 if (mySquare == currentDestination && Time.time > last_action + speed)
                 {
                     anim.SetTrigger("Dig");
                     food_hold = wl.TakeFood(mySquare, str);
                 }
                 else if (currentDestination != null)
                 {
                     current_action = "moving to forage";
                 }
                 else
                 {
                     current_action = "idle";
                 }
             }
             else
             {
                 //return to closest burrow with space
                 Burrow b = wl.GetClosestBurrowDepositFood(mySquare);
                 if (b != null)
                 {
                     current_action     = "returning with food";
                     currentDestination = b.main_block;
                     if (mySquare == currentDestination && Time.time > last_action + speed)
                     {
                         anim.SetTrigger("Dig");
                         food_hold = wl.DepositFood(mySquare, food_hold);
                     }
                 }
                 else
                 {
                     current_action = "looking for burrow to store food";
                 }
             }
         }
         else if (profession == "Guard")
         {
             Burrow b = wl.GetClosestBurrowSleep(mySquare);
             if (b != null)
             {
                 currentDestination = b.GetRandomBlock(rrand);
                 if (mySquare == currentDestination)
                 {
                     current_action = "cowering";
                 }
                 else
                 {
                     current_action = "finding cover";
                 }
             }
         }
     }
 }
Exemplo n.º 21
0
    void OnGUI()
    {
        if (PlayerPrefs.GetInt("Mute", 0) == 0)
        {
            if (GUI.Button(new Rect(Screen.width - 42, 0, 42, 42), mute))
            {
                PlayerPrefs.SetInt("Mute", 1);
                PlayerPrefs.Save();
            }
        }
        else
        {
            if (GUI.Button(new Rect(Screen.width - 42, 0, 42, 42), unmute))
            {
                PlayerPrefs.SetInt("Mute", 0);
                PlayerPrefs.Save();
            }
        }
        if (!game_over)
        {
            // Draw season and Burrow Stats
            GUI.Box(new Rect(0, 0, 400, 42), "");
            GUI.DrawTexture(new Rect(5, 5, 32, 32), season_art[wl.season]);
            GUI.DrawTexture(new Rect(70, 0, 32, 32), bunny);
            GameObject[] g = GameObject.FindGameObjectsWithTag("Rabbit");

            if (g.Length <= 0)
            {
                gameOver();
            }

            /*else if(wl.year == 4){
             *      won = true;
             *      gameOver();
             * }*/

            GUI.Label(new Rect(100, 10, 100, 32), "" + g.Length + " / " + wl.BurrowSleepCapacity());
            GUI.DrawTexture(new Rect(150, 0, 32, 32), houses);
            GUI.DrawTexture(new Rect(260, 0, 32, 32), food);
            GUI.Label(new Rect(290, 10, 100, 32), "" + wl.FoodCount() + " / " + wl.FoodCapacity());
            GUI.DrawTexture(new Rect(340, 2, 32, 32), foodcap);

            if (currentRabbit != null && currentRabbit.gameObject.activeSelf)
            {
                //Targeted Rabbit InfoBox
                GUI.Box(new Rect(Screen.width - 220, Screen.height - 100, 220, 100), currentRabbit.myname);
                if (currentRabbit.sex == RabbitLogic.FEMALE)
                {
                    GUI.DrawTexture(new Rect(Screen.width - 28, Screen.height - 100, 30, 30), female);
                }
                else
                {
                    GUI.DrawTexture(new Rect(Screen.width - 28, Screen.height - 100, 30, 30), male);
                }

                //profession switching button
                if (GUI.Button(new Rect(Screen.width - 215, Screen.height - 93, 1.5f * profession.width, 1.5f * profession.height), profession))
                {
                    if (currentRabbit.profession == "Burrower")
                    {
                        currentRabbit.profession = "Forager";
                    }
                    else if (currentRabbit.profession == "Forager")
                    {
                        currentRabbit.profession = "Guard";
                    }
                    else
                    {
                        currentRabbit.profession = "Burrower";
                    }
                }

                //stats
                GUI.Label(new Rect(Screen.width - 220 + 1.8f * profession.width, Screen.height - 80, 180, 30), "I'm " + currentRabbit.WhatAmIDoing());
                GUI.Label(new Rect(Screen.width - 220 + 1.8f * profession.width, Screen.height - 60, 120, 20), "Str:" + currentRabbit.str + "     Spd:" + currentRabbit.spd);
                //hunger and hp bars
                GUI.Label(new Rect(Screen.width - 195, Screen.height - 35, 100, 20), "Hunger:");
                GUI.Label(new Rect(Screen.width - 195, Screen.height - 20, 100, 20), "HP:");
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 30, 100, 10), emptytexture);
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 30, (float)(currentRabbit.hunger / (float)currentRabbit.full) * 100, 10), hungertexture);
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 15, 100, 10), emptytexture);
                GUI.DrawTexture(new Rect(Screen.width - 145, Screen.height - 15, (float)(currentRabbit.hp / (float)currentRabbit.maxhp) * 100, 10), hptexture);


                //To indicate your rabbit
                currentRabbit.gameObject.GetComponent <SpriteRenderer>().color = Color.gray;
            }
        }
        else
        {
            //play again button
            if (GUI.Button(new Rect(Screen.width - 215, Screen.height - 160, 150, 150), "Play Again?"))
            {
                reload = true;
                Application.LoadLevel("opening");                //change to start scene
            }

            //credits
            int i;

            GUI.Label(new Rect(Screen.width / 2 - 160, scroll + 50, 500, 40), "Your warren survived " + (((wl.year - 1) * 4) + (wl.season)) + " seasons and had a total of " + (myPastRabbits.Length - 1) + " rabbits.");


            GUI.Label(new Rect(Screen.width / 2 - 120, scroll + 120, 300, 40), "Gone, but not forgotten:");
            for (i = 0; i < myPastRabbits.Length - 1; i++)           // -1 becuase the bunnyhop prefab is also caught by FindObjectsOfTypeAll
            {
                currentRabbit = myPastRabbits[i];
                //if(!(currentRabbit.hp > 0)){

                //}else{
                //	currentRabbit.gameObject.SetActive(false);
                //	GUI.Label(new Rect(Screen.width/2 - 120, scroll + ((i+1)* 130), 300,40), "The Great Survivor");
                //}
                GUI.Label(new Rect(Screen.width / 2 - 120, scroll + 20 + ((i + 1) * 130), 300, 40), currentRabbit.myname);
                GUI.DrawTexture(new Rect(Screen.width / 2 - 120, scroll + 40 + ((i + 1) * 130), bunny.width, bunny.height), bunny);
                GUI.Label(new Rect(Screen.width / 2 - 120 + bunny.width + 10, scroll + 40 + ((i + 1) * 130), 300, 40), currentRabbit.cause_of_death);
            }

            GUI.Label(new Rect(Screen.width / 2 - 120, scroll + 40 + ((i + 1) * 130), 500, 40), "Game created by Joseph and Sonya Utecht.");
            GUI.Label(new Rect(Screen.width / 2 - 120, scroll + 60 + ((i + 1) * 130), 300, 40), "Music by Jeff Craft.");
            GUI.Label(new Rect(Screen.width / 2 - 120, scroll + 100 + ((i + 1) * 130), 300, 40), "Thank you for playing!");

            scroll = scroll - .5f;
        }
    }