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


C# CharacterState.GetType方法代码示例

本文整理汇总了C#中CharacterState.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CharacterState.GetType方法的具体用法?C# CharacterState.GetType怎么用?C# CharacterState.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CharacterState的用法示例。


在下文中一共展示了CharacterState.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnUpdate

    public override void OnUpdate(CharacterState owner)
    {

#if UNITY_EDITOR || UNITY_STANDALONE
            owner.transform.position += owner.transform.forward * Time.deltaTime * speed;
#else //Server AI Logic

        accumTime += Time.deltaTime;
        if (accumTime > updateAccumTime)
        {
            if (owner.GetType() == typeof(MonsterCharacter))
            {
                MonsterCharacter monster = (MonsterCharacter)owner;
                monster.SetStateIdle();
            }

            //Console.WriteLine("AIStateWalk.OnUpdate");
            accumTime = 0.0f;
        }
        else
        {
            //owner.PosZ += speed * Time.deltaTime;
            //Vector3.Forward of XnaGeometry is -Z 
            //so you should  multiply -1 for serverside code
            owner.transform.position += owner.transform.forward * Time.deltaTime * speed;
        }
#endif

    }
开发者ID:kimha578,项目名称:jwUnityStudy,代码行数:29,代码来源:AIStateWalk.cs

示例2: OnUpdate

    public override void OnUpdate(CharacterState owner)
    {
        accumTime += Time.deltaTime;
        if (accumTime > 3.0f)
        {            
            if(owner.GetType() == typeof(MonsterCharacter))
            {
                MonsterCharacter monster = (MonsterCharacter)owner;
                monster.SetStateIdle();
            }

            //Console.WriteLine("AIStateWalk.OnUpdate");
            accumTime = 0.0f;
        }
    }
开发者ID:kimha578,项目名称:jwUnityStudy,代码行数:15,代码来源:AIStateWalk.cs

示例3: OnEnter

    //Vector3 targetPos ;
    public override void OnEnter(CharacterState owner)
    {
        base.OnEnter(owner);        
        accumTime = 0.0f;
#if UNITY_EDITOR || UNITY_STANDALONE
        Debug.Log("AIStateWalk.OnEnter");
#else         //Server Logic
        uint uniqueID = 0;
        if (owner.GetType() == typeof(MonsterCharacter))
        {
            uniqueID = ((MonsterCharacter)owner).UniqueID;
        }


        Random random = new Random((int)DateTime.Now.Ticks + (int)uniqueID);
        
        float x = 0.5f - (float)random.NextDouble();
        float y = 0.0f;// (float)random.NextDouble();
        float z = 0.5f - (float)random.NextDouble();
        Vector3 dir;
        dir.X = x;
        dir.Y = y;
        dir.Z = z;
        dir = Vector3.Normalize(dir);
        owner.transform.forward = dir;

        //update AccumTime
        updateAccumTime = MIN_UPDATE_ACCUMTIME + (float)random.NextDouble() * (MAX_UPDATE_ACCUMTIME - MIN_UPDATE_ACCUMTIME);       


        //Console.WriteLine(string.Format("{0} AIStateWalk.OnEnter:{1} ", uniqueID,  dir.ToString()));
        
        GameServer.Program.SendToAllClient_MonsterState(owner,this);
#endif

    }
开发者ID:kimha578,项目名称:jwUnityStudy,代码行数:37,代码来源:AIStateWalk.cs


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