Пример #1
0
        public override void SpawnRoundSurprise()
        {
            preselectedBuildingBlock = BuildController.PlacedBuildingBlockCopies[Random.Range(0, BuildController.NumberOfPlacedBuildingBlockCopies)];

            currentFlyAltitude     = CalculateFlyAltitude();
            ufoTransform.position  = new Vector3(ufoTransform.position.x, currentFlyAltitude, ufoTransform.position.z);
            beamTransform.position = new Vector3(beamTransform.position.x, currentFlyAltitude, beamTransform.position.z);

            RoundSurpriseController.Singleton.UFOOffset.position = new Vector3(preselectedBuildingBlock.transform.position.x, 0, preselectedBuildingBlock.transform.position.z);
        }
Пример #2
0
        /// <summary>
        /// Adds and places the currently selected building block, deactivating the hologram copy.
        /// </summary>
        public void AddCopy(BuildingBlock buildingBlock)
        {
            CancelPreviewCopy(); // The block still hasn't been placed yet, which means that we're technically still in preview mode.

            BuildingBlockCopy copy = buildingBlock.AddCopy();

            selectedBuildingBlockCopy = copy;
            placedBuildingBlockCopies.Add(copy);

            PlaceCopy();
        }
Пример #3
0
        public void Initialize(BuildingBlockCopy buildingBlockCopy, bool isPreview)
        {
            this.currentBuildingBlockCopy = buildingBlockCopy;
            this.isPreview = isPreview;

            FollowConstructionBlock();

            btnRemoveCopy.gameObject.SetActive(!isPreview);

            btnRotateX.enabled = buildingBlockCopy.CanRotate;
            btnRotateY.enabled = buildingBlockCopy.CanRotate;
            btnRotateZ.enabled = buildingBlockCopy.CanRotate;
        }
Пример #4
0
        public void DeselectCopy()
        {
            if (selectedBuildingBlockCopy != null)
            {
                selectedBuildingBlockCopy.Deselect();
                selectedBuildingBlockCopy = null;
            }

            hasSelectedBlock = false;

            constructionBuildingBlockContainer.SetActive(false);
            uiBuildingBlockQuickMenu.IsActive = false;
        }
Пример #5
0
        /// <summary>
        /// Selects a new copy and deactivates the old one.
        /// </summary>
        public void SelectCopy(BuildingBlockCopy buildingBlockCopy)
        {
            if (canBuild && !hasSelectedBlock)
            {
                DeselectCopy();

                hasSelectedBlock = true;

                selectedBuildingBlockCopy = buildingBlockCopy;
                selectedBuildingBlockCopy.Select();

                constructionBuildingBlockContainer.SetActive(true);
                constructionBuildingBlock.Initialize(buildingBlockCopy.BuildingBlock.RoundBuildingBlockTemplate.Template);

                MoveConstructionBuildingBlock(GetPointerRay(), true); // Set the block where it needs to be before moving on to the next frame.

                uiBuildingBlockQuickMenu.Initialize(buildingBlockCopy, false);
                uiBuildingBlockQuickMenu.IsActive = true;
            }
        }