• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CharacterState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Aim

 public void Aim()
 {
     if (snowBallInstanceScript != null) {
         snowBallInstanceScript.Aim ();
     }
     state = CharacterState.IS_AIMING;
 }
开发者ID:technerdlove,项目名称:SnowBallZ,代码行数:7,代码来源:Controller.cs


示例2: OnDeserialize

    private CharacterState serverLastState; //SERVER: Store last state

    #endregion Fields

    #region Methods

    /// <summary>
    /// All Clients: Deserialize the state from network
    /// </summary>
    /// <param name="reader"></param>
    /// <param name="initialState"></param>
    public override void OnDeserialize(NetworkReader reader, bool initialState)
    {
        CharacterState state = new CharacterState();

        state.state    = reader.ReadInt32();
        state.position = reader.ReadVector3();
        state.rotation = reader.ReadQuaternion();

        //Client: Received a new state for the local player, treat it as an ACK and do reconciliation
        if (isLocalPlayer) {
            SendMessage("ServerState", state, SendMessageOptions.DontRequireReceiver);
        } else {
            //Other Clients: Received a state, treat it like a new position snapshot from authority
            if (initialState)
            {
                //Others Clients: First state, just snap to new position
                transform.position = state.position;
                transform.rotation = state.rotation;
            }
            else if (networkInterpolation != null)
            {
                //Others Clients: Interpolate between received positions
                networkInterpolation.ReceiveState(state);
            }
        }
    }
开发者ID:atrakeur,项目名称:unity-unet-authoritative-networking,代码行数:37,代码来源:CharacterNetworkSync.cs


示例3: AddState

 public virtual void AddState(CharacterState state)
 {
     bool changed = (this._state & state) != state;
     if (changed)
     {
         this._state |= state;
         switch (state)
         {
             case CharacterState.OnGround:
                 this.RemoveState(CharacterState.OnJump);
                 break;
             case CharacterState.OnJump:
                 this.RemoveState(CharacterState.OnGround);
                 this.RemoveState(CharacterState.OnWall);
                 break;
             case CharacterState.Initialized:
             case CharacterState.OnWall:
             case CharacterState.Shooting:
             case CharacterState.Damage:
             default:
                 break;
         }
         this.OnStateChange(state, true);
     }
 }
开发者ID:temdisponivel,项目名称:Megaman,代码行数:25,代码来源:CharacterController2D.cs


示例4: SetCharacterStateUI

	public void SetCharacterStateUI(CharacterState characterState){
		switch(characterState){
		case CharacterState.FULL:
			spriteRenderer.sprite = _characterSprite[3];
			emotionRenderer.sprite = _emotionSprite[3];
			SetEmotionScaleRate(0.005f);
			_hungerLevelBar.mainTexture = _hungerBar[(int)HungerBarState.HUNGER_BAR_100];
			break;
		case CharacterState.SATISFIED:
			spriteRenderer.sprite = _characterSprite[2];
			emotionRenderer.sprite = _emotionSprite[2];
			SetEmotionScaleRate(0.006f);
			_hungerLevelBar.mainTexture = _hungerBar[(int)HungerBarState.HUNGER_BAR_60];
			break;
		case CharacterState.HUNGRY:
			spriteRenderer.sprite = _characterSprite[1];
			emotionRenderer.sprite = _emotionSprite[1];
			SetEmotionScaleRate(0.008f);
			_hungerLevelBar.mainTexture = _hungerBar[(int)HungerBarState.HUNGER_BAR_30];
			break;
		case CharacterState.DYING:
			spriteRenderer.sprite = _characterSprite[0];
			emotionRenderer.sprite = _emotionSprite[0];
			SetEmotionScaleRate(0.012f);
			_hungerLevelBar.mainTexture = _hungerBar[(int)HungerBarState.HUNGER_BAR_0];
			break;
		default:
			break;
		}
	}
开发者ID:justin-ou,项目名称:Stay-Alive,代码行数:30,代码来源:CharacterUI.cs


示例5: Awake

 // Use this for initialization
 void Awake()
 {
     CS = CharacterState.Idle;
     tr = GetComponent<Transform> ();
     ani = GameObject.Find ("Character1").GetComponent<Animation> ();
     GetComponent<Rigidbody> ().WakeUp ();
 }
