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


C# Environment.setCarriedStone方法代码示例

本文整理汇总了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
                    {

//.........这里部分代码省略.........
开发者ID:scauglog,项目名称:sma_mogre,代码行数:101,代码来源:Ninja.cs


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