public void Select(ItemController ic_Itm) { int int_Indx = GetIndex(ic_Itm); int_SelectedIndex = int_Indx; }
public void SetItem(ItemController ic_Item) { this.ic_InvItem = ic_Item; img_ItemIcon.sprite = (ic_Item != null ? ic_Item.isc_Stats.spr_Icon : null); }
public int GetIndex(ItemController ic_Itm) { return(lst_Items.IndexOf(ic_Itm)); }
private void ItemsControl() { Collider[] col_Checking = Physics.OverlapSphere(tr_LookAt.position, 2f, LayerMask.GetMask("Item")); if (col_Checking.Length > 0) { float fl_Near = 2f; Collider col_Nearest = null; foreach (Collider col_c in col_Checking) { Vector3 vec_CollisionPos = col_c.ClosestPoint(tr_LookAt.position); float fl_Distance = Vector3.Distance(vec_CollisionPos, tr_LookAt.position); if (fl_Distance < fl_Near) { col_Nearest = col_c; fl_Near = fl_Distance; } } if (col_Nearest != null) { ItemController ic_Item = col_Nearest.GetComponent <ItemController>(); if (ic_Item != null) { ic_Inventary.ivc_ItemViewer.DrawItemViewer(ic_Item.isc_Stats, ic_Item.tr_MTransform, tr_Cam); if (st_States.bl_Interacting) { ic_Inventary.Bl_AddItem(ic_Item); } } } } else { ic_Inventary.ivc_ItemViewer.HideViewer(); } ItemController ic_SelectedWeapon = ic_Inventary.GetSelectedAd("PrimaryWeapon"); if (ic_SelectedWeapon != null) { if (ic_SelectedWeapon is GunController) { GunController gc_GunController = (ic_SelectedWeapon as GunController); ihc_IkHandlerController.tr_LeftHandPosition = gc_GunController.tr_LeftHandPosition; ihc_IkHandlerController.tr_LeftElbowPosition = gc_GunController.tr_LeftElbowPosition; gc_GunController.DrawCrossHair(tr_Cam); if (st_States.bl_Shooting) { gc_GunController.Attack(); } ihc_IkHandlerController.UpdateRecoil(gc_GunController.GetGunStats().fl_MaxRecoil, -vec_MoveAnim.x, gc_GunController.GetGunStats().fl_ShootingModifier); Cursor.lockState = (Input.GetKey(KeyCode.Escape) ? CursorLockMode.None : CursorLockMode.Locked); } } }