本文整理汇总了C#中System.Environment.setCarriedStone方法的典型用法代码示例。如果您正苦于以下问题:C# Environment.setCarriedStone方法的具体用法?C# Environment.setCarriedStone怎么用?C# Environment.setCarriedStone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Environment
的用法示例。
在下文中一共展示了Environment.setCarriedStone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: move
public override void move(FrameEvent evt, Environment env)
{
Stone stoneTarget = null;
if (state == "free")
{
stoneTarget = findTarget(env);
}
if (!mWalking && mAnimationState.HasEnded)
{
mAnimationState.Enabled = false;
mAnimationState = ent.GetAnimationState("Walk");
mAnimationState.Loop = true;
mAnimationState.Enabled = true;
mWalking = true;
}
#region has a stone target
if (stoneTarget != null)
{
//mWalking = false;
mDestination = mWalkList.First.Value;
mDirection = mDestination - Node.Position;
mDistance = mDirection.Normalise();
float move = (MWalkSpeed*walkSpeedFactor) * evt.timeSinceLastFrame;
mDistance -= move;
if (mDistance <= 0.2f)
{
mAnimationState = ent.GetAnimationState("Backflip");
mAnimationState.Enabled = true;
mAnimationState.Loop = false;
mWalking = false;
stoneTarget.Node.Parent.RemoveChild(stoneTarget.Node);
node.AddChild(stoneTarget.Node);
stoneTarget.Node.Position = new Vector3(0, 200, 0);
//must set stone to unavailable
mWalkList.RemoveFirst();
mWalkList.AddFirst(castle);
this.state = "stone";
env.setCarriedStone(carriedStoneName);
}
if (env.outOfGround(Node.Position))
{
//set our node to the destination we've just reached & reset direction to 0
Node.Position = lastPosition;
mDirection = Vector3.ZERO;
mWalking = false;
}
else
{
lastPosition = Node.Position;
//Rotation code goes here
Vector3 src = Node.Orientation * forward;
if ((1.0f + src.DotProduct(mDirection)) < 0.0001f)
{
Node.Yaw(180.0f);
}
else
{
Quaternion quat = src.GetRotationTo(mDirection);
Node.Rotate(quat);
}
//movement code goes here
Node.Translate(mDirection * move);
}
//Update the Animation State.
mAnimationState.AddTime(evt.timeSinceLastFrame * (MWalkSpeed*walkSpeedFactor) / 20);
}
#endregion
#region carry a stone
else if (state == "stone")
{
mDestination = mWalkList.First.Value;
mDirection = mDestination - Node.Position;
mDistance = mDirection.Normalise();
float move = MWalkSpeed * evt.timeSinceLastFrame;
mDistance -= move;
if (mDistance <= 0.2f)
{
mWalkList.RemoveFirst();
mAnimationState = ent.GetAnimationState("Backflip");
mAnimationState.Enabled = true;
mAnimationState.Loop = false;
mWalking = false;
try
{
Node temp = node.GetChild("stoneNode"+carriedStoneName);
//node.RemoveChild(0);
node.RemoveAllChildren();
node.Parent.AddChild(temp);
temp.Position = node.Position;
env.setUncarriedStone(carriedStoneName);
}
catch
{
//.........这里部分代码省略.........