private void SpawnPeriodic(GameObjectPosition gameObjectPos) { timeCount -= Time.deltaTime; if (timeCount <= 0f) { timeCount = period; Instantiate(gameObjectPos.gameObject, gameObjectPos.position, Quaternion.identity); } }
/// <summary> /// Expecting GameObjectPosition /// </summary> /// <param name="obj"></param> /// <returns></returns> public override object Do(object obj) { GameObjectPosition gameObjectPos = obj as GameObjectPosition; if (gameObjectPos == null) { Debug.LogWarning("Casting to GameObjectPosition failed!"); return(null); } SpawnPeriodic(gameObjectPos); return(null); }
/// <summary> /// Expecting GameObjectPosition /// </summary> /// <param name="obj"></param> /// <returns></returns> public override object Do(object obj) { GameObjectPosition gameObjectPos = obj as GameObjectPosition; if (gameObjectPos == null) { Debug.LogWarning("Casting to GameObjectPosition failed!"); return(null); } Instantiate(gameObjectPos.gameObject, gameObjectPos.position, Quaternion.identity); return(null); }