public Vector3 HandleFear(float fear, FearReaction response, Vector3 from) { if (isPaniced) { return(root.position); } var fromPosition = house.TranslatePosition(from); var myPosition = house.TranslatePosition(root.position); var isInSameRoom = myPosition == fromPosition; var level = levelMap[response]; var factor = isInSameRoom ? level.sameRoomFactor : level.nextRoomFactor; currentFear = Mathf.Min(maxFear, currentFear + factor * fear); Debug.Log(currentFear + " " + maxFear); if (currentFear >= maxFear) { Debug.Log("panic!"); isPaniced = true; OnPanic?.Invoke(this); return(house.GetEntrance()); } return(responseActions[response](from)); }
//处理服务器异常断开连接消息 private static void HandlePanic(ResultHead head) { SetStatus(ClientStatus.Stopped); OnPanic?.Invoke(head); }
public static void Panic(string message, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) => OnPanic?.Invoke(message, file, line);