Esempio n. 1
0
    public void SpawnCreature(GameObject CreaturePrefab)
    {
        Vector3 randPoint = Map.GetRandomPoint();
        float   x         = randPoint.x;
        float   y         = randPoint.y;

        if (x < -15)
        {
            x = Map.XLimits.x;
        }
        else if (x > 15)
        {
            x = Map.XLimits.y;
        }
        else if (y >= 0)
        {
            y = Map.YLimits.y;
        }
        else
        {
            y = Map.YLimits.x;
        }

        var creature = Instantiate(CreaturePrefab, new Vector3(x, y, 0), Quaternion.identity).GetComponent <Creature>();

        Map.AddCreature(creature);
    }