/// <summary> /// Creates the health bar for healthed object. /// </summary> /// <typeparam name="T">The healthed object type.</typeparam> /// <param name="targetObj">The target object.</param> public void CreateHealthBarFor <T>(T targetObj) where T : IShowableHealth { if (healthBarPrefab == null) { return; } var bar = ObjectsPool.GetOrCreate(healthBarPrefab); bar.Setup(targetObj, uiCollectorTransform, CameraMain.Camera); }
private IRedisChannel PrepareRedisChannel(Socket socket) { var socketWrapper = new SocketWrapper(socket); var channel = _redisPipelinePool.GetOrCreate(() => { var asyncSocket = new AsyncSocketWrapper(); var pipeline = new RedisPipeline(asyncSocket, new RedisSender(_buffersPool, asyncSocket, false), new RedisReceiver(_inputBuffersPool, asyncSocket)); return(new RedisChannel(pipeline)); }); channel.ResetState(); channel.EngageWith(socketWrapper); channel.EngageWith(Serializer); return(channel); }
/// <summary> /// Called when the hero revive timer has started. /// </summary> /// <param name="timer">The countdown timer.</param> /// <exception cref="ArgumentNullException">timer</exception> public void OnHeroReviveTimerStartHandler(TimerCountdown timer) { if (timerBoardPrefab == null) { return; } if (timer == null) { throw new ArgumentNullException(nameof(timer)); } var timerBoard = ObjectsPool.GetOrCreate(timerBoardPrefab); timerBoard.transform.SetParent(transform); timerBoard.transform.localScale = Vector3.one; timerBoard.Setup(timer); }
/// <summary> /// Creates unit using ObjectsPool and customize it. /// </summary> /// <param name="data">The unit data.</param> /// <param name="position">The position.</param> /// <param name="rotation">The rotation.</param> /// <returns>The created unit.</returns> public virtual TUnit CreateUnit(TUnitData data, Vector3 position, Quaternion rotation) { if (data == null) { throw new ArgumentNullException(nameof(data)); } var unit = ObjectsPool.GetOrCreate <TUnit>(data.Prefab, position, rotation); if (!unit.IsSameUnitDataAlreadySet(data)) { SetupUnit(unit, data); } unit.UpdateParametersPoints(); NotifyAllAboutNewUnit(unit); return(unit); }