当前位置: 首页>>代码示例>>C#>>正文


C# Vector3.SetY方法代码示例

本文整理汇总了C#中Vector3.SetY方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.SetY方法的具体用法?C# Vector3.SetY怎么用?C# Vector3.SetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector3的用法示例。


在下文中一共展示了Vector3.SetY方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        Terrain terrain = this.GetComponent<Terrain>();

        for (int i = 0; i < this.SpawnCount; ++i)
        {
            Vector2 location = Random.insideUnitCircle * this.SpawnRadius;
            Vector3 worldPosition = new Vector3(location.x, 0.0f, location.y);
            float y = terrain.SampleHeight(worldPosition) + this.HeightAboveGround;
            worldPosition = worldPosition.SetY(y);

            GameObject collectableObject = (GameObject)GameObject.Instantiate(this.CollectableToPlace, worldPosition, this.CollectableToPlace.transform.rotation);
            collectableObject.isStatic = true;
            collectableObject.transform.parent = this.ParentGameObject.transform;
        }
    }
开发者ID:nicharesuk,项目名称:UnityKickstart,代码行数:16,代码来源:PlaceCollectablesOnTerrain.cs

示例2: VerticalHoleTransition

        public IEnumerator VerticalHoleTransition(Vector3 targetEndpoint, GrottoEntrance.EnterMethod enterMethod)
        {
            if (enterMethod == GrottoEntrance.EnterMethod.Fall)
            {
                iTween.MoveTo(gameObject, iTween.Hash("position", transform.position.SetY(transform.position.y - 5f), "time", .5f, "easetype", iTween.EaseType.easeInBack));
            }
            else if (enterMethod == GrottoEntrance.EnterMethod.Spring)
            {
                iTween.MoveTo(gameObject, iTween.Hash("position", transform.position.SetY(transform.position.y + 10f), "time", .5f, "easetype", iTween.EaseType.easeInOutSine));
            }

            yield return new WaitForSeconds(.25f);
            yield return StartCoroutine(CameraManager.Instance.DoWipeOut(.5f));
            yield return new WaitForSeconds(.5f);
            CameraManager.Instance.GetCameraRig().position = targetEndpoint;
            transform.position = targetEndpoint.SetY(targetEndpoint.y + 3f);
            iTween.MoveTo(gameObject, iTween.Hash("position", targetEndpoint, "time", 1f, "easetype", iTween.EaseType.easeOutCirc));
            yield return new WaitForSeconds(.25f);
            yield return StartCoroutine(CameraManager.Instance.DoWipeIn(.5f));
        }
开发者ID:harjup,项目名称:WizardBroadcast,代码行数:20,代码来源:PlayerAnimate.cs

示例3: LookToward

 // Duplicated from Chaser.cs, will need to get split into own component
 private void LookToward(Vector3 direction)
 {
     transform.rotation = Quaternion.LookRotation(direction.SetY(0), Vector3.up);
 }
开发者ID:harjup,项目名称:Xyz,代码行数:5,代码来源:Pusher.cs

示例4: SpawnClicker

 private void SpawnClicker(string type, Vector3 position = new Vector3(), int stackedClickers = 1)
 {
     var clickGenerator = Instantiate(AutoClickerTemplate).GetComponent<ClickGenerator>();
     clickGenerator.Initialize(this, Clickers[type].CloneWithRandom());
     clickGenerator.transform.position = position.SetY(Depth);
     clickGenerator.StackedClickers = stackedClickers;
     ActiveAutoclickers.Add(clickGenerator);
 }
开发者ID:wallden,项目名称:GoldCrush,代码行数:8,代码来源:GameMaster.cs

示例5: LookAt

 public void LookAt(Vector3 vector3)
 {
     playerMesh.LookAt(vector3.SetY(playerMesh.position.y));
 }
开发者ID:harjup,项目名称:WizardBroadcast,代码行数:4,代码来源:UserMovement.cs

示例6: ClimbGeometry

        public IEnumerator ClimbGeometry(Vector3 target, Action action)
        {
            collider.enabled = false;

            SoundManager.Instance.Play(SoundManager.SoundEffect.EffortNoise);
            iTween.MoveTo(gameObject,
                target.SetY(target.y + 2.5f),
                .4f);
            action();
            yield return new WaitForSeconds(.4f);
            collider.enabled = true;
            yield break;
        }
开发者ID:harjup,项目名称:WizardBroadcast,代码行数:13,代码来源:UserMovement.cs

