public void InitFanShape(FanShape _this, Vector2 pos, Vector2 dir, float radius, int degree) { _this.mRadius = radius; _this.mRegree = degree; _this.mDir = dir; _this.mDir.Normalize(); }
public bool IsColliderObj(FanShape _this, ObjBase obj) { var dif = obj.GetPosition() - _this.Pos; var l = dif.LengthSquared(); if (l > _this.mRadius * _this.mRadius) { return(false); } // 如果两个点基本重合,也算命中了 if (l < 4.0f) { return(true); } dif.Normalize(); if (Vector2.Dot(_this.mDir, dif) < Math.Cos((float)Math.PI * _this.mRegree / 2 / 180)) { return(false); } return(true); }
public bool IsColliderZone(FanShape _this, Zone zone) { return(_this.CheckZoneDistance(zone, _this.mRadius)); }