Ejemplo n.º 1
0
        public void BuildTank(NodeAddedEvent e, HangarTankBaseSystem.HangarNode hangar, HangarTankBaseSystem.WeaponSkinItemPreviewLoadedNode weaponSkin, [Context, JoinByParentGroup] HangarTankBaseSystem.WeaponItemPreviewNode weaponItem, HangarTankBaseSystem.HullSkinItemPreviewLoadedNode tankSkin, [Context, JoinByParentGroup] HangarTankBaseSystem.TankItemPreviewNode tankItem, TankPaintItemPreviewLoadedNode tankPaint, WeaponPaintItemPreviewLoadedNode weaponPaint, HangarTankBaseSystem.HangarCameraNode hangarCamera, SingleNode <SupplyEffectSettingsComponent> settings)
        {
            Transform root = hangar.hangarTankPosition.transform;

            root.DestroyChildren();
            GameObject tankInstance = (GameObject)Object.Instantiate(tankSkin.resourceData.Data);

            tankInstance.transform.SetParent(root);
            tankInstance.transform.localPosition = Vector3.zero;
            tankInstance.transform.localRotation = Quaternion.identity;
            tankSkin.hangarItemPreview.Instance  = tankInstance;
            tankInstance.GetComponentInChildren <NitroEffectComponent>().InitEffect(settings.component);
            Transform  mountPoint     = tankInstance.GetComponent <MountPointComponent>().MountPoint;
            GameObject weaponInstance = (GameObject)Object.Instantiate(weaponSkin.resourceData.Data);

            weaponInstance.transform.SetParent(tankInstance.transform);
            weaponInstance.transform.localPosition = mountPoint.localPosition;
            weaponInstance.transform.localRotation = mountPoint.localRotation;
            weaponSkin.hangarItemPreview.Instance  = weaponInstance;
            GameObject tankPaintInstance = (GameObject)Object.Instantiate(tankPaint.resourceData.Data);

            tankPaintInstance.transform.SetParent(tankInstance.transform);
            tankPaintInstance.transform.localPosition = Vector3.zero;
            GameObject weaponPaintInstance = (GameObject)Object.Instantiate(weaponPaint.resourceData.Data);

            weaponPaintInstance.transform.SetParent(tankInstance.transform);
            weaponPaintInstance.transform.localPosition = Vector3.zero;
            PhysicsUtil.SetGameObjectLayer(root.gameObject, Layers.STATIC);
            this.ApplyPaint(tankInstance, weaponInstance, tankPaintInstance, weaponPaintInstance);
            weaponInstance.GetComponentInChildren <DoubleDamageEffectComponent>().InitEffect(settings.component);
            weaponInstance.GetComponentInChildren <DoubleDamageSoundEffectComponent>().RecalculatePlayingParameters();
            Renderer weaponRenderer = TankBuilderUtil.GetWeaponRenderer(weaponInstance);

            weaponRenderer.tag = "TankWeapon";
            Renderer hullRenderer = TankBuilderUtil.GetHullRenderer(tankInstance);

            hullRenderer.tag = "TankHull";
            weaponRenderer.reflectionProbeUsage = ReflectionProbeUsage.Off;
            weaponRenderer.lightProbeUsage      = LightProbeUsage.Off;
            hullRenderer.reflectionProbeUsage   = ReflectionProbeUsage.Off;
            hullRenderer.lightProbeUsage        = LightProbeUsage.Off;
            BurningTargetBloom componentInChildren = hangarCamera.cameraRootTransform.Root.GetComponentInChildren <BurningTargetBloom>();

            componentInChildren.targets.Clear();
            componentInChildren.targets.Add(weaponRenderer);
            componentInChildren.targets.Add(hullRenderer);
            base.ScheduleEvent <HangarTankBuildedEvent>(hangar);
        }
        public void BuildContainer(NodeAddedEvent e, HangarTankBaseSystem.HangarNode hangar, ContainerItemPreviewLoadedNode container, HangarTankBaseSystem.HangarCameraNode hangarCamera, SingleNode <MainScreenComponent> screen)
        {
            screen.component.HideNewItemNotification();
            Transform          containerPosition   = hangar.hangarContainerPosition.transform;
            ContainerComponent componentInChildren = hangar.hangarContainerPosition.GetComponentInChildren <ContainerComponent>();

            if ((componentInChildren != null) && (componentInChildren.assetGuid == container.assetReference.Reference.AssetGuid))
            {
                base.ScheduleEvent <HangarContainerBuildedEvent>(hangar);
            }
            else
            {
                this.BuildContainer(containerPosition, container.resourceData.Data, hangarCamera.cameraRootTransform.Root);
                containerPosition.GetComponentInChildren <ContainerComponent>().assetGuid = container.assetReference.Reference.AssetGuid;
                base.ScheduleEvent <HangarContainerBuildedEvent>(hangar);
            }
        }