// void CancelEvent(GameObjectPlaceLocation location) { //然後是取得武器放回來 location._weaopnPlaceToHere -= new GameObjectPlaceLocation.WeaopnPlaceToHere(WeaponPlaceFromHere); //武器被拿走 location._weaopnTakeOutFromHere -= new GameObjectPlaceLocation.WeaopnTakeOutFromHere(WeaponGrab); }
//增加數量 protected void AddItemToGrab(GameObject add) { //先複製物件 GameObject placeLocation = Instantiate(_exampleWeaponGameObjectSelector); placeLocation.SetActive(true); //取得樣本 GameObjectPlaceLocation _singleGameObjectPlaceLocation = placeLocation.GetComponent <GameObjectPlaceLocation>(); //然後是取得武器放回來 _singleGameObjectPlaceLocation._weaopnPlaceToHere += new GameObjectPlaceLocation.WeaopnPlaceToHere(WeaponPlaceFromHere); //武器被拿走 _singleGameObjectPlaceLocation._weaopnTakeOutFromHere += new GameObjectPlaceLocation.WeaopnTakeOutFromHere(WeaponGrab); //設定武器 _singleGameObjectPlaceLocation.SetWeapon(add); //增加到陣列裡面 _listWeapon.Add(_singleGameObjectPlaceLocation); //設定位置 placeLocation.transform.parent = _objectPlace; placeLocation.transform.localPosition = new Vector3(0, 0, 0); placeLocation.transform.localRotation = Quaternion.Euler(0, 0, 0); }