本文整理汇总了C#中EnemyController.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyController.GetPosition方法的具体用法?C# EnemyController.GetPosition怎么用?C# EnemyController.GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnemyController
的用法示例。
在下文中一共展示了EnemyController.GetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineNewPosition
public void DetermineNewPosition(EnemyController enemy)
{
foreach (Behaviour iter in behaviours)
{
if(iter.IsTriggered(this))
{
iter.Perform(this);
}
}
if (this.moveDescriptor != this.processedDescriptor)
{
// Reset movement parameters
interpolationTime = 0;
startingPosition = enemy.GetPosition();
// Set Current Processed Descriptor
this.processedDescriptor = this.moveDescriptor;
}
if (enemy.GetPosition() != processedDescriptor.targetPosition)
{
// Update our interpolation time
interpolationTime += Time.deltaTime;
// Use the Animation Curve to determine the progress of the Camera
float totalDistance = Vector3.Distance(startingPosition,
processedDescriptor.targetPosition);
// Ensure no division by zero, fixes jump on boundary when cameras are very similar.
if (totalDistance == 0)
{
enemy.SetPosition(processedDescriptor.targetPosition);
}
else
{
// Determine Progress
lastInterpol = curve.Evaluate(interpolationTime * transitionSpeed / totalDistance);
// Process the movement descriptor
Vector3 newPosition = new Vector3();
// Update the position from the last cameras position
newPosition = Vector3.Lerp(startingPosition,
processedDescriptor.targetPosition,
lastInterpol);
newPosition.y = enemy.transform.position.y;
newPosition.z = enemy.transform.position.z;
enemy.SetPosition(newPosition);
}
}
}