public override void Tick(int deltaTimeMS) { if (!CouldRun()) { return; } if (Math_F.Approximate3D(this.ownerEntity.position, this.tarPos) || IsPassed(this.tarPos)) { //this.tarPos = Math_F.RandomInsideCircle(this.orgPos, this.radius); WanderArrived.Send(this.ownerEntity.entityID); return; } this.tickDir = Math_F.TwoPositionDir(this.ownerEntity.position, this.tarPos); ////活动移动量 this.tickSpeed = this.speed * deltaTimeMS * 0.001f; //活动移动量 this.tickMove = this.tickDir * this.tickSpeed; ////新位置 this.ownerEntity.position += tickMove; }
public bool IsArrivedTarget(Vector3 target) { if (Math_F.Approximate3D(this.ownerEntity.position, target) || this.IsPassed(target)) { return(true); } return(false); }
protected void Follow(int deltaTimeMS) { if (!Math_F.Approximate3D(this.ownerEntity.position, this.nextPos) && !this.IsPassed(this.nextPos)) { this.UnArrived(deltaTimeMS); return; } this.Arrived(); }
public override void Tick(int deltaTimeMS) { if (!this.CouldActive()) { return; } if (Math_F.Approximate3D(position, endPos) || this.IsPassed(endPos) ) { //到达终点 //重要:回收前先把Collider设置成false,避免在pool中触发碰撞 GetTrans().Find("Collider").gameObject.SetActive(false); CrossRoadModelManager.GetInstance().entityModel.RemoveFromEntityMovables(this); return; } Tick_Move(deltaTimeMS); }