public void StartPrepareHull(NodeAddedEvent e, TankNode tank, [Context, JoinByTank] HullSkin hullSkin) { Entity entity = tank.Entity; entity.AddComponent <ChassisConfigComponent>(); base.NewEvent <RequestHullPrefabsEvent>().Attach(entity).Attach(hullSkin.Entity).ScheduleDelayed(0.2f); }
public void RequestPrefabs(RequestHullPrefabsEvent e, TankNode tank, HullSkin hullSkin) { Entity entity = tank.Entity; entity.AddComponent <TankCommonPrefabComponent>(); entity.AddComponent(new AssetReferenceComponent(new AssetReference(entity.GetComponent <TankCommonPrefabComponent>().AssetGuid))); entity.AddComponent <AssetRequestComponent>(); }
public void InstantiateHull(InstantiateHullEvent e, HullSkin hullSkin, [JoinByTank] TankNode tank, PrefabLoadedNode node) { Entity entity = tank.Entity; GameObject hullInstance = Object.Instantiate <GameObject>((GameObject)hullSkin.resourceData.Data); hullInstance.SetActive(false); if (entity.HasComponent <HullInstanceComponent>()) { entity.GetComponent <HullInstanceComponent>().HullInstance = hullInstance; } else { HullInstanceComponent component = new HullInstanceComponent { HullInstance = hullInstance }; entity.AddComponent(component); } Rigidbody rigidbody = this.BuildRigidBody(hullInstance); entity.AddComponent(new RigidbodyComponent(rigidbody)); PhysicsUtil.SetGameObjectLayer(hullInstance, Layers.INVISIBLE_PHYSICS); hullInstance.AddComponent <NanFixer>().Init(rigidbody, hullInstance.transform, tank.Entity.GetComponent <UserGroupComponent>().Key); base.NewEvent <InstantiateTankCommonPartEvent>().Attach(node).ScheduleDelayed(0.3f); }
public void RequestHullInstantiating(NodeAddedEvent e, SingleNode <MapInstanceComponent> map, [Combine] PrefabLoadedNode node, [JoinByTank] HullSkin hullSkin) { base.NewEvent <InstantiateHullEvent>().Attach(hullSkin).Attach(node).ScheduleDelayed(0.2f); }