Exemplo n.º 1
0
        public void AddData(BulletDataContainer bulletData)
        {
            if (_bulletDataContainer == null)
            {
                _bulletDataContainer = new List <BulletDataContainer>();
            }

            _bulletDataContainer.Add(bulletData);
        }
Exemplo n.º 2
0
        protected void ReadData()
        {
            if (_bulletDataContainer != null && _dataIndex < _bulletDataContainer.Count && _lifeTime == _bulletDataContainer[_dataIndex].Delay)
            {
                BulletDataContainer newData = _bulletDataContainer[_dataIndex];
                if (newData.Speed.HasValue)
                {
                    _speed = newData.Speed.Value;
                }

                if (newData.Angle.HasValue)
                {
                    _angle = newData.Angle.Value * Mathf.Deg2Rad;
                }

                _acceleration = newData.Acceleration;
                _rotation     = newData.Rotation * Mathf.Deg2Rad;
                _targetSpeed  = newData.MaxSpeed;
                SetSprite(newData.BulletSprite);
                SetHitBox(newData.BulletSprite);
                _dataIndex++;
            }
        }