示例7: Update

        void Update()
        {
            if(playerCards == null || opponentCards == null) return;

            //set up card cost glowing material first time
            if (cardGlowMat == null && playerCards.Count > 1)
            {
                cardOutlineMat = playerCards[0].cardView.costText.fontSharedMaterial;
                cardGlowMat = new Material(cardOutlineMat);
                cardGlowMat.SetFloat(ShaderUtilities.ID_GlowPower, 0.4f);
                cardGlowMat.SetFloat(ShaderUtilities.ID_OutlineWidth, 0.0f);
            }

            //position opponents cards
            //might need to DRY it up sometime but rule of three still holds
            cardAngleSpread = -13f + (0.8f * opponentCards.Count);
            for(int c = 0; c < opponentCards.Count; c++)
            {
                var card = opponentCards[c];
                if(card.activated) continue;
                var rectTransform = card.rectTransform;
                var cardCountOffset = 0 - ((opponentCards.Count - 1) / 2) + c;
                rectTransform.rotation = Quaternion.Euler(new Vector3(0, 0, 180f + cardCountOffset * cardAngleSpread));
                rectTransform.Rotate(Vector3.up, 180f, Space.Self);

                dest = PointOnCircle(cardCircleRadius, 270f + cardCountOffset * cardAngleSpread, opponentCardCircleCenter);
                dest = dest.SetZ(dest.z + (-1.0f * c));

                rectTransform.anchorMax = opponentAnchorPosition;
                rectTransform.anchorMin = opponentAnchorPosition;
                rectTransform.pivot = opponentAnchorPosition;
                rectTransform.anchoredPosition3D = iTween.Vector3Update(rectTransform.anchoredPosition3D, dest, 10.0f);
            }

            //and now players cards
            cardAngleSpread = -16f + (1.2f * playerCards.Count);
            for(int c = 0; c < playerCards.Count; c++)
            {
                var card = playerCards[c];
                if(card.activated) continue;
                var rectTransform = card.rectTransform;
                var cardCountOffset = 0 - ((playerCards.Count - 1) / 2) + c;
                rectTransform.rotation = Quaternion.Euler(new Vector3(0, 0, cardCountOffset * cardAngleSpread));

                dest = PointOnCircle(cardCircleRadius, 90f + cardCountOffset * cardAngleSpread, cardCircleCenter);
                dest = dest.SetZ(dest.z + (-1.0f * c));

                //drag the selected card with the cursor
                if (selectedCard != null && card.id == selectedCard.card.id)
                {
                    var mouseWorld = cardCanvasHelper.MouseToWorld(dest.z);
                    var dragPos = new Vector3(mouseWorld.x + selectedCard.point.x, mouseWorld.y + selectedCard.point.y, mouseWorld.z);
                    dragPos = dragPos.SetY(dragPos.y + cardDimensions.y * canvas.scaleFactor);

                    var dragDist = Vector3.Distance(dragPos, dest);
                    if (dragDist < maxDragDistance || !selectedNeedsArrow)
                    {
                        rectTransform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
                        rectTransform.anchoredPosition3D = dragPos;
                        continue;
                    }
                    else
                    {
                        dest = dest.SetY(dest.y + 30f);
                    }
                }
                //show the hover card on top of where the actual card is after a delay
                if (hoveredCard != null && card == hoveredCard && (selectedCard == null || hoveredCard != selectedCard.card))
                {
                    dest = dest.SetY(dest.y + 30f);
                    hoverAccumulator += Time.deltaTime;

                    if (hoverAccumulator > CardView.HOVER_DELAY)
                    {
                        card.cardView.displayWrapper.SetActive(false);
                    }
                }

                rectTransform.anchorMax = anchorPosition;
                rectTransform.anchorMin = anchorPosition;
                rectTransform.pivot = anchorPosition;
                rectTransform.anchoredPosition3D = iTween.Vector3Update(rectTransform.anchoredPosition3D, dest, 10.0f);

                if (card.playable && cardGlowMat != null)
                {
                    card.cardView.costText.fontMaterial = cardGlowMat;
                }
                else if(cardOutlineMat != null)
                {
                    card.cardView.costText.fontMaterial = cardOutlineMat;
                }
            }
        }
开发者ID:dshook,项目名称:centauri-tac,代码行数:93,代码来源:CardsView.cs

示例8: RotatePlayer

 private void RotatePlayer(Transform playerTransform, Vector3 direction)
 {
     //Rotate the player to face direction of movement only when input keys are pressed
     if (Math.Abs(_inputManger.RawHoritzontalAxis) >= .1f
         || Math.Abs(_inputManger.RawVerticalAxis) >= .1f)
     {
         playerTransform.rotation = Quaternion.LookRotation(direction.SetY(0), Vector3.up);
     }
 }
开发者ID:harjup,项目名称:Xyz,代码行数:9,代码来源:Move.cs


注:本文中的Vector3.SetY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。