本文整理汇总了C#中Field.getSuccessor方法的典型用法代码示例。如果您正苦于以下问题:C# Field.getSuccessor方法的具体用法?C# Field.getSuccessor怎么用?C# Field.getSuccessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field.getSuccessor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start ()
{
// Initiate Enemy
RaycastHit raycastHit;
if (Physics.Raycast(new Ray(transform.position, Physics.gravity), out raycastHit))
{
GameObject gameObject = raycastHit.transform.gameObject;
if (gameObject)
{
Field field = gameObject.GetComponent<Field>();
if (field)
{
currField = field;
nextField = currField.getSuccessor();
endDirection = nextField.transform.position - currField.transform.position;
startDirection = endDirection; //wartosc umowna, moze wymyslimy lepiej z poprzednika;
endPosition = (currField.transform.position + nextField.transform.position)
* 0.5f + new Vector3(0f, offsetY, 0f);
startPosition = endPosition - endDirection;
currentPercentOfField = 0.5f;
}
}
}
previousStepPhyramidHeight = Pyramid.singleton.transform.position.y;
}
示例2: Update
// Update is called once per frame
void Update ()
{
if (this.currField.onPyramid)
{
Vector3 delta = new Vector3(0.0f, Pyramid.singleton.transform.position.y
- previousStepPhyramidHeight, 0.0f);
startPosition = startPosition + delta;
endPosition = endPosition + delta;
previousStepPhyramidHeight = Pyramid.singleton.transform.position.y;
}
previousStepPhyramidHeight = Pyramid.singleton.transform.position.y;
float deltaPercentOfPole = speed * Time.deltaTime;
if (currField.isStairs)
{
deltaPercentOfPole *= 0.5f;
}
currentPercentOfField += deltaPercentOfPole;
if (currentPercentOfField > 1.0f)
{
currentPercentOfField = currentPercentOfField - 1.0f;
startDirection = endDirection;
startPosition = endPosition;
currField = nextField;
nextField = currField.getSuccessor();
endPosition = (currField.transform.position + nextField.transform.position) * 0.5f
+ new Vector3(0f, offsetY, 0f);
endDirection = nextField.transform.position - currField.transform.position;
if (nextField.isStairs) //jesli to schody
{
endPosition.y = startPosition.y;
//endDirection.y = 0.0f;
}
else if (currField.isStairs)
{
endPosition.y = nextField.transform.position.y + 0.75f;
//startDirection = endPosition - startPosition;
endDirection = endPosition - startPosition;
}
}
Vector3 currentDirection;
if (!this.currField.isStairs)
{
Vector3 midPoint = startPosition + startDirection * 0.5f;
Vector3 newPosition =
startPosition * (1f - currentPercentOfField) * (1f - currentPercentOfField) +
midPoint * 2f * (1f - currentPercentOfField) * currentPercentOfField +
endPosition * currentPercentOfField * currentPercentOfField;
if (this.isHumanoid)
{
newPosition.y = Mathf.Lerp(startPosition.y, endPosition.y, currentPercentOfField);
}
this.transform.position = newPosition;
}
else
{
this.transform.position = Vector3.Lerp(startPosition,endPosition,currentPercentOfField);
}
currentDirection = Vector3.Lerp(startDirection, endDirection, currentPercentOfField);
if (nextField.isStairs)
{
currentDirection.y = startDirection.y;
const float threshold = 0.6f;
if(currentPercentOfField > threshold)
{
currentDirection.y = Mathf.Lerp(startDirection.y, endDirection.y,
(currentPercentOfField - threshold) / (1f - threshold));
}
}
if (this.isHumanoid)
{
currentDirection.y = 0.0f;
}
this.transform.LookAt(this.transform.position + currentDirection);
// this.transform.position = startPosition + startDirection*
// Vector3.Lerp(startPosition, endPosition, currentPercentOfPole);//startPosition + Vector3.Lerp(startDirection, endDirection, currentPercentOfPole);
//.........这里部分代码省略.........