void Start()
    {
        Zombie  z = new Zombie();
        Vampire v = new Vampire();

        z.hitPoints = 10;
        v.hitPoints = 10;
        Debug.Log(z.TakeDamage(5));
        Debug.Log(v.TakeDamage(5));

        //int number = (int)mState;
        //Debug.Log(number);
        Vector3 pos = new Vector3();

        pos.x = Random.Range(-10f, 10f);
        pos.z = Random.Range(-10f, 10f);
        transform.position = pos;
        GameObject[] AllGameObjects = GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[];
        foreach (GameObject aGameObject in AllGameObjects)
        {
            Component aComponent = aGameObject.GetComponent(typeof(Player));
            if (aComponent != null)
            {
                playerObject = aGameObject;
            }
        }
    }
Exemple #2
0
    void Start()
    {
        Zombie  Z = new Zombie();
        Vampire V = new Vampire();

        //Z.HitPoints = 10;
        //V.HitPoints = 10;    don't need these defined because they are initialized in the Monster constructor.
        Debug.Log(Z.TakeDamage(5));
        Debug.Log(V.TakeDamage(5));
        Debug.Log(Z.ToString());
        Debug.Log(V.ToString());
    }