//private Dictionary<> private void InitProps() { actorProp = new PropsBase(1, 1, 1f, 1f, 1f); UpdateAllMuscles(); updateProps(actorProp); UpdateStateProps(); }
public void SetValue(PropsBase pb2) { Accuracy = pb2.Accuracy; Agility = pb2.Agility; Power = pb2.Power; Toughness = pb2.Toughness; Tolerance = pb2.Tolerance; }
public void UpdateTolerance(PropsBase ap) { float knockOutDist = (ap.Tolerance + (ap.Tolerance * curProp.Tolerance)) * stateProp.Tolerance; muscleBasePropsGroup.props.knockOutDistance = knockOutDist; updateEntry(UpdateTolerance, false); }
protected void UpdateAccuracy(PropsBase ap) { float muscleWeight = (ap.Accuracy + (ap.Accuracy * curProp.Accuracy)) * stateProp.Accuracy; foreach (Muscle m in muscleGroup.muscles) { m.props.muscleWeight = muscleWeight; } // PropHandler ph = muscleGroup.propHandler; // if (ph && ph.currentProp) for(int i = 0; i < ph.muscles.Length; i++) { ph.muscles[i].props.muscleWeight = muscleWeight * ph.currentProp.muscleWeights[i]; } updateEntry(UpdateAccuracy, false); }
protected void UpdateToughness(PropsBase ap) { float immunity = (ap.Toughness + (ap.Toughness * curProp.Toughness)) * stateProp.Toughness; foreach (Muscle m in muscleGroup.muscles) { m.state.immunity = immunity; } // PropHandler ph = muscleGroup.propHandler; // if (ph && ph.currentProp) for (int i = 0; i < ph.muscles.Length; i++) { ph.muscles[i].state.immunity = immunity * ph.currentProp.muscleWeights[i]; } updateEntry(UpdateToughness, false); }
protected void UpdatePower(PropsBase ap) { float impulseMlp = (ap.Power + (ap.Power * curProp.Power)) * stateProp.Power; foreach (Muscle m in muscleGroup.muscles) { m.state.impulseMlp = impulseMlp; } // PropHandler ph = muscleGroup.propHandler; // if (ph && ph.currentProp) for (int i = 0; i < ph.muscles.Length; i++) { ph.muscles[i].state.impulseMlp = impulseMlp * ph.currentProp.muscleWeights[i]; } updateEntry(UpdatePower, false); }
/// <summary> /// 设置数据 /// </summary> /// <param name="propsBase"></param> public void SetProps(PropsBase propsBase) { var t = propsBase as T; if (t == null) { BDebug.LogError("类型转换失败:" + propsBase.GetType().Name); } else { this.SetProps(t); } }
public void UpdateStateProps() { Global.MuscleGroupStateProps mgs = am.actorParts.GetStateProp(actionState); foreach (var groupProp in baseProps) { PropsBase pb = mgs.GetGroupProp(groupProp.MscleGroup); if (pb != null) { groupProp.stateProp.SetValue(pb); } } // StopAllCoroutines(); // StartCoroutine(PropSetCoroutine(1f, mgs)); }
public GroupProp(ActorParts.MuscleGroup muscleGroup, UpdateEntry v) { curProp = new PropsBase(0, 0, 0, 0, 0); buffProp = new VisibleProp(this, 0, 0, 0, 0, 0); equipProp = new VisibleProp(this, 0, 0, 0, 0, 0); //print(muscleBasePropsGroup.props.knockOutDistance); stateProp = new UnVisibleProp(this, 1, 1, 1, 1, 0.1f); this.muscleGroup = muscleGroup; Muscle m = muscleGroup.muscles[0]; name = muscleGroup.groupName; this.updateEntry = v; }
// 携程方式 逐渐过渡式地改变 肌肉属性 // TODO 测试 是否可去 private IEnumerator PropSetCoroutine(float time, Global.MuscleGroupStateProps mgs) { float curF = 0; PropsBase pbtemp = new PropsBase(0, 0, 0, 0, 0); while (curF < 1.0) { foreach (var groupProp in baseProps) { PropsBase pb = mgs.GetGroupProp(groupProp.MscleGroup); if (pb != null) { pbtemp.Accuracy = Mathf.Lerp(groupProp.stateProp.Accuracy, pb.Accuracy, curF); pbtemp.Agility = Mathf.Lerp(groupProp.stateProp.Agility, pb.Agility, curF); pbtemp.Power = Mathf.Lerp(groupProp.stateProp.Power, pb.Power, curF); pbtemp.Toughness = Mathf.Lerp(groupProp.stateProp.Accuracy, pb.Toughness, curF); groupProp.stateProp.SetValue(pbtemp); } } curF += Time.deltaTime; yield return(new WaitForEndOfFrame()); } foreach (var groupProp in baseProps) { PropsBase pb = mgs.GetGroupProp(groupProp.MscleGroup); if (pb != null) { pbtemp.Accuracy = Mathf.Lerp(groupProp.stateProp.Accuracy, pb.Accuracy, 1.0f); pbtemp.Agility = Mathf.Lerp(groupProp.stateProp.Agility, pb.Agility, 1.0f); pbtemp.Power = Mathf.Lerp(groupProp.stateProp.Power, pb.Power, 1.0f); pbtemp.Toughness = Mathf.Lerp(groupProp.stateProp.Accuracy, pb.Toughness, 1.0f); groupProp.stateProp.SetValue(pbtemp); } } }
/// <summary> /// 拾取道具 /// </summary> private void PickUpProps(PropsType propsType, PropsBase props) { switch (propsType) { case PropsType.Cure: Cure cure = props as Cure; if (cure != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_CURE, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HP, cure.Value); //给玩家加血 Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, cure.id); //移除道具 } break; case PropsType.Food: Food food = props as Food; if (food != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_FOOD, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HG, food.value); Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, food.id); } break; case PropsType.Arms: Arm arm = props as Arm; if (arm != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_ARM, Camera.main.transform.position); PickUpArms(arm); } break; default: break; } }