Beispiel #1
0
    // if not infected werewolf swapping back and forth,
    // don't need to do anything...
    private void changeBackIntoHuman()
    {
        if (!infectedHumanWerewolf)
        {
            return;
        }

        // subtract from time remaining and get out if not there yet...
        turnBackIntoHuman -= Time.deltaTime;
        if (turnBackIntoHuman > 0f)
        {
            return;
        }

        // Time Hit...  Now, create a human and keep it marked as infected
        // so any other werewolf won't attack it... like they can smell
        // already infected werewolf humans and leave them alone.
        humanAI hAI = globalEvents.characterCreator.createHuman(gameObject.transform.position, Quaternion.Euler(0, 0, 0));

        if (hAI != null)
        {
            hAI.transform.rotation = gameObject.transform.rotation;
            hAI.IsInfected         = true;
        }

        // set flag and self-destroy after the werewolf is created...
        isDestroying = true;
        // Destroy the game object of the human now that werewolf is created above
        Destroy(this.gameObject);
        return;
    }
Beispiel #2
0
    public humanAI createHuman(Vector3 position)
    {
        GameObject gobj = (GameObject)Instantiate(Human, position, q);
        humanAI    hAI  = gobj.GetComponentInChildren <humanAI>();

        return(hAI);
    }
Beispiel #3
0
    public humanAI createHuman(Vector3 referencePoint, Quaternion rotation)
    {
        GameObject gobj = (GameObject)Instantiate(Human, referencePoint, rotation);
        humanAI    hAI  = gobj.GetComponentInChildren <humanAI>();

        return(hAI);
    }
Beispiel #4
0
	void breakOpen() 
	{
		float x, z;

		// PRESERVE the bounds of the house as the rendering appears to be
		// delayed after Destroy of the house, and the random placement gets hosed...
		Bounds houseBounds = spawnArea.GetComponent<Renderer>().bounds;

		// how many zombies should we create of the total human count...
		// take the integer count... PERCENTS, so divide by 100.
		int makeZombies = (int)(humanCount * BreakOutPctZombies / 100.0f );
		
		for (int i = 0; i < humanCount; i++) 
		{
			x = Random.Range(houseBounds.min.x, houseBounds.max.x);
			z = Random.Range(houseBounds.min.z, houseBounds.max.z);
			//Camera.main.SendMessage("createHuman", transform.position);
			if( i < makeZombies )
			{
				globalEvents.characterCreator.createZombie( new Vector3(x, 1, z), Quaternion.Euler(0,0,0));
			}
			else
			{
				humanAI hAI = globalEvents.characterCreator.createHuman( new Vector3(x, 1, z), Quaternion.Euler(0,0,0));
				if( hAI != null )
					hAI.Afraid();
			}
			
		}
		for (int i = 0; i < guardCount; i++) 
		{
			x = Random.Range(houseBounds.min.x, houseBounds.max.x);
			z = Random.Range(houseBounds.min.z, houseBounds.max.z);
			//Camera.main.SendMessage("createHuman", transform.position);
			globalEvents.characterCreator.createGuard( new Vector3(x, 1, z), Quaternion.Euler(0,0,0));
		}
		guardCount = 0;
		humanCount = 0;
	}