Пример #1
0
//	public void Unequip(int slotID){
//		if (slotID == 1) {
//			this.gameObject.GetComponent<InventoryManager> ().AddToInv(item1.GetComponent<ItemScript>().itemID);
//			Debug.Log ("Unequipped" + item1.GetComponent<ItemScript> ().itemID);
//		}else if (slotID == 2) {
//			this.gameObject.GetComponent<InventoryManager> ().AddToInv(item2.GetComponent<ItemScript>().itemID);
//		}else if (slotID == 3) {
//			this.gameObject.GetComponent<InventoryManager> ().AddToInv(item3.GetComponent<ItemScript>().itemID);
//		}else if (slotID == 4) {
//			this.gameObject.GetComponent<InventoryManager> ().AddToInv(item4.GetComponent<ItemScript>().itemID);
//		}
//	}
//
    void CheckInv()
    {
        NewLiftScript nlif = currentObject.GetComponent <NewLiftScript> ();

        if (nlif.tSlot1 != 500)                   //Always true
        {
            ItemScript iScript = item1.GetComponent <ItemScript> ();
            iScript.SetColor(nlif.tSlot1);
        }
        if (nlif.tSlot2 != 500)
        {
            ItemScript iScript = item2.GetComponent <ItemScript> ();
            iScript.SetColor(nlif.tSlot2);
        }
        if (nlif.tSlot3 != 500)
        {
            ItemScript iScript = item3.GetComponent <ItemScript> ();
            iScript.SetColor(nlif.tSlot3);
        }
        if (nlif.tSlot4 != 500)
        {
            ItemScript iScript = item4.GetComponent <ItemScript> ();
            iScript.SetColor(nlif.tSlot4);
        }

        //Why won't the slots change color for the second and third items when you remove the code-y thingy?
    }
Пример #2
0
 void Update()
 {
     if (currentObject != lastObject)
     {
         Debug.Log("No Match");
         if (currentObject == obj1)
         {
             CheckInv();
             lastObject = obj1;
             slctedObj  = 1;
             bg1.SetActive(true);
             bg2.SetActive(false);
             bg3.SetActive(false);
             Debug.Log("IS" + bg1.activeSelf + "");
             Debug.Log("TFF");
         }
         else if (currentObject == obj2)
         {
             CheckInv();
             lastObject = obj2;
             slctedObj  = 2;
             bg2.SetActive(true);
             bg1.SetActive(false);
             bg3.SetActive(false);
             Debug.Log("IS" + bg1.activeSelf + "");
             Debug.Log("FTF");
         }
         else if (currentObject == obj3)
         {
             CheckInv();
             lastObject = obj3;
             slctedObj  = 3;
             bg3.SetActive(true);
             bg2.SetActive(false);
             bg1.SetActive(false);
             Debug.Log("IS" + bg1.activeSelf + "");
             Debug.Log("FFT");
         }
     }
     NewLiftScript nlif = currentObject.GetComponent <NewLiftScript> ();
 }
Пример #3
0
    //Have something check on start/code switch, if the Slots have value.

    void Start()
    {
        currentObject = obj1;
        Debug.Log("Called NLS1");
        NewLiftScript nlif = currentObject.GetComponent <NewLiftScript> ();

        Debug.Log("Called NLS");
        if (currentObject == obj1)
        {
            CheckInv();
            lastObject = obj1;
            slctedObj  = 1;
            bg1.SetActive(true);
            bg2.SetActive(false);
            bg3.SetActive(false);
            Debug.Log("TFF");
        }
        else if (currentObject == obj2)
        {
            CheckInv();
            lastObject = obj2;
            slctedObj  = 2;
            bg2.SetActive(true);
            bg1.SetActive(false);
            bg3.SetActive(false);
            Debug.Log("FTF");
        }
        else if (currentObject == obj3)
        {
            CheckInv();
            lastObject = obj3;
            slctedObj  = 3;
            bg3.SetActive(true);
            bg2.SetActive(false);
            bg1.SetActive(false);
            Debug.Log("FFT");
        }
    }
Пример #4
0
    public void ButtonPress(string whichButton)
    {
        NewLiftScript nlif = currentObject.GetComponent <NewLiftScript> ();

        if (whichButton == "Play")
        {
            if (PlayCharges > 0)
            {
                nlif.Play();
            }
            PlayCharges--;
            playCount.text = "Charges: " + PlayCharges;
        }

        ItemScript iScript = currentItem.GetComponent <ItemScript> ();

        nlif.TempSlot = 0;

        if (goesBack == false)
        {
            //Finds out which button/command was used
            if (whichButton == "Up")
            {
                actn = 1;
            }
            else if (whichButton == "Down")
            {
                actn = 2;
            }
            else if (whichButton == "Left")
            {
                actn = 3;
            }
            else if (whichButton == "Right")
            {
                actn = 4;
            }
            else if (whichButton == "None")
            {
                actn = 0;
            }
            else if (whichButton == "Stop")
            {
                actn = 5;
            }
            else if (whichButton == "Loop")
            {
                actn = 6;
            }
            Debug.Log(whichButton + " set to actn");
        }
        else
        {
            actn = 0;
        }
        //Sets tempSlot to command/button number
        nlif.TempSlot = actn;
        nlif.AssignModule(selectedSlot);
        //Changes colors
        iScript.SetColor(actn);
        Debug.Log("Set Color" + actn + "");
        //this.gameObject.GetComponent<InventoryManager> ().UpdateInventory (currentItem.GetComponent<ItemScript> ().itemID);
    }