// Initialize and find the components necissary. void Start() { thisItem = this.gameObject.GetComponent <Item>(); itemCon = GameObject.FindObjectOfType <itemController>(); // add the itemID to the itemCon's data array. itemCon.addItem(itemID, thisItem); updateTrueCost(); }
void Start() { items = GameObject.FindObjectsOfType <Item> (); itemCon = GameObject.FindObjectOfType <itemController> (); foreach (var item in items) { item.nameUpdate(); } }
// Use this for initialization void Start() { counter = 0; damageDealt = 0; player = GameObject.FindGameObjectWithTag("Player"); healthbar = FindObjectOfType <BarScript>(); backpack = player.transform.Find("Backpack").gameObject; items = backpack.GetComponent <itemController>(); }
/* * Value Chart for each ammo type * 9mm : $ 1 * 45ACP : $ 2 * 44Mag : $ 5 * 12Gage: $ 3 * 5.56 : $ 4 * 5.45 : $ 5 * 762 : $ 5 * 308 : $ 6 * * Ammo ID base of ammo-controller * 9mm : 0 * 44Mag : 1 * 45ACP : 2 * 5.45 : 3 * 5.56 : 4 * 762 : 5 * 308 : 6 * 12Gage: 7 **/ // Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); currentWallet = player.GetComponent <PlayerMovement>().wallet; backpack = player.transform.Find("Backpack").gameObject; ItemController = backpack.GetComponent <itemController>(); //Setting Value for onHand text txt9mm.text = "On-Hand: " + ItemController.ammo.ammo[0].ToString(); txt45ACP.text = "On-Hand: " + ItemController.ammo.ammo[2].ToString(); txt44mag.text = "On-Hand: " + ItemController.ammo.ammo[1].ToString(); txt12gage.text = "On-Hand: " + ItemController.ammo.ammo[7].ToString(); txt556.text = "On-Hand: " + ItemController.ammo.ammo[4].ToString(); txt545.text = "On-Hand: " + ItemController.ammo.ammo[3].ToString(); txt762.text = "On-Hand: " + ItemController.ammo.ammo[5].ToString(); txt308.text = "On-Hand: " + ItemController.ammo.ammo[6].ToString(); //Setting Value for ammoCount //Ammo count looks at the backpack ammoCount.Add(int.Parse(ItemController.ammo.ammo[0].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[2].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[1].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[7].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[4].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[3].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[5].ToString())); ammoCount.Add(int.Parse(ItemController.ammo.ammo[6].ToString())); SvalueCost = 0; BvalueCost = 0; //Setting value for ammoSpec //AmmoSpec is the type of ammo and the amount the user enter in the field ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); ammoSpec.Add(0); //Setting value for buy ammo amount //buyAmountAmmo is the type of ammo and the amount the user enter in the field buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); buyAmountAmmo.Add(0); ShopOpen.enabled = false; }//end of start
public void itemTest() { itemController ic = new itemController(); DateTime dt = DateTime.Now; string currentDate = dt.Year.ToString("0000") + dt.Month.ToString("00") + dt.Day.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00"); ic.InsertData(1001, 1, "device1", 10, "1000", "1100", currentDate, "des1"); ic.InsertData(1002, 1, "device2", 20, "2000", "2100", currentDate, "des2"); ic.InsertData(1003, 1, "device3", 30, "3000", "3100", currentDate, "des3"); ic.SelectData(3); ic.UpdateData(3, 1003, 1, "device3", 30, "4000", "4100", currentDate, "des3"); ic.DeleteData(1); }
// Use this for initialization void Start() { inventory = GameObject.Find("Player/Backpack").GetComponent <itemController> (); shootHandler = GameObject.Find("Player").GetComponent <playerShoot> (); if (!isExist) { isExist = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { if (other.tag.Equals("Projectile") && other.gameObject.GetComponent <projectileController> ().m_shooter != gameObject) { playerHealth.p_Health.TakeDamage(other.gameObject.GetComponent <projectileController>().m_damage); Destroy(other.gameObject); } if (other.tag.Equals("Door") || other.tag.Equals("Porta")) { this.collider.isTrigger = false; if (!isInsideRoom) { EnterRoom(); loadRoom load = other.gameObject.GetComponent <loadRoom>(); room = (load.m_room < 10) ? "sala" + "0" + load.m_room.ToString() : "sala" + load.m_room.ToString(); if (!load.isLoaded) { StartCoroutine(load.loadRoomOnContainerPosition(room)); } } else if (other.isTrigger) { LeaveRoom(); } if (other.tag.Equals("Space")) { playerHealth.p_Health.m_currentOxygenLossRate = playerHealth.p_Health.m_OxygenLossRate; } if (other.tag.Equals("Outer Space")) { playerHealth.p_Health.m_currentOxygenLossRate = playerHealth.p_Health.m_OuterSpaceOxygenLossRate; } } if (other.tag.Equals("Item")) { itemController i_control = other.gameObject.GetComponent <itemController>(); i_control.PlayerCollectItem(gameObject); } if (other.tag.Equals("Finish") && hasDiamond) { gameController.control.isDiamondCollected = true; Destroy(gameController.control.DiamondObject.GetComponent <FixedJoint>()); gameController.control.DiamondObject.transform.position = other.transform.position; } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); backpack = player.transform.Find("Backpack").gameObject; inventory = backpack.GetComponent <itemController>(); ammo = backpack.GetComponent <ammoController>(); ui.enabled = false; if (!invExists) { invExists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } }
// Update is called once per frame void Update() { //if(playerController.p_controller) if (gameController.control.powerupIsActive) { transform.GetChild(1).GetComponent <Image>().enabled = true; powerupCounter -= Time.deltaTime; transform.GetChild(1).GetComponent <Image> ().fillAmount = powerupCounter / gameController.control.m_powerupDurationSeconds; } else { transform.GetChild(1).GetComponent <Image>().enabled = false; powerupCounter = gameController.control.m_powerupDurationSeconds; } ClearPowerupListSprites(); if (gameController.control.PowerUpItemList.Count > 0) { for (int i = gameController.control.PowerUpItemList.Count - 1; i >= 0; i--) { itemController iControl = gameController.control.PowerUpItemList [i].GetComponent <itemController> (); switch (iControl.m_itemType) { case ItemType.AREA: powerupDisplay [gameController.control.PowerUpItemList.Count - 1 - i].sprite = areaSprites [(int)iControl.m_itemShape - 1]; break; case ItemType.DAMAGE: powerupDisplay [gameController.control.PowerUpItemList.Count - 1 - i].sprite = damageSprites [(int)iControl.m_itemShape - 1]; break; case ItemType.PIERCING: powerupDisplay [gameController.control.PowerUpItemList.Count - 1 - i].sprite = piercingSprites [(int)iControl.m_itemShape - 1]; break; case ItemType.VELOCITY: powerupDisplay [gameController.control.PowerUpItemList.Count - 1 - i].sprite = velocitySprites [(int)iControl.m_itemShape - 1]; break; } } } }
public void Break(GameObject gameObject) { rastgele = Random.Range(0, 100); health--; if (health == 0) { Destroy(gameObject); GameManager.Instance.AddScore(); GameManager.Instance.Score(); } if (itemPrefab != null && GameManager.Instance.scoreValue >= 20) { itemController controller = null; if (rastgele < 50) { GameObject newBox = Instantiate(itemPrefab); newBox.transform.position = this.transform.position; controller = newBox.GetComponent <itemController>(); if (controller) { controller.SetItemType(itemEnum.ScaleUp); } } if (rastgele > 30 && rastgele < 50 && GameManager.Instance.BallList.Count == 1) { GameObject newBox = Instantiate(itemPrefab); newBox.transform.position = this.transform.position; controller = newBox.GetComponent <itemController>(); if (controller) { controller.SetItemType(itemEnum.MultiBall); } } } }
// Use this for initialization void Start() { health = GameObject.Find("Player").GetComponent <playerHealth> (); inventory = GameObject.Find("Player/Backpack").GetComponent <itemController> (); }
void Start() { ammo = backpack.GetComponent <ammoController> (); inventory = backpack.GetComponent <itemController> (); }