/// <summary> /// 设置速度 /// </summary> private void SetSpeed(int speed) { this.speed = speed; AnimationMesg animationMesg = new AnimationMesg(localAcc, "Speed", false, speed / 9); Dispatch(AreaCode.ANIMATION, AnimationEvent.ANIMATION_SET_FLOAT, animationMesg); }
private void ResetSpeed() { this.speed = defaultSpeed; AnimationMesg animationMesg = new AnimationMesg(localAcc, "Speed", false, 0); Dispatch(AreaCode.ANIMATION, AnimationEvent.ANIMATION_SET_FLOAT, animationMesg); }
void Awake() { Bind(TransformEvent.TRANS_MOVE, TransformEvent.TRANS_POS, TransformEvent.TRANS_SET_SPEED, TransformEvent.TRANS_RESET_SPEED); characterController = GetComponent <CharacterController>(); transformDto = new TransformDto(); animationMesg = new AnimationMesg(); localAcc = PlayerPrefs.GetString("ID"); }
private void SetFloat(AnimationMesg mesg) { if (mesg.Account != this.account) { return; } if (animator == null) { return; } animator.SetFloat(mesg.AnimationName, mesg.FloatValue); }
private void SyncSkillStop(SkillDto dto) { if (dto == null) { return; } switch ((SkillType)dto.SkillType) { case SkillType.FullPower: AnimationMesg mesg = new AnimationMesg(dto.Account, "Speed", false, 0); Dispatch(AreaCode.ANIMATION, AnimationEvent.ANIMATION_SET_FLOAT, mesg); break; default: break; } }
private void SetBool(AnimationMesg mesg) { //Debug.Log("执行AC.SB"); if (mesg.Account != this.account) { return; } if (animator == null) { return; } animator.SetBool(mesg.AnimationName, mesg.BoolValue); //重置停止Walk的计时器 if (mesg.AnimationName == "Walk") { isWalking = mesg.BoolValue; walkTimer = 0f; } }
private void SyncSkill(SkillMesg skillMesg) { if (skillMesg == null) { return; } switch (skillMesg.Type) { case SkillType.FullPower: AnimationMesg mesg = new AnimationMesg(skillMesg.Account, "Speed", false, 1); Dispatch(AreaCode.ANIMATION, AnimationEvent.ANIMATION_SET_FLOAT, mesg); EffectMesg effectMesg = new EffectMesg(skillMesg.gameObject, EffectType.Skill_Fullpower); Dispatch(AreaCode.EFFECT, EffectsEvents.SHOW_EFFECTS, effectMesg); break; default: break; } }
private void OnTriggerEnter(Collider other) { if (IsLocalPlayer) { string tag = other.gameObject.tag; switch (tag) { case "Bullet": curBullet = other.GetComponent <BulletBase>(); if (curBullet.Account == account) { return; } damageMesg.Change(curBullet.Account, curBullet.Damage); Dispatch(AreaCode.GAME, GameEvent.GAME_REDUCE_HP, damageMesg); break; case "Props": PickUpProps(other.GetComponent <PropsBase>().PropsType, other.GetComponent <PropsBase>()); break; default: break; } } switch (other.gameObject.tag) { case "Bullet": AnimationMesg animationMesg = new AnimationMesg(account, "Damage", true); Dispatch(AreaCode.ANIMATION, AnimationEvent.ANIMATION_SET_BOOL, animationMesg); break; case "Props": ShowPropsEffects(other.gameObject); break; default: break; } }
void Awake() { Bind(GameEvent.GAME_PLAYER_ADD, GameEvent.GAME_PLAYER_SPAWN, GameEvent.GAME_SYNC_TRANS, GameEvent.GAME_PLAYER_EXIT, GameEvent.GAME_UPLOAD_TRANS, GameEvent.GAME_SYNC_HP, GameEvent.GAME_SYNC_HG, GameEvent.GAME_SYNC_KILL, GameEvent.GAME_SYNC_INFO, GameEvent.GAME_REDUCE_HP, GameEvent.GAME_AUGMENT_HP, GameEvent.GAME_PLAYER_DEATH, GameEvent.GAME_CREAT_PROPS, GameEvent.GAME_REMOVE_PROPS, GameEvent.GAME_REMOVE_PROPS_SEND, GameEvent.GAME_DOSKILL, GameEvent.GAME_STOPSKILL, GameEvent.GAME_REDUCE_HG, GameEvent.GAME_AUGMENT_HG ); localAcc = PlayerPrefs.GetString("ID"); smg = new SocketMessage(); animationMesg = new AnimationMesg(); hpDto = new HpDto(); hgDto = new HgDto(); infoDto = new InfoDto(); }