// Use this for initialization
 void Start()
 {
     ZS = GameObject.FindGameObjectWithTag("ZomSaver").GetComponent<ZomSaver>();
     loadedZoms = ZS.savedZombies;
     generatedZoms = new ArrayList();
     generatedPickups = new ArrayList();
     spawned = 0;
     pickups = ZS.collectedWater.Count;
 }
 // Use this for initialization
 void Start()
 {
     ZS               = GameObject.FindGameObjectWithTag("ZomSaver").GetComponent <ZomSaver>();
     loadedZoms       = ZS.savedZombies;
     generatedZoms    = new ArrayList();
     generatedPickups = new ArrayList();
     spawned          = 0;
     pickups          = ZS.collectedWater.Count;
 }
    void OnMouseUp()
    {
        canMove = false;
        myRigidbody.useGravity     = gravitySetting;
        myRigidbody.freezeRotation = freezeRotationSetting;
        if (!myRigidbody.useGravity)
        {
            Vector3 pos = myTransform.position;
            pos.y = yPos - addHeightWhenClicked;
            myTransform.position = pos;
        }

        if (Vector3.Distance(myTransform.position, housePosition) > maxOriginDist)
        {
            biteScript.fuelLeft  = biteScript.maxFuel;
            myTransform.position = parentPosition;
            trail.time           = 0;
            Invoke("ResetTrail", 1);
            return;
        }

        else
        {
            GameObject[] zoms        = GameObject.FindGameObjectsWithTag("Zombie");
            GameObject   ZSave       = GameObject.FindGameObjectWithTag("ZomSaver");
            ZomSaver     scriptZSave = (ZomSaver)ZSave.GetComponent <ZomSaver>();

            if (scriptZSave.savedZombies.Count > 0)
            {
                GameObject ZSpawn       = GameObject.FindGameObjectWithTag("ZomSpawner");
                Spawner    scriptZSpawn = (Spawner)ZSpawn.GetComponent <Spawner>();
                scriptZSave.remainingSpawns = 20 - scriptZSpawn.spawned;
                Debug.Log("Remaining spawns: " + scriptZSave.remainingSpawns);
                foreach (GameObject z in zoms)
                {
                    if (z.renderer.enabled)
                    {
                        scriptZSave.missedZombies.Add(z);
                    }
                }
                Application.LoadLevel("SizeScroll");
            }
        }
    }
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Zombie")
     {
         ZomSaver zoms = GameObject.FindGameObjectWithTag("ZomSaver").GetComponent <ZomSaver>();
         zoms.savedZombies.Add(col.gameObject);
         col.gameObject.renderer.enabled = false;
     }
     else if (col.gameObject.tag == "WaterPickup")
     {
         ZomSaver zoms = GameObject.FindGameObjectWithTag("ZomSaver").GetComponent <ZomSaver>();
         zoms.collectedWater.Add(col.gameObject);
         zoms.water_index = zoms.savedZombies.Count;
         col.gameObject.renderer.enabled = false;
         Debug.Log("Picked Up The Water At " + zoms.water_index);
     }
     else if (col.gameObject.tag == "FuelPickup")
     {
         fuelLeft += (maxFuel / 5);
         col.gameObject.renderer.enabled = false;
         Debug.Log("Picked Up The Fuel!");
     }
 }
    // Use this for initialization
    void Start()
    {
        if (!GameObject.FindGameObjectWithTag("ZomSaver"))
        {
            Instantiate(zomSaverObj);
        }
        ZomSaver ZS = GameObject.FindGameObjectWithTag("ZomSaver").GetComponent <ZomSaver>();

        NUM_TO_SPAWN = ZS.remainingSpawns;
        ArrayList MZ = ZS.missedZombies;

        foreach (GameObject zom in MZ)
        {
            GameObject newZ = (GameObject)Instantiate(zombieObj);
            if (zom == null)
            {
                float x = Random.Range(LEFT_BOUND, RIGHT_BOUND);
                float z;
                //trying to get zombies to spawn closer to the house from the sides
                //so that they dont all just group at the top
                if (x > 100f || x < -100f)
                {
                    z = 0;
                }
                else
                {
                    z = Random.Range(TOP_BOUND - BOUND_RANGE, TOP_BOUND);
                }
                newZ.transform.position = new Vector3(x, 1f, z);
            }
            else
            {
                newZ.transform.position = zom.transform.position;
            }
        }
        ZS.missedZombies.Clear();
    }