private void Update() { if (Input.GetKeyDown(KeyCode.W)) { Manager_Events.Publish(Manager_Events.onWPress, new WPressEvent()); } }
private void Update() { if (Input.GetKeyDown(KeyCode.S)) { float x = Random.Range(0, 10); float z = Random.Range(0, 10); Vector3 pos = new Vector3(x, 0, z); Instantiate(prefabExample, pos, Quaternion.identity); Manager_Events.Publish(Manager_Events.onCubeSpawn, new CubeSpawnEvent(Time.realtimeSinceStartup, pos)); } }
private void OnEnable() { Manager_Events.AddListener(Manager_Events.onWPress, OnWPress); Manager_Events.AddListener(Manager_Events.onCubeSpawn, OnCubeSpawn); }
private void OnDisable() { Manager_Events.RemoveListener(Manager_Events.onWPress, OnWPress); Manager_Events.RemoveListener(Manager_Events.onCubeSpawn, OnCubeSpawn); }