コード例 #1
0
        /// <summary>
        /// On Play we instantiate the specified object, either from the object pool or from scratch
        /// </summary>
        /// <param name="position"></param>
        /// <param name="feedbacksIntensity"></param>
        protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
        {
            if (!Active || !FeedbackTypeAuthorized || (GameObjectToInstantiate == null))
            {
                return;
            }

            if (_objectPooler != null)
            {
                _newGameObject = _objectPooler.GetPooledGameObject();
                if (_newGameObject != null)
                {
                    PositionObject(position);
                    _newGameObject.SetActive(true);
                }
            }
            else
            {
                _newGameObject = GameObject.Instantiate(GameObjectToInstantiate) as GameObject;
                if (_newGameObject != null)
                {
                    SceneManager.MoveGameObjectToScene(_newGameObject, Owner.gameObject.scene);
                    PositionObject(position);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// On Play we instantiate the specified object, either from the object pool or from scratch
 /// </summary>
 /// <param name="position"></param>
 /// <param name="attenuation"></param>
 protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
 {
     if (Active && (VfxToInstantiate != null))
     {
         if (_objectPool != null)
         {
             _newGameObject = _objectPool.GetPooledGameObject();
             if (_newGameObject != null)
             {
                 _newGameObject.transform.position = GetPosition(position);
                 _newGameObject.SetActive(true);
             }
         }
         else
         {
             _newGameObject = GameObject.Instantiate(VfxToInstantiate) as GameObject;
             _newGameObject.transform.position = GetPosition(position);
             if (trackPlayer == true)
             {
                 _newGameObject.transform.position  = GameObject.Find("YaminPlayer").transform.position;
                 _newGameObject.transform.position += new Vector3(0, VfxPositionOffset.y, 0);
                 if (randomizeXRange == true)
                 {
                     _newGameObject.transform.position += new Vector3(Random.Range(-VfxPositionOffset.x, VfxPositionOffset.x), 0, 0);
                 }
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// On Play we instantiate the specified object, either from the object pool or from scratch
 /// </summary>
 /// <param name="position"></param>
 /// <param name="attenuation"></param>
 protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
 {
     if (Active && (VfxToInstantiate != null))
     {
         if (_objectPool != null)
         {
             _newGameObject = _objectPool.GetPooledGameObject();
             if (_newGameObject != null)
             {
                 _newGameObject.transform.position = GetPosition(position);
                 _newGameObject.SetActive(true);
             }
         }
         else
         {
             _newGameObject = GameObject.Instantiate(VfxToInstantiate) as GameObject;
             _newGameObject.transform.position = GetPosition(position);
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// On Play we instantiate the specified object, either from the object pool or from scratch
 /// </summary>
 /// <param name="position"></param>
 /// <param name="feedbacksIntensity"></param>
 protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
 {
     if (Active && (GameObjectToInstantiate != null))
     {
         if (_objectPool != null)
         {
             _newGameObject = _objectPool.GetPooledGameObject();
             if (_newGameObject != null)
             {
                 PositionObject(position);
                 _newGameObject.SetActive(true);
             }
         }
         else
         {
             _newGameObject = GameObject.Instantiate(GameObjectToInstantiate) as GameObject;
             PositionObject(position);
         }
     }
 }