public static void UpdateAction(ref LChatacterAction curAction, List <LChatacterAction> actions, LChatacterInterface character, LChatacterInformationInterface information) { if (null != curAction) { if (curAction.isFinish(character, information)) { curAction.endAction(character, information); curAction = null; } } LChatacterAction oldAciton = curAction; for (int i = 0, c = actions.Count; i < c; i++) { var a = actions[i]; if ((curAction == null || a.GetPriority() > curAction.GetPriority()) && a.isQualified(curAction, character, information)) { if (character.IsAI()) { if (null != curAction) { Debug.Log(curAction.ToString() + " " + curAction.priority + " " + a.ToString() + " " + a.priority); } } curAction = a; } } if (curAction != oldAciton || (null == curAction)) { if (null != oldAciton) { oldAciton.endAction(character, information); } curAction.beginAction(character, information); } if (null != curAction) { curAction.doAction(character, information); } //beginAction }
public override bool OnTrigger(LCharacterColliderData cdata, Collider other, LChatacterInterface character, LChatacterInformationInterface information) { if (cdata.type == "hit") { LCharacterHitData data = cdata.getData <LCharacterHitData>(); ActionType status = (ActionType)data.value.GetValueInt("status", 0); if (GetActionType() == status) { if (!data.hittedObject.Contains(character.GetId()) && null != data.value) { data.hittedObject.Add(character.GetId()); if (character.IsAI()) { character.AddHaterd(data.characterId, 1); } float slow_motion = data.value.GetValueFloat("slow_motion", 0f); if (data.firstHit) { if (data.cdState == CdState.HIT) { LChatacterInterface chr = information.GetCharacter(data.characterId); chr.updateCDState(data.cdName, data.skillState); } if (slow_motion > 0.0001f) { information.slowly(0.01f, slow_motion); data.firstHit = true; } } Vector3 dir = other.transform.forward; dir.y = 0; dir.Normalize(); SetHitData(data, dir); return(true); } } } return(false); }