public void MakePatron()
    {
        List <Vector2> destination = pathFinder.GetPathFromSpawnToSeat();

        //If we can get a path to the destination
        if (destination != null)
        {
            //Patron.Race randRace = (Patron.Race)Random.Range(0, 4);
            //Patron.Class randClass = (Patron.Class)Random.Range(0, 4);

            Patron.Race  randRace  = (Patron.Race)Random.Range(0, heads.Length);
            Patron.Class randClass = (Patron.Class)Random.Range(0, bodies.Length);

            Sprite head = heads[(int)randClass];
            Sprite body = bodies[(int)randRace];

            Sprite[] character = { head, body };

            GameObject patron = new GameObject();
            patron.tag = "Patron";
            patron.AddComponent <Patron>();
            patron.transform.parent = grid.transform;

            patrons.Add(patron.GetComponent <Patron>());

            patron.GetComponent <Patron>().SetUpPatron(randClass, randRace, 0.1f, 1f, character, destination, cloak);
        }
    }
Exemple #2
0
    public void SetUpPatron(Class patronClass, Race patronRace, float moveInterval, float actionInterval
                            , IEnumerable <Sprite> character, IEnumerable <Vector2> path, Sprite cloak)
    {
        SetUpSprites(patronClass, patronRace, character, cloak);
        ChangeOutfit();

        //Change z depth
        Vector3 position = transform.position;

        position.z         = -1;
        transform.position = position;

        this.path       = path.ToArray();
        pathIndex       = 0;
        waitingForSpace = Random.Range(1f, maxWaitTime);
        pathFinder      = Camera.main.GetComponent <PathFinder>();

        coins = Random.Range(5, 15);
        RandomThirst();

        grid = GetComponentInParent <TableGrid>();

        tempClass = patronClass;
    }