private void TryActivateItem(SellableItem item) { if (item is ThrowedObject) { ThrowedObject upItem = item as ThrowedObject; _thrower.SetThrowedObject(upItem); _currentThrowedItem = _throwedItems.IndexOf(upItem); foreach (var item_ in _throwedItems) { item_.DeActivate(); } item.Activate(); } else if (item is RoomItem) { RoomItem upItem = item as RoomItem; upItem.TryRender(); } SaveAllItems(); }
private void Throw() { Vector3 spawnPoint = RandomPointInArea(_spawnArea); ThrowedObject throwedObject = _pool.GetAvailableObject(); throwedObject.transform.position = spawnPoint; throwedObject.gameObject.SetActive(true); }
public void InitializePool(ThrowedObject template, Transform target, HitParticle hitParticle) { CleanPool(); for (int i = 0; i < _poolCapacity; i++) { ThrowedObject newObject = Instantiate(template, transform); newObject.gameObject.SetActive(false); newObject.Init(target, hitParticle); _objectPool.Add(newObject); } }
public void SetThrowedObject(ThrowedObject template) { _currentTemplate = template; _pool.InitializePool(template, _target, _hitParticle); }