Exemple #1
0
    public werewolfAi createWerewolf(Vector3 position, Quaternion rot)
    {
        GameObject gobj = (GameObject)Instantiate(Werewolf, position, rot);
        werewolfAi wAI  = gobj.GetComponentInChildren <werewolfAi>();

        return(wAI);
    }
Exemple #2
0
    private bool IsInfectedHuman()
    {
        if (!IsInfected)
        {
            return(false);
        }

        // set our own timer
        if (!infectionDelaySet)
        {
            infectionDelay    = 5.0f;
            infectionDelaySet = true;
            return(false);
        }

        // subtract time... if not there yet, just get out
        // turn off flag so not recursive every cycle
        infectionDelay -= Time.deltaTime;
        if (infectionDelay > 0)
        {
            return(false);
        }

        // clear infection flag for false cycle until human actually destroyed...
        IsInfected = false;

        // Yup, infection time was reached, create a new werewolf and kill self.
        werewolfAi wAI = globalEvents.characterCreator.createWerewolf(gameObject.transform.position, gameObject.transform.rotation);

        if (wAI != null)
        {
            wAI.InfectedHumanWerewolf = 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(true);
    }