public void ReloadShipController(GameObject provider, bool isRequired)
        {
            if (isRequired)
            {
                var newProvider = _providersPool.Pop();

                var newModel = new ShipModel(new ShipData()
                {
                    Provider     = newProvider,
                    Speed        = _data.Speed,
                    Acceleration = _data.Acceleration,
                    HP           = _data.HP,
                    Force        = _data.Force
                });

                var moveImplementation     = new AccelerationMove(newProvider.transform, newModel.Speed, newModel.Acceleration);
                var rotationImplementation = new RotationShip(newProvider.transform);

                GetShip.ReloadShip(moveImplementation, rotationImplementation, newModel);

                newProvider.GetComponent <IView>().ProviderDestroyed += GetShip.WatchToProviderDestroyed;
            }
            else
            {
                provider.GetComponent <IView>().ProviderDestroyed -= GetShip.WatchToProviderDestroyed;
                _providersPool.Push(provider);
            }
        }
Example #2
0
        public void Release()
        {
            BaseClient     = default;
            Command        = default;
            Payload        = default;
            UId            = default;
            internalOffset = default;

            pool.Push(this);
        }
 public void RemoveWayPoint(Vector2 position)
 {
     for (int i = 0; i < _wayPoints.Count; i++)
     {
         if (_wayPoints[i].transform.position == new Vector3(position.x, position.y, 0))
         {
             _pool.Push(_wayPoints[i]);
             _wayPoints.RemoveAt(i);
         }
     }
 }
Example #4
0
        public void Release()
        {
            using (semaphore.Wait())
            {
                if (!manualReset.IsSet)
                {
                    manualReset.Set();
                }

                alreadyDeserialized = false;
                Timeouted           = false;
                Serializable        = null;

                pool.Push(this);
            }
        }
Example #5
0
 public void Dispose()
 {
     _cache.Push(this.Value);
 }
Example #6
0
 private void SendCompleted(object sender, SocketAsyncEventArgs e)
 {
     e.RemoteEndPoint = null;
     sendArgsPool.Push(e);
 }
Example #7
0
 private void SendCompleted(object sender, SocketAsyncEventArgs e)
 {
     sendArgsPool.Push(e);
 }
Example #8
0
 public void Release()
 {
     SenderId = 0;
     OnRelease();
     pool.Push(this);
 }