开发者ID:Kimsanggu,项目名称:Maze,代码行数:8,代码来源:PlayerCtrl.cs


示例6: AddState

 public void AddState(CharacterState state)
 {
     if (dictionary.ContainsKey(state.Name) || dictionary.ContainsValue(state))
         return;
     list.Add(state);
     dictionary.Add(state.Name, state);
 }
开发者ID:Worlaf,项目名称:BAnimator,代码行数:7,代码来源:CharacterStateManager.cs


示例7: OnEnter

    public override void OnEnter(CharacterState owner)
    {
        base.OnEnter(owner);


        UnityEngine.Debug.Log("StateAttack.OnEnter");
    }
开发者ID:kimha578,项目名称:jwUnityStudy,代码行数:7,代码来源:StateAttack.cs


示例8: Awake

	void Awake()
	{
		coords = new int[2];
		lastCoords = new int[2];
		canSee = new List<Player> ();
		m_AttackAxisInUse = false; 
		tr = transform;
		CombatMode = false; 
		pos = transform.position;
		currentPath = new List<Vector2> ();
		controller = GetComponent<PlayerController>();
		workingAI = new AIBase (this);
		lastInput = Vector3.one;
		playerStats = new PlayerStats (); 
		currentState = CharacterState.Still;
		controller.SetSpeed (playerStats.GetSpeed());
		isStuck = 0;
		canAttack = "Enemy";
		coolDownLimit = playerStats.GetAttackCooldown();
		currentAttackCoolDown = 0; 
		inventory = GetComponent<InventoryBase>();
		weaponController = GetComponentInChildren<WeaponController> ();
		anim = GetComponent<Animator>(); 
		spriteRen = GetComponent<SpriteRenderer> ();
		//seeker = GetComponent<Seeker> (); 

	}
开发者ID:JackUnthank,项目名称:Portfolio,代码行数:27,代码来源:Player.cs


示例9: CharacterAnimationEvent

	/// <summary>
	/// Respond to an animation event.
	/// </summary>
	/// <param name='state'>
	/// State.
	/// </param>
	/// <param name='previousState'>
	/// Previous state.
	/// </param>
	public void CharacterAnimationEvent (CharacterState state, CharacterState previousState) {
		currentState = state;
		this.previousState = previousState;
		transform.localPosition = rootOffset;
		switch (state) {
			case CharacterState.IDLE: Idle(previousState); break;	
			case CharacterState.WALKING: Walk(); break;	
			case CharacterState.RUNNING: Run(); break;	
			case CharacterState.SLIDING: Slide(); break;	
			case CharacterState.JUMPING: Jump(); break;	
			case CharacterState.AIRBORNE: Airborne(); break;	
			case CharacterState.FALLING: Fall(); break;	
			case CharacterState.DOUBLE_JUMPING: Jump(); break;	
			case CharacterState.WALL_JUMPING: Jump(); break;	
			case CharacterState.HOLDING: Hold(previousState); break;	
			case CharacterState.CLIMBING: Climb(); break;	
			case CharacterState.CLIMB_TOP_OF_LADDER_UP: ClimbTopUp(); break;	
			case CharacterState.CLIMB_TOP_OF_LADDER_DOWN: ClimbTopDown(); break;	
			case CharacterState.LEDGE_HANGING: LedgeHang(); break;
			case CharacterState.LEDGE_CLIMBING: LedgeClimb(); break;
			case CharacterState.LEDGE_CLIMB_FINISHED: Idle (previousState); break;
			case CharacterState.ROPE_CLIMBING: RopeClimb(); break;
			case CharacterState.ROPE_SWING: RopeSwing();break;
			case CharacterState.ROPE_HANGING: RopeHang();break;
			case CharacterState.WALL_SLIDING: WallSlide(); break;
			case CharacterState.CROUCHING: Crouch(); break;
			case CharacterState.CROUCH_SLIDING: CrouchSlide(); break;
			case CharacterState.STUNNED: Stunned(previousState); break;
			case CharacterState.PUSHING: Push(); break;
			case CharacterState.PULLING: Pull(); break;
		}
	}
开发者ID:devNaroo,项目名称:2DWalker,代码行数:41,代码来源:HeroAnimator2D.cs


