dir = new Vector2Int(Mathf.Clamp)
dir = new Vector2Int(Mathf.Clamp)
wo jiu
英语发音稍微有点迷哈哈哈,sderp笑死我了
没看之前,单独写出来了
AddTransition少写了return、;状态中act和Reson没调用。
if(){
float goffset;
if(Math.Abs(direction[i,0])+Math.Abs(direction[i,1]>1){
goffset = 1.4f;
}else{
goffset = 1;
}
if(tempData.g>data.g+goffset)
{
tempData.g = data.g + goffset;
tempData.parent = data;
}
}else{
goffset = 1.4f;
}else{
goffset = 1;
}
double h = HFun(newPoint);
PointData newData = new PointData(newPoint,data.g+goffset,h,data)
openList.Add(newData);
for()
List<PointData>openList = new List<PointData>();
openList.Add(new PointData(START_PNT,0,0,null));
PointData endPoint = null
for(bool finish = false;!finish&&openList.Count>0;)
{
openList.Sort((x,y)=>{return x.F().CompareTo(y.F());});//最小在上最大在下,降序排列
PointData data = openList[0];
openList.RemoveAt(0);//最小值从开列表去除
Point point = data.point;
if(MAP[point.x,point.y] == SPACE)
{
MAP[point.x,point.y] = VISITED;
}
for(int i = 0;i<directs.Rank;i++){
Point newPoint = new Point(point.x+directs[i,0],point.y+directs[i,1]);
if(newPnt.x>=0&&newPnt.x<MAX_PNT.x&&newPnt.y>=0&&newPnt.y<MAX_PNT.y){
char e = MAP[newPoint.x,newPoint.y];
if(e == END){
endPoint = data;
finish = true;
break;
}
if(e!=SPACE){
continue;
}
//扩展后的点若在开表终则更新g值
PointData tempData = openList.Find((x=>{return x.point.Equals(newPoint);}));
if(tempData!=null){
}
}
}
}
private static double H(Point pnt)
{
return HManhattanDistance(pnt);
}
if(Inout.GetMosueButton(0))
{
player.transform.GetChild(0),transform.position+=new Vector3(Input.GetAxis("Mouse X"),0,0);
}
-2
Float DirX,DirY
IdleBlendTree->2DsimpleDirectional
Motion->01,0-1,-10,10,-11,11,-1-1,1-1
MoveBlendTree->2DsimpleDirectional
Motion->上下左右左上右上左下右下
DieBlendTree->2DfreeformCartesian
Motion->l,r->-11
在loadasync()后添加.AsAsyncOperationObservable()将其变成可视化
其中有一个重载方法是可以回调一个加载进度的变量,可以使用schedulednotifier<float>()进行保存
看到这里,总算明白strange怎么用了
刘刚讲的视频花一小时看完了,讲的不错啊,搞项目时,里面有不少东西可以借鉴;
刘刚讲的视频花一小时看完了,讲的不错啊,搞项目时,里面有不少东西可以借鉴;
使用observable.Start(()=>{})可以启用线程
由于协程和线程都有oncomplate,所以都可以使用whenAll
observableOnMianThread,意思是把whenall结果转到主线程上,subscribe的回调就可以使用unity的API了
everyupdata()没有oncomplate生命周期,所以无法使用回调
使用unitx开启协程
Observable.FromCoroutine(_=>A());
留个记录,没继续往下看,老师的看不懂了,然后,然后,我自己写出来了第一节课中演示的功能。
优化代码如下,实测有效
public void ChangeBlenderShapeValue(string blenderShapeValue,float value)
{
if (!blenderShapeDatabase.ContainsKey(blenderShapeValue))
{
Debug.LogError("输入有误");
return;
}
BlenderShape blenderShape = blenderShapeDatabase[blenderShapeValue];
if (blenderShape.PositiveIndex < 0 && blenderShape.NegativeIndex < 0)
{
Debug.LogError("字典读取有误");
return;
}
if (blenderShape.PositiveIndex<0||blenderShape.NegativeIndex<0)
{
value = Mathf.Clamp(value, 0, 100);
Target.SetBlendShapeWeight(Mathf.Max(blenderShape.PositiveIndex, blenderShape.NegativeIndex),value);
}
else
{
value = Mathf.Clamp(value, -100, 100);
if (value>=0)
{
Target.SetBlendShapeWeight(blenderShape.PositiveIndex,value);
}
else
{
Target.SetBlendShapeWeight(blenderShape.NegativeIndex, -value);
}
}