Пример #1
0
 public void Update()
 {
     this._curInterval += Time.deltaTime;
     this._curTime     += Time.deltaTime;
     if (this._curTime >= this._data.Dur)
     {
         this.DoCallbacks();
         GameObject.Destroy(this);
     }
     else
     {
         if (this._curInterval >= this._data.Interval)
         {
             this._curInterval = 0;
             var swarm = new GameObject();
             this._data.Swarm.Add(swarm);
             var renderer = swarm.AddComponent <SpriteRenderer>();
             renderer.sprite          = this._data.Sprite;
             swarm.transform.position = RandomPositionOffset.RandomOffset(
                 this._data.Target,
                 this._data.MaxOffset);
             renderer.sortingLayerName = SortingLayers.PARTICLES;
             renderer.sortingOrder--;
             var raycastData = new SRaycastMoveData();
             raycastData.Epsilon = 0.05f;
             raycastData.Handle  = swarm;
             raycastData.Speed   = 8f;
             raycastData.Target  = RandomPositionOffset.RandomOffset(
                 this._data.Target,
                 0.3f);
             var raycast = swarm.AddComponent <SRaycastMove>();
             raycast.Init(raycastData);
         }
     }
 }
Пример #2
0
 public void Init(SRaycastMoveData data)
 {
     this._data = data;
 }