本文整理汇总了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;
}
}
示例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));
}
示例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);
}
示例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);
}
示例5: LookAt
public void LookAt(Vector3 vector3)
{
playerMesh.LookAt(vector3.SetY(playerMesh.position.y));
}
示例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;
}
示例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;
}
}
}
示例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);
}
}