コード例 #1
0
ファイル: Fatigue.cs プロジェクト: teamonefive/Dygg
 void Start()
 {
     tileBasedMover         = tileBasedMover.GetComponent <TileBasedMover>();
     image                  = GetComponent <Image>();
     transitionAnim.enabled = true;
     transitionAnim.SetBool("TransitionFatigue", false);
 }
コード例 #2
0
 public void UseItem()
 {
     if (!IsEmpty)
     {
         if (VendorWindow.MyInstance == null)
         {
             if (MyItem.MyTitle == "Box of Rations")
             {
                 Stats stat = Object.FindObjectOfType <Stats>();
                 stat.vFatigue += 100f;
                 if (stat.vFatigue > stat.maxFatigue)
                 {
                     stat.vFatigue = stat.maxFatigue;
                 }
                 RemoveItem();
             }
             else if (MyItem.MyTitle == "Rune of Teleportation")
             {
                 TileBasedMover moveScript = Object.FindObjectOfType <TileBasedMover>();
                 moveScript.teleportToSpawn();
                 RemoveItem();
             }
         }
         else if (VendorWindow.MyInstance.vwindow.activeSelf)
         {
             int sellPrice = (int)(MyItem.MyPrice * 0.8f);
             if (MyItem.myMaxDurability > 0)
             {
                 sellPrice *= (MyItem.myDurability / MyItem.myMaxDurability);
             }
             if (sellPrice < 0)
             {
                 sellPrice = 0;
             }
             gold.addGold((int)(MyItem.MyPrice * 0.8f));
             RemoveItem();
             Object.FindObjectOfType <Stats>().itemsSold++;
         }
         else
         {
             if (MyItem.MyTitle == "Box of Rations")
             {
                 Stats stat = Object.FindObjectOfType <Stats>();
                 stat.vFatigue += 100f;
                 if (stat.vFatigue > stat.maxFatigue)
                 {
                     stat.vFatigue = stat.maxFatigue;
                 }
                 RemoveItem();
             }
             else if (MyItem.MyTitle == "Rune of Teleportation")
             {
                 TileBasedMover moveScript = Object.FindObjectOfType <TileBasedMover>();
                 moveScript.teleportToSpawn();
                 RemoveItem();
             }
         }
     }
 }