public void AssignMember()
    {
        BoatDescriptor bd = (BoatDescriptor)_boat.Descriptor;

        if (_boat.CurrentZone == null || _boat.Crew.Count < bd.MaxCrew)
        {
            _gameInfo.Player.AssignMemberToBoat(_boat);
            _crewCountText.text = _boat.Crew.Count.ToString();
        }
    }
    public override void UpdateItem()
    {
        Boat boat = _item as Boat;

        if (boat != null)
        {
            BoatDescriptor boatDescriptor = boat.Descriptor as BoatDescriptor;
            _health.fillAmount        = boat.CurrentHealth / boatDescriptor.MaxHealth;
            _itemRepairPriceText.text = boatDescriptor.MaintenancePrice.ToString("0");
        }
    }
示例#3
0
    public override void UpdateDetails <T>(T itemDescriptor, float health)
    {
        base.UpdateDetails(itemDescriptor, health);
        BoatDescriptor boatDescriptor = itemDescriptor as BoatDescriptor;

        if (boatDescriptor != null)
        {
            if (health != 0)
            {
                _health.text = string.Format("Health: {0}/{1}", health, boatDescriptor.MaxHealth.ToString());
            }
            else
            {
                _health.text = string.Format("Health: {0}", boatDescriptor.MaxHealth.ToString());
            }
            _minCrew.text   = "Min. crew: " + boatDescriptor.MinCrew.ToString();
            _maxCrew.text   = "Max. crew: " + boatDescriptor.MaxCrew.ToString();
            _ecoImpact.text = "Eco. Impact: " + boatDescriptor.EcoImpactFactor.ToString();
        }
    }
    public void AddBoat(BoatDescriptor descriptor)
    {
        Boat boat = new Boat(descriptor);

        if (_boats.ContainsKey(descriptor.ItemName))
        {
            List <Boat> boats = _boats[descriptor.ItemName];
            boats.Add(boat);
        }
        else
        {
            List <Boat> boats = new List <Boat>();
            boats.Add(boat);
            _boats.Add(descriptor.ItemName, boats);
        }
        _availableBoats.Add(boat);
        _itemsManager.CreateBoatItem(boat);

        _addingBoat.Invoke(boat);
    }
    public bool CheckAvailable()
    {
        BoatDescriptor bd = (BoatDescriptor)Descriptor;

        return(_crew.Count >= bd.MinCrew && _crew.Count <= bd.MaxCrew && CurrentHealth > 0);
    }
 public Boat(BoatDescriptor descriptor)
 {
     Descriptor    = descriptor;
     CurrentHealth = descriptor.MaxHealth;
     CurrentZone   = null;
 }