void OnEnable() { OnNewInteractiveBloc = PubsubHandler.HandleNewInteractiveBloc((GameObject bloc) => { print("MyEventSystem::HandleNewInteractiveBloc -- Save new bloc " + bloc); this.bloc = bloc.GetComponent <InteractiveBloc>(); }); }
void AddBloc(InteractiveBloc bloc) { tblocs.Add(bloc); bloc.transform.SetParent(transform); bloc.tag = "Tower"; bloc.GetComponent <Rigidbody>().Sleep(); // bloc.GetComponent<Rigidbody>().mass = 1000; Pubsub.Publish(Pubsub.Type.NewBlocOnTower, new object[] { tblocs.Count, bloc.gameObject }); }