Esempio n. 1
0
    public override Action[] GetLevelActions(int currentTime, Character currentPlayer)
    {
        Location      currentLocation = currentPlayer.GetCurrentLocation();
        List <Action> actions         = new List <Action>();

        for (int i = 0, count = currentLocation.items.Count; i < count; i++)
        {
            Car car = currentLocation.items[i] as Car;

            if (car != null)
            {
                int    wheelCount  = 0;
                Item[] itemsInside = car.GetItems();
                for (int j = 0, length = itemsInside.Length; j < length; j++)
                {
                    if (itemsInside[j] != null)
                    {
                        wheelCount++;
                    }
                }

                if (wheelCount >= itemsInside.Length)
                {
                    Location targetLocation = null;

                    if (currentLocation == parkingLot)
                    {
                        targetLocation = crossRoad;
                    }
                    else if (currentLocation == crossRoad)
                    {
                        targetLocation = parkingLot;
                    }

                    if (targetLocation != null)
                    {
                        ActionDrive actionDrive = new ActionDrive(currentTime, 4, "Drive to the " + targetLocation.name, road, targetLocation, car);
                        actions.Add(actionDrive);
                    }
                }
            }
        }

        return(actions.ToArray());
    }
Esempio n. 2
0
    public override Action[] GetLevelActions(int currentTime, Character player)
    {
        Location currentLocation = player.GetCurrentLocation();

        if (currentLocation == shop)
        {
            ActionDrive actionDrive = new ActionDrive(currentTime, 10, "Drive to the " + bakery.name, road, garden);
            return(new Action[1] {
                actionDrive
            });
        }
        else if (currentLocation == garden)
        {
            ActionDrive actionDrive = new ActionDrive(currentTime, 10, "Drive to the " + shop.name, road, shop);
            return(new Action[1] {
                actionDrive
            });
        }

        return(new Action[0]);
    }