コード例 #1
0
        public void InstantiateTankCommonPart(InstantiateTankCommonPartEvent e, [Combine] PrefabLoadedNode node)
        {
            HullInstanceIsReadyEvent eventInstance = new HullInstanceIsReadyEvent {
                HullInstance = Object.Instantiate <GameObject>(node.resourceData.Data as GameObject)
            };

            base.NewEvent(eventInstance).Attach(node).ScheduleDelayed(0.3f);
        }
コード例 #2
0
 public void RequestHullInstantiating(NodeAddedEvent e, SingleNode <MapInstanceComponent> map, [Combine] PrefabLoadedNode node, [JoinByTank] HullSkin hullSkin)
 {
     base.NewEvent <InstantiateHullEvent>().Attach(hullSkin).Attach(node).ScheduleDelayed(0.2f);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void BuildHull(HullInstanceIsReadyEvent evt, PrefabLoadedNode node)
 {
     node.Entity.AddComponent(new TankCommonInstanceComponent(evt.HullInstance));
 }