using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestObject : MonoBehaviour { private Vector3 origPos; private Item item; // Start is called before the first frame update void Start() { origPos = transform.position; item = GetComponentInChildren<Item>(); } private bool animate = false; void StartLocal() { animate = true; new SimpleTimer(5, () => item.DestroyItem()); } // Update is called once per frame void Update() { if (animate) { transform.position = origPos + Vector3.right * 0.5f * Mathf.Sin(Time.realtimeSinceStartup); } } }