Beispiel #1
0
 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();
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public bool IsColliderZone(FanShape _this, Zone zone)
 {
     return(_this.CheckZoneDistance(zone, _this.mRadius));
 }