示例10: FollowAction

    public FollowAction(GameObject actor, GameObject targetCharacter, float maximumDistance, float minimumDistance, Reason reason, bool canStartDialogueWithAgents)
        : base(actor)
    {
        InitInteractionInfo(true, canStartDialogueWithAgents);

        this.targetCharacter = targetCharacter;
        this.targetCharacterState = (CharacterState)targetCharacter.GetComponent("CharacterState");
        this.maximumDistance = maximumDistance;
        this.minimumDistance = minimumDistance;
        this.reason = reason;
        switch(reason) {
            case Reason.SEX:
                targetCharacterState.SetTask(CharacterState.Task.SEX, actor);
                TaskHelp.ShowHelp(TaskHelp.SEX, actor);
                break;
            case Reason.DANCE:
                targetCharacterState.SetTask(CharacterState.Task.DANCE, actor);
                TaskHelp.ShowHelp(TaskHelp.DANCE, null);
                break;
            case Reason.POKER_WITHOUT_MONEY:
                targetCharacterState.SetTask(CharacterState.Task.POKER, actor);
                TaskHelp.ShowHelp(TaskHelp.POKER, null);
                break;
            case Reason.POKER_WITH_MONEY:
                targetCharacterState.SetTask(CharacterState.Task.POKER, actor);
                TaskHelp.ShowHelp(TaskHelp.POKER, null);
                break;
            case Reason.DRINK:
                targetCharacterState.SetTask(CharacterState.Task.DRINK, actor);
                TaskHelp.ShowHelp(TaskHelp.DRINK, actor);
                break;
        }
        ending = false;
    }
开发者ID:kiichi7,项目名称:Lies_and_Seductions,代码行数:34,代码来源:FollowAction.cs


示例11: Awake

 //    Camera myCam = GameObject.Find("_cameraMain");
 // Use this for initialization
 void Awake()
 {
     animation = GetComponent<Animation> ();
     contr = GetComponent<PlayerController>();
     _state = CharacterState.Idle;
     //		myCamera = GameObject.Find ("_cameraMain").camera;
 }
开发者ID:rbtk,项目名称:photon-test,代码行数:9,代码来源:NetworkPlayer.cs


