void GetItemMessage() { if (is_search) { Player_State.ismove = false; if (_itemup.item.ID == 0000) { _flowchart.ExecuteBlock("nothing"); } else if (_itemup.item.ID == 1) { _flowchart.ExecuteBlock("Get_Lingshi"); _itemup.PickUp(); is_search = false; } else if (_itemup.item.ID > 0020) { _flowchart.SetStringVariable("classroom", _itemup.item.name); _flowchart.ExecuteBlock("Get_Key"); _itemup.PickUp(); } is_search = false; } }
public override void OnInspectorGUI() { ItemPickup itemPickup = (ItemPickup)target; DrawDefaultInspector(); if (GUILayout.Button("Force Pickup")) { itemPickup.PickUp(); } }
private void OnTriggerEnter(Collider other) { ItemPickup item = other.gameObject.GetComponent <ItemPickup>(); //print("Collided with " + other.gameObject.name); if (item != null && item != lastItem) { if (item.CanPickUp()) { // then try talking with it! item.PickUp(); lastItem = item; } } }
void LateUpdate() { if (mActActive) { if (anim.CurrentClip != mClips[(int)AnimState.attack] || !anim.gameObject.activeInHierarchy) { mActActive = false; } else { //hit stuff Vector3 s = whipStart.position; s.z = 0.0f; Vector3 e = whipEnd.position; e.z = 0.0f; float dist = Mathf.Abs(e.x - s.x); Vector3 dir = new Vector3(Mathf.Sign(e.x - s.x), 0, 0); RaycastHit[] hits = Physics.SphereCastAll(s, hitRadius, dir, dist, hitMask); for (int i = 0, max = hits.Length; i < max; i++) { mDmg.CallDamageTo(hits[i].collider.gameObject, hits[i].point, hits[i].normal); } hits = Physics.RaycastAll(s, dir, dist, triggerMask); for (int i = 0, max = hits.Length; i < max; i++) { ItemPickup item = hits[i].collider.GetComponent <ItemPickup>(); if (item && !item.isReleased) { item.PickUp(Player.instance); //continue; } //other triggers? } } } }
public void OnTriggerStay(Collider hit) { // if we collided a second object while we are interacting don't // interact with it if (this._currentInteractionObject != hit) { return; } // we hit something bool interact = CrossPlatformInputManager.GetButtonDown(GlobalUtilities.INTERACT); //was it a pickup item? if (hit.tag == GlobalUtilities.PICKUP_TAG) { //we want to first check the type ItemPickup pickUp = hit.GetComponent <ItemPickup>(); //if the pickup doesn't require interaction the pickup script handles using the item if (!pickUp.RequiresInteraction()) { return; } if ((interact && !this._isInteracting)) { this._isInteracting = true; GameObject currentWeapon = this.CurrentActiveWeapon(); switch (pickUp.GetPickupType()) { case ItemPickup.RIGHT_HAND_WEAPON: if (this._hasWeapon && currentWeapon != null) { BaseWeapon weaponScript = currentWeapon.GetComponent <BaseWeapon> (); weaponScript.Drop(); } this._rightHandWeapon = pickUp.PickUp(this._rightHandWeaponHold); this._hasWeapon = true; this.GetRightHandWeaponScript().IsBeingHeld = true; GlobalUtilities.ClearInteractText(); break; case ItemPickup.RIGHT_HAND_SHIELD: break; case ItemPickup.LEFT_HAND_WEAPON: if (this._hasWeapon && currentWeapon != null) { BaseWeapon weaponScript = currentWeapon.GetComponent <BaseWeapon> (); weaponScript.Drop(); } this._leftHandWeapon = pickUp.PickUp(this._leftHandWeaponHold); this._hasWeapon = true; this.GetLeftHandWeaponScript().IsBeingHeld = true; GlobalUtilities.ClearInteractText(); break; case ItemPickup.LEFT_HAND_SHIELD: break; default: break; } this._isInteracting = false; } else { GlobalUtilities.ShowButtonInteract("X", pickUp.GetIdentifier()); } } }