コード例 #1
0
 /// <summary>
 /// 播放拾取特效 by吴江
 /// </summary>
 /// <param name="_effectName"></param>
 /// <param name="_time"></param>
 public void DoPickUpEffect(string _effectName, float _time, Vector3 _from, SmartActor _to)
 {
     if (!CanShow)
     {
         return;
     }
     if (_effectName == string.Empty || _time <= 0)
     {
         return;
     }
     GameCenter.spawner.SpawnEffecter(_effectName, _time + holdTime, (x) =>
     {
         if (x == null)
         {
             return;
         }
         x.gameObject.SetMaskLayer(this.gameObject.layer);
         x.transform.parent     = null;
         x.transform.rotation   = Quaternion.identity;// Quaternion.Euler(_from - transform.position);
         x.transform.parent     = null;
         x.transform.localScale = Vector3.one;
         PickUpEffect p         = x.gameObject.GetComponent <PickUpEffect>();
         if (p == null)
         {
             p = x.gameObject.AddComponent <PickUpEffect>();
         }
         p.Init(_from, _to, _time, holdTime, x);
     }, false);
 }
コード例 #2
0
    //PICKUP EFFECTS
    PickUpEffect CreatePickUpEffect(DiContainer _, Transform parent)
    {
        var          prefab     = _effectsSettings.PickUpDieEffect.effectPrefab;
        PickUpEffect instPrefab = Container.InstantiatePrefabForComponent <PickUpEffect>(prefab);

        if (parent != null)
        {
            instPrefab.transform.SetParent(parent);
        }
        instPrefab.transform.localPosition = Vector3.zero;
        //instPrefab.transform.position = position;
        instPrefab.transform.rotation = parent.transform.rotation;
        instPrefab.gameObject.SetActive(false);
        return(instPrefab);
    }