コード例 #1
0
 public void AddPart(PartWheel _part)
 {
     installedPart = _part;
     if (_part != null)
     {
         titleText.text = _part.PartName;
         icon.sprite    = _part.Icon;
         icon.color     = new Color(1, 1, 1, 1);
     }
 }
コード例 #2
0
    public void OnWheelItemClick()
    {
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            shopMain.PurchasePart(this);
        }
        shopMain.ClearPartAttributes();
        shopMain.SelectPart(this);
        PartWheel _wheel = (PartWheel)partItem;

        shopMain.AddPartAttribute("Wheel Type:", _wheel.PartName);
        shopMain.AddPartAttribute("Traction:", _wheel.Traction.ToString());
        shopMain.AddPartAttribute("Fuel Efficiency:", _wheel.FuelEfficiency.ToString());
        shopMain.AddPartAttribute("Weight:", _wheel.Weight.ToString());
    }
コード例 #3
0
    public void GetRandomPart(TierProbability _tierChances, out PartWheel _part)
    {
        int _tierProb = _tierChances.GetRandomTier();

        switch (_tierProb)
        {
        case 1:
            _part = partsWheelList[0];
            return;

        case 2:
            _part = partsWheelList[0];
            return;

        case 3:
            _part = partsWheelList[0];
            return;
        }
        _part = null;
    }
コード例 #4
0
 public void GetPart(out PartWheel _part)
 {
     _part = wheels;
 }
コード例 #5
0
 public void InstallPart(PartWheel _part)
 {
     wheels = _part;
     RecalculateStats();
 }
コード例 #6
0
    public void SetUp()
    {
        switch (partType)
        {
        case PartType.Drill:
            if (installedPart != null && installedPart is PartDrill)
            {
                PartDrill drill = (PartDrill)installedPart;
                titleText.text = drill.PartName;
                icon.sprite    = drill.Icon;
                icon.color     = new Color(1, 1, 1, 1);
            }
            else
            {
                titleText.text = "Drill";
                icon.sprite    = null;
                icon.color     = new Color(1, 1, 1, 0);
            }
            break;

        case PartType.Cabin:
            if (installedPart != null && installedPart is PartCabin)
            {
                PartCabin cabin = (PartCabin)installedPart;
                titleText.text = cabin.PartName;
                icon.sprite    = cabin.Icon;
                icon.color     = new Color(1, 1, 1, 1);
            }
            else
            {
                titleText.text = "Cabin";
                icon.sprite    = null;
                icon.color     = new Color(1, 1, 1, 0);
            }
            break;

        case PartType.Engine:
            if (installedPart != null && installedPart is PartEngine)
            {
                PartEngine engine = (PartEngine)installedPart;
                titleText.text = engine.PartName;
                icon.sprite    = engine.Icon;
                icon.color     = new Color(1, 1, 1, 1);
            }
            else
            {
                titleText.text = "Engine";
                icon.sprite    = null;
                icon.color     = new Color(1, 1, 1, 0);
            }
            break;

        case PartType.Wheels:
            if (installedPart != null && installedPart is PartWheel)
            {
                PartWheel wheel = (PartWheel)installedPart;
                titleText.text = wheel.PartName;
                icon.sprite    = wheel.Icon;
                icon.color     = new Color(1, 1, 1, 1);
            }
            else
            {
                titleText.text = "Wheels";
                icon.sprite    = null;
                icon.color     = new Color(1, 1, 1, 0);
            }
            break;

        case PartType.Upgrade:
            if (installedPart != null && installedPart is PartUpgrade)
            {
                PartUpgrade upgrade = (PartUpgrade)installedPart;
                titleText.text = upgrade.PartName;
                icon.sprite    = upgrade.Icon;
                icon.color     = new Color(1, 1, 1, 1);
            }
            else
            {
                titleText.text = "Equipment";
                icon.sprite    = null;
                icon.color     = new Color(1, 1, 1, 0);
            }
            break;
        }
    }