示例12: SendToAllClient_MonsterState

        public static void SendToAllClient_MonsterState(CharacterState character, State state)
        {
            Packet.GCAckMonsterState packet = new Packet.GCAckMonsterState();
            packet.uniqueID = ((MonsterCharacter)character).UniqueID;
            packet.typeID = 1;//
            packet.state = state.ID;
            packet.posX = character.transform.position.X.ToString();
            packet.posY = character.transform.position.Y.ToString();
            packet.posZ = character.transform.position.Z.ToString();
            packet.dirX = character.transform.forward.X.ToString();
            packet.dirY = character.transform.forward.Y.ToString();
            packet.dirZ = character.transform.forward.Z.ToString();

            string jsonPacket = JsonMapper.ToJson(packet);

            try
            {
                lock (GameServer.Program.ms_ClientList)
                {
                    foreach (GameServer.UserObject obj in GameServer.Program.ms_ClientList)
                    {
                        obj.Send(jsonPacket);
                    }
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
开发者ID:pdjack,项目名称:jwUnityStudy,代码行数:30,代码来源:Program.cs


示例13: 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


示例14: SetSpeed

 public void SetSpeed(float speed)
 {
     this.speed = speed;
     if(!crouch)
     {
         if(speed > minimumRunSpeed) {
             //SendMessage("SetWalk", false, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Running;
         } else if(speed > minimumWalkSpeed) {
             //SendMessage("SetWalk", true, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Walking;
         } else {
             //SendMessage("SetIdle", true, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Idle;
         }
     } else {
         if(speed > minimumRunSpeed) {
             //SendMessage("SetCrouch", true, SendMessageOptions.DontRequireReceiver);
             //SendMessage("SetWalk", false, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Walking_crouch;
         } else if(speed > minimumWalkSpeed) {
             //SendMessage("SetCrouch", true, SendMessageOptions.DontRequireReceiver);
             //SendMessage("SetWalk", true, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Walking_crouch;
         } else {
             //SendMessage("SetCrouch", true, SendMessageOptions.DontRequireReceiver);
             //SendMessage("SetIdle", true, SendMessageOptions.DontRequireReceiver);
             _characterState = CharacterState.Idle_crouch;
         }
     }
 }
开发者ID:rmkeezer,项目名称:fpsgame,代码行数:31,代码来源:AINetworkAnimation.cs


示例15: CharacterActionSet

 public CharacterActionSet(string n, CharacterState s, CharacterActionSetChangeFactor f, object o)
 {
     animname = n;
     state = s;
     switch (f)
     {
         case CharacterActionSetChangeFactor.AnimationCompleted:
             break;
         case CharacterActionSetChangeFactor.ArriveTarget:
             target = (Vector2)o;
             break;
         case CharacterActionSetChangeFactor.Time:
             duration = (double)o;
             break;
         case CharacterActionSetChangeFactor.ArriveAttackTarget:
             interactive = (Character)o;
             break;
         case CharacterActionSetChangeFactor.ArriveInteractiveTarget:
             interactive = (Character)o;
             break;
         case CharacterActionSetChangeFactor.EffectCompleted:
             effectname = (string)o;
             break;
     }
     factor = f;
  
 }
开发者ID:secondage,项目名称:projXdemo_wp7,代码行数:27,代码来源:Character.cs


示例16: Awake

 public virtual void Awake()
 {
     _character = GetComponent<CharacterState>();
     _sprite = GetComponent<Sprite>();
     _transform = this.transform;
     _collisionHandler = GetComponent<AbstractCollisionHandler>();
 }
开发者ID:whtt-eric,项目名称:cooper-prototypes,代码行数:7,代码来源:AbstractCharacterController.cs


示例17: AbstractAction

    public AbstractAction(GameObject actor)
    {
        this.actor = actor;

        state = actor.GetComponent(typeof(CharacterState)) as CharacterState;
        animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
        mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover;
        actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner;

        animationName = null;
        wrapMode = WrapMode.Once;
        emotionBodyParts = Emotion.BodyParts.NONE;

        canStartDialogueWithPC = true;
        canStartDialogueWithAgents = true;
        canEndAnyTime = true;
        //canCancelDuringMovement = true;

        quickReaction = null;
        moveToAction = null;

        started = false;
        endedASAP = false;
        endNextRound = false;

        finished = false;
    }
开发者ID:kiichi7,项目名称:Lies_and_Seductions,代码行数:27,代码来源:AbstractAction.cs


示例18: FixedUpdate

	protected void FixedUpdate()
	{
		this.forcesVec = Vector3.zero;
		this.moveVec = Vector3.zero;
		forcesVec += this.Gravity();
		forcesVec += this.Forces();

		Vector3 scale = transform.localScale;

		this.transform.localScale = scale;

		if (this.state != CharacterState.Attacking && this.state != CharacterState.Stunned && this.state != CharacterState.Dying)
		{
			var flags = controller.Move(forcesVec * Time.fixedDeltaTime);
			grounded = (flags & CollisionFlags.CollidedBelow) != 0;

			if (this.moveVec.z == 0 && forcesVec.z == 0 && this.moveVec.x == 0 && forcesVec.x == 0)
			{
				this.state = CharacterState.Standing;
			}
			else
			{
				this.state = CharacterState.Moving;
			}
		}
		else if (this.state == CharacterState.Stunned)
		{
			this.stunned = true;
			StartCoroutine(this.WaitForStun());
		}
	}
开发者ID:keyward,项目名称:Zombie-Prototype,代码行数:31,代码来源:Character.cs


示例19: Character

 public Character()
 {
     this.isDead = false;
     this.currentState = CharacterState.IDLE;
     this.lastState = currentState;
     this.childObjects = new List<GameObject>();
     health = healthMaximum;
 }
开发者ID:wuwenhuang,项目名称:RobotContra,代码行数:8,代码来源:Character.cs


示例20: Fall

 // End a jump and transition to a falling state (ignore if already grounded)
 void Fall()
 {
     if (controller.Grounded)
     {
         return;
     }
     state = CharacterState.Falling;
 }
开发者ID:nguyensitien,项目名称:SGICollab,代码行数:9,代码来源:AnimationController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CharacterStats类代码示例发布时间:2022-05-24
下一篇:
C# CharacterMotor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap