示例#1
0
        /// <summary>
        ///     Przeprowadza ocenę sesji na podstawie wszystkich jej żądań
        /// </summary>
        /// <param name="listOfDtmc">DTMC na podstawie których zostanie dokonana ocena</param>
        public void PerformOfflineDetection(List <DtmcGroup> listOfDtmc)
        {
            Rresult = 0;
            Hresult = 0;

            foreach (var Dtmc in listOfDtmc)
            {
                Result  = 0;
                Result += GetStartChanceValue(Dtmc);

                for (var i = 0; i < Requests.Count; i++)
                {
                    Result += GetLogPr(Dtmc, i);
                }

                if (Dtmc.Sessions[0].RealType == SessionTypes.Robot)
                {
                    if (Result > Rresult || Rresult == 0)
                    {
                        Rresult = Result;
                    }
                }
                else
                {
                    if (Result > Hresult || Hresult == 0)
                    {
                        Hresult = Result;
                    }
                }
            }

            PredictedType       = Rresult < Hresult ? SessionTypes.Human : SessionTypes.Robot;
            WasClassified       = true;
            DetectionMethodUsed = DetectionType.Offline;
        }
        public static Vector3 GetCenter(Vector3[] vertices, DetectionType dataCenterType)
        {
            Vector3 result = Vector3.zero;

            switch (dataCenterType)
            {
            case DetectionType.VerticesAverage:
                result = new Vector3(vertices.Average(x => x.x), vertices.Average(y => y.y), vertices.Average(z => z.z));
                break;

            case DetectionType.LowestPoint:
                result = vertices.OrderBy(z => z.y).First();
                break;

            case  DetectionType.CurrentCenter:
                result = Vector3.zero;
                break;

            case DetectionType.MixedType:
                Vector3 average = new Vector3(vertices.Average(x => x.x), vertices.Average(y => y.y), vertices.Average(z => z.z));
                Vector3 lowest  = vertices.OrderBy(z => z.y).First();
                result = ((average * 0.2f) + (lowest * 0.8f));
                break;
            }
            return(result);
        }
示例#3
0
 public DetectEvent(GameObject subject, GameObject target, DetectionType type, float fov)
 {
     this.subject = subject;
     this.target  = target;
     this.type    = type;
     this.fov     = fov;
 }
示例#4
0
 public ProcessDetectedEventArgs(String detectedProcess, int processesCount,
                                 DetectionType detectionType) : base()
 {
     this.DetectedProcess = detectedProcess;
     this.DetectionType   = detectionType;
     this.ProcessesCount  = processesCount;
 }
示例#5
0
文件: ObjCell.cs 项目: roidzilla/ACE
        public void update_all_voyeur(PhysicsObj obj, DetectionType type, bool checkDetection = true)
        {
            if (obj.ID == 0 || obj.Parent != null || VoyeurTable == null)
            {
                return;
            }

            if (obj.State.HasFlag(PhysicsState.Hidden) && (checkDetection ? type == DetectionType.EnteredDetection : true))
            {
                return;
            }

            foreach (var voyeur_id in VoyeurTable)
            {
                if (voyeur_id != obj.ID && voyeur_id != 0)
                {
                    var voyeur = obj.GetObjectA(voyeur_id);
                    if (voyeur == null)
                    {
                        continue;
                    }

                    var info = new DetectionInfo(obj.ID, type);
                    voyeur.receive_detection_update(info);
                }
            }
        }
 /// <summary>
 /// Checks whether the given alert type was used
 /// </summary>
 private bool IsDetectionTypeOn(DetectionType lookedForType, DetectionType[] userSelectedTypes)
 {
     if (userSelectedTypes.Contains(lookedForType))
     {
         return(true);
     }
     return(false);
 }
示例#7
0
 public LossTargetEvent(GameObject subject, GameObject target, DetectionType type, float fov, Vector3 spotPoint)
 {
     this.subject   = subject;
     this.target    = target;
     this.type      = type;
     this.spotPoint = spotPoint;
     this.fov       = fov;
 }
示例#8
0
 public ProcessDetectedEventArgs(String detectedProcess, int processesCount, 
     DetectionType detectionType)
     : base()
 {
     this.DetectedProcess = detectedProcess;
     this.DetectionType = detectionType;
     this.ProcessesCount = processesCount;
 }
示例#9
0
        internal void UpdateState()
        {
            DetectionType detection = ValidatorData.ItemData[(int)this.Type].Detection;
            bool          flag      = (detection != DetectionType.ErrorOnAbsence) ? this.AssetPaths.Any <string>() : (!this.AssetPaths.Any <string>());

            this.Status  = ((!flag) ? CheckStatus.Pass : ((detection != DetectionType.WarningOnDetect) ? CheckStatus.Error : CheckStatus.Warning));
            this.Foldout = flag;
        }
        public virtual MoveResult CanMove(FloatRectangle bounds, Vector2 interpolation, DetectionType detectionType)
        {
            FloatRectangle xTarget = bounds.Displace(interpolation * Direction.Right);
            FloatRectangle yTarget = bounds.Displace(interpolation * Direction.Down);
            FloatRectangle target = bounds.Displace(interpolation);

            return CanMove(bounds, interpolation, detectionType, xTarget, yTarget, target);
        }
示例#11
0
        public DetectionReturn DetectFace(DetectionType detectionType, String fileName, int sensibility, int minSize)
        {
            HaarCascade faceDetection;

            switch (detectionType)
            {
            case DetectionType.Profile:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_profileface.xml");
                break;

            case DetectionType.Face2:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt.xml");
                break;

            case DetectionType.Face3:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt2.xml");
                break;

            case DetectionType.Face4:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt_tree.xml");
                break;

            case DetectionType.Default:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                break;

            case DetectionType.Face:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                break;

            default:
                faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                break;
            }

            Image <Bgr, byte>  image     = new Image <Bgr, byte>(fileName);
            Image <Gray, byte> imageGray = image.Convert <Gray, byte>();

            MCvAvgComp[] detectedFaces = imageGray.DetectHaarCascade(faceDetection, 1.1, sensibility, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DEFAULT, new Size(minSize, minSize))[0];

            List <Rectangle> rectList = new List <Rectangle>();

            foreach (var face in detectedFaces)
            {
                rectList.Add(new Rectangle()
                {
                    X        = face.rect.X,
                    Y        = face.rect.Y,
                    Height   = face.rect.Height,
                    Width    = face.rect.Height,
                    Size     = face.rect.Size,
                    Location = face.rect.Location
                });
            }

            return(new DetectionReturn(image, rectList));
        }
示例#12
0
        internal static void TriggerOnDetectSkillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Vector2 originalEnd, Obj_AI_Base unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit)
            {
                OriginalEnd = originalEnd
            };

            OnDetectSkillshot?.Invoke(skillshot);
        }
示例#13
0
        public GTADetection(Entity e, DetectionType type, float maxRange)
        {
            Type = type;
            var ppos = World.RenderingCamera.Position;

            Distance = ppos.DistanceTo(e.Position);
            Handle   = e.Handle;
            //Bones2D = new Dictionary<string, GTAVector2>();
            Bones3D = new Dictionary <string, GTABone>();
            //(var gmin, var gmax) = e.Model.Dimensions;
            Bbox3d = new GTABoundingBox(e);
            Bbox2d = Bbox3d.To2D();
            //System.IO.File.AppendAllText("F:/datasets/GTA_V_anomaly/log.txt", "------------" + Handle.ToString() + "------------\n");
            RaycastResult res;
            Entity        hitEntity;
            GTABone       gtaBone;

            foreach (EntityBone bone in e.Bones)
            {
                try
                {
                    Vector3 bonePosition = bone.Position;
                    float   boneDistance = ppos.DistanceTo(bonePosition);

                    // Raycasting seems to be bugged where some people have no collision? Disabled this for now...

                    //if (boneDistance < maxRange)
                    //{
                    //    res = World.Raycast(ppos, bonePosition, (IntersectFlags)287, Game.Player.Character);
                    //    hitEntity = res.HitEntity;

                    //    int isVisible = 0;
                    //    if (hitEntity == null)
                    //    {
                    //        isVisible = -1;
                    //    }
                    //    else if (hitEntity.Handle == e.Handle)
                    //    {
                    //        isVisible = 1;
                    //    }
                    //    gtaBone = new GTABone(bone, isVisible, res);
                    //}
                    //else
                    //{
                    //    gtaBone = new GTABone(bone, -2, false, null);
                    //}

                    gtaBone = new GTABone(bone);
                    Bones3D.Add(bone.Index.ToString(), gtaBone);
                }
                catch
                {
                    continue;
                }
            }
        }
        private static void TriggerOnDetectSkillshot(DetectionType detectionType, SpellData spellData, int startT,
                                                     Vector2 start, Vector2 end, Obj_AI_Base unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit);

            if (OnDetectSkillshot != null)
            {
                OnDetectSkillshot(skillshot);
            }
        }
示例#15
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit));
 }
示例#16
0
文件: Peptide.cs 项目: cameyer6/mzLib
 public void SetDetectionType(SpectraFileInfo fileInfo, DetectionType detectionType)
 {
     if (DetectionTypes.ContainsKey(fileInfo))
     {
         DetectionTypes[fileInfo] = detectionType;
     }
     else
     {
         DetectionTypes.Add(fileInfo, detectionType);
     }
 }
示例#17
0
        public CheckForTerrain_BlueprintData(CheckForTerrainCondition condition)
        {
            this.name = condition.transform.name;

            this.position = condition.transform.localPosition;
            this.rotation = condition.transform.rotation;
            this.scale    = condition.transform.localScale;

            this.distance        = condition.distance;
            this.detectionMethod = condition.detectionMethod;
        }
示例#18
0
        public void Add(DetectionType detectionType)
        {
            var g = (from r in _db.DetectionTypes
                     where r.DetectionTypeID == detectionType.DetectionTypeID
                     select r).FirstOrDefault();

            if (g == null)
            {
                _db.DetectionTypes.Add(g);
                _db.SaveChanges();
            }
        }
示例#19
0
        public CheckForBuilding_BlueprintData(CheckForBuildingCondition condition)
        {
            this.name = condition.transform.name;

            this.position = condition.transform.localPosition;
            this.rotation = condition.transform.rotation;
            this.scale    = condition.transform.localScale;

            this.buildings       = condition.buildings;
            this.distance        = condition.distance;
            this.detectionMethod = condition.detectionMethod;
        }
示例#20
0
        /// <summary>
        /// Get a list of available signature elements of a given detection type.
        /// </summary>
        public static List <SignatureElement> GetSignatureElementsList(
            SignatureType sigType,
            DetectionType type)
        {
            var signatureElementList = GetSignatureElementsList(sigType);

            var filteredList = from element in signatureElementList
                               where element.Type == type
                               select element;

            return(filteredList.ToList());
        }
示例#21
0
        public Skillshot(
            DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit,
            MissileClient missile = null)
        {
            this.DetectionType = detectionType;
            this.SpellData     = spellData;
            this.StartTick     = startT;
            this.Start         = start;
            this.End           = end;
            this.Direction     = (end - start).LSNormalized();
            this.Unit          = unit;
            this.Missile       = missile;
            switch (spellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                this.Circle = new Geometry.Circle(this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotLine:
                this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotMissileLine:
                this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotCone:
                this.Sector = new Geometry.Sector(
                    start,
                    this.CollisionEnd - start,
                    spellData.Radius * (float)Math.PI / 180,
                    spellData.Range);
                break;

            case SkillShotType.SkillshotRing:
                this.Ring = new Geometry.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius);
                break;

            case SkillShotType.SkillshotArc:
                this.Arc = new Geometry.Arc(
                    start,
                    end,
                    Config.SkillShotsExtraRadius + (int)Program.Player.BoundingRadius);
                break;
            }
            this.UpdatePolygon();
        }
示例#22
0
        public Notification(String processName, int processCount, DetectionType detectionType)
        {
            this.ProcessName = processName;
            this.DetectionType = detectionType;
            this.ProcessCount = processCount;

            this.Response = UserResponse.NoResponse;

            InitializeComponent();
            SetPosition();

            RefreshComponents();
        }
示例#23
0
        public Notification(String processName, int processCount, DetectionType detectionType)
        {
            this.ProcessName   = processName;
            this.DetectionType = detectionType;
            this.ProcessCount  = processCount;

            this.Response = UserResponse.NoResponse;

            InitializeComponent();
            SetPosition();

            RefreshComponents();
        }
示例#24
0
        public Skillshot(DetectionType detectionType,
                         SpellData spellData,
                         int startT,
                         Vector2 start,
                         Vector2 end,
                         Obj_AI_Base unit)
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (end - start).Normalized();

            Unit = unit;

            SetRandomValue();

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotMissileLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotCone:
                Sector = new Geometry.Sector(
                    start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range);
                break;

            case SkillShotType.SkillshotRing:
                Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
                break;

            case SkillShotType.SkillshotArc:
                Arc = new Geometry.Arc(start, end, Config.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius);
                break;
            }

            UpdatePolygon(); //Create the polygon.
        }
示例#25
0
        public DetectionReturn DetectFace(DetectionType detectionType, String fileName, int sensibility, int minSize)
        {
            HaarCascade faceDetection;

            switch(detectionType)
            {
                case DetectionType.Profile:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_profileface.xml");
                    break;
                case DetectionType.Face2:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt.xml");
                    break;
                case DetectionType.Face3:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt2.xml");
                    break;
                case DetectionType.Face4:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_alt_tree.xml");
                    break;
                case DetectionType.Default:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                    break;
                case DetectionType.Face:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                    break;
                default:
                    faceDetection = new HaarCascade(@"C:\Users\wagner\Documents\visual studio 2013\Projects\FaceDetection\FaceDetection\haarcascade_frontalface_default.xml");
                    break;
            }

            Image<Bgr, byte> image = new Image<Bgr, byte>(fileName);
            Image<Gray, byte> imageGray = image.Convert<Gray,byte>();

            MCvAvgComp[] detectedFaces = imageGray.DetectHaarCascade(faceDetection, 1.1, sensibility, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DEFAULT, new Size(minSize, minSize))[0];

            List<Rectangle> rectList = new List<Rectangle>();
            foreach (var face in detectedFaces)
            {
                rectList.Add(new Rectangle()
                {
                    X = face.rect.X,
                    Y = face.rect.Y,
                    Height = face.rect.Height,
                    Width = face.rect.Height,
                    Size = face.rect.Size,
                    Location = face.rect.Location
                });
            }

            return new DetectionReturn(image, rectList);
        }
        internal static void TriggerOnDetectSkillshot(DetectionType detectionType,
                                                      SpellData spellData,
                                                      int startT,
                                                      Vector2 start,
                                                      Vector2 end,
                                                      AIBaseClient unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit);

            if (OnDetectSkillshot != null)
            {
                OnDetectSkillshot(skillshot);
            }
        }
示例#27
0
        public Skillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit)
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (end - start).Normalized();

            Unit = unit;

            bestAllies = GameObjects.AllyHeroes
                         .Where(t =>
                                t.Distance(ObjectManager.GetLocalPlayer()) < Support_AIO.Bases.Champion.W.Range)
                         .OrderBy(x => x.Health);

            foreach (var ally in bestAllies)
            {
                switch (spellData.Type)
                {
                case SkillShotType.SkillshotCircle:
                    Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22);
                    break;

                case SkillShotType.SkillshotLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SkillShotType.SkillshotMissileLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SkillShotType.SkillshotCone:
                    Sector = new Geometry.Polygon.Sector(
                        start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range, 22);
                    break;

                case SkillShotType.SkillshotRing:
                    Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
                    break;

                case SkillShotType.SkillshotArc:
                    Arc = new Geometry.Polygon.Arc(start, end,
                                                   EvadeManager.SkillShotsExtraRadius + (int)ally.BoundingRadius, 22);
                    break;
                }
            }
            UpdatePolygon();
        }
示例#28
0
        public Skillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit)
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (end - start).Normalized();

            Unit = unit;

            switch (spellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotMissileLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotCone:
                Sector = new Geometry.Sector(
                    start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range);
                break;

            case SkillShotType.SkillshotRing:
                Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
                break;

            case SkillShotType.SkillshotArc:
                Arc = new Geometry.Arc(start, end,
                                       Config.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius);
                break;

            case SkillShotType.SkillshotMissileCone:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            UpdatePolygon();
        }
示例#29
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Vector2 originalEnd,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit, missile)
     {
         OriginalEnd = originalEnd
     });
 }
示例#30
0
        public Skillshot(
            DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit)
        {
            this.DetectionType   = detectionType;
            this.SpellData       = spellData;
            this.StartTick       = startT;
            this.Start           = start;
            this.End             = end;
            this.MissilePosition = start;
            this.Direction       = (end - start).Normalized();

            this.Unit = unit;

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                this.Circle = new Geometry.Circle(this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotLine:
                this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotMissileLine:
                this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotCone:
                this.Sector = new Geometry.Sector(
                    start,
                    this.CollisionEnd - start,
                    spellData.Radius * (float)Math.PI / 180,
                    spellData.Range);
                break;

            case SkillShotType.SkillshotRing:
                this.Ring = new Geometry.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius);
                break;
            }

            this.UpdatePolygon(); //Create the polygon.
        }
示例#31
0
        public GTADetection(Entity e, DetectionType type)
        {
            Type     = type;
            Pos      = new GTAVector(e.Position);
            Distance = Game.Player.Character.Position.DistanceTo(e.Position);
            BBox     = GTAData.ComputeBoundingBox(e, e.Position);
            Handle   = e.Handle;

            Rot = new GTAVector(e.Rotation);
            cls = DetectionClass.Unknown;
            Vector3 gmin;
            Vector3 gmax;

            e.Model.GetDimensions(out gmin, out gmax);
            BBox3D = new SharpDX.BoundingBox((SharpDX.Vector3) new GTAVector(gmin), (SharpDX.Vector3) new GTAVector(gmax));
        }
示例#32
0
 /// <summary>
 /// 获取指定的串口实例
 /// </summary>
 /// <param name="device">设备类型</param>
 /// <param name="detection">检测项目</param>
 /// <param name="index">编号</param>
 /// <returns></returns>
 public static PortElement GetDevicePort(DeviceType device, DetectionType detection, int index = 0)
 {
     try
     {
         if (StaticPort == null)
         {
             throw new Exception();
         }
         var port = StaticPort.Single(x => x.DeviceType == device && x.DetectionType == detection && x.Index == index);
         return(port);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#33
0
 /// <summary>
 /// 获取指定的串口实例
 /// </summary>
 /// <param name="device">设备类型</param>
 /// <param name="detection">检测项目</param>
 /// <param name="index">编号</param>
 /// <returns></returns>
 public static PortConfigModel GetCoreDevicePort(DeviceProperty device, DetectionType detection, int index = 0)
 {
     try
     {
         if (StaticPort == null)
         {
             throw new Exception();
         }
         var port = StaticPort.Single(x => x.DeviceProperty == device && x.Index == index);
         return(port);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#34
0
        public Skillshot(DetectionType detectionType,
                         SpellData spellData,
                         int startT,
                         Vector2 start,
                         Vector2 end,
                         Obj_AI_Base unit,
                         Obj_AI_Base target = null
                         )
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (end - start).Normalized();
            Target          = target;
            Unit            = unit;

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotMissileLine:
                Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                break;

            case SkillShotType.SkillshotCone:
                Sector = new Geometry.Sector(
                    start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range);
                break;

            case SkillShotType.SkillshotRing:
                Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
                break;
            }

            UpdatePolygon(); //Create the polygon.
        }
示例#35
0
        public Skillshot(
            DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit)
        {
            this.DetectionType = detectionType;
            this.SpellData = spellData;
            this.StartTick = startT;
            this.Start = start;
            this.End = end;
            this.MissilePosition = start;
            this.Direction = (end - start).Normalized();

            this.Unit = unit;

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
                case SkillShotType.SkillshotCircle:
                    this.Circle = new Geometry.Circle(this.CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotLine:
                    this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotMissileLine:
                    this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotCone:
                    this.Sector = new Geometry.Sector(
                        start,
                        this.CollisionEnd - start,
                        spellData.Radius * (float)Math.PI / 180,
                        spellData.Range);
                    break;
                case SkillShotType.SkillshotRing:
                    this.Ring = new Geometry.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius);
                    break;
            }

            this.UpdatePolygon(); //Create the polygon.
        }
示例#36
0
        public Skillshot(DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit,
            Obj_AI_Base target = null
            )
        {
            DetectionType = detectionType;
            SpellData = spellData;
            StartTick = startT;
            Start = start;
            End = end;
            MissilePosition = start;
            Direction = (end - start).Normalized();
            Target = target;
            Unit = unit;

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
                case SkillShotType.SkillshotCircle:
                    Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotLine:
                    Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotMissileLine:
                    Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotCone:
                    Sector = new Geometry.Sector(
                        start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range);
                    break;
                case SkillShotType.SkillshotRing:
                    Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
                    break;
            }

            UpdatePolygon(); //Create the polygon.
        }
        /// <summary>
        /// In cases where the user decided to use the shortcut NONE, this method sets the value of the ExcludedDetectionType property to reflect the correct values.
        /// </summary>
        public static DetectionType[] ProcessExcludedDetectionTypes(DetectionType[] excludedDetectionTypes)
        {
            if (excludedDetectionTypes == null || excludedDetectionTypes.Length == 0)
            {
                return excludedDetectionTypes;
            }

            if (excludedDetectionTypes.Length == 1)
            {
                if (excludedDetectionTypes[0] == DetectionType.None)
                {
                    return new DetectionType[] { };
                }
            }
            else
            {
                if (excludedDetectionTypes.Contains(DetectionType.None))
                {
                    throw new Exception(string.Format(Properties.Resources.InvalidExcludedDetectionTypeSet, DetectionType.None));
                }
            }
            return excludedDetectionTypes;
        }
示例#38
0
文件: Skillshot.cs 项目: CONANLXF/AIO
 public Skillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     this.DetectionType = detectionType;
     this.SpellData = spellData;
     this.StartTick = startT;
     this.Start = start;
     this.End = end;
     this.Direction = (end - start).LSNormalized();
     this.Unit = unit;
     this.Missile = missile;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             this.Circle = new Geometry.Circle(this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotLine:
             this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotMissileLine:
             this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             this.Sector = new Geometry.Sector(
                 start,
                 this.CollisionEnd - start,
                 spellData.Radius * (float)Math.PI / 180,
                 spellData.Range);
             break;
         case SkillShotType.SkillshotRing:
             this.Ring = new Geometry.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius);
             break;
         case SkillShotType.SkillshotArc:
             this.Arc = new Geometry.Arc(
                 start,
                 end,
                 Config.SkillShotsExtraRadius + (int)Program.Player.BoundingRadius);
             break;
     }
     this.UpdatePolygon();
 }
示例#39
0
 		public override void OnInspectorGUI () 
		{


		
		Climate_Zone_C self = (Climate_Zone_C)target;
    
    	//Time Number Variables
    	EditorGUILayout.LabelField("UniStorm Climate Generator", EditorStyles.boldLabel);
		EditorGUILayout.LabelField("By: Black Horizon Studios", EditorStyles.label);
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		EditorGUILayout.Space();

		EditorGUILayout.LabelField("Climate Options", EditorStyles.boldLabel);

		EditorGUILayout.Space();

		self.ClimateName = EditorGUILayout.TextField ("Climate Name", self.ClimateName);

		EditorGUILayout.HelpBox("The name of your climate.", MessageType.None, true);

		EditorGUILayout.Space();

		editorDetectionType = (DetectionType)self.DetectionType;
		editorDetectionType = (DetectionType)EditorGUILayout.EnumPopup("Detection Type", editorDetectionType);
		self.DetectionType = (int)editorDetectionType;

		EditorGUILayout.HelpBox("The Detection Type determins how your weather zone is triggered. This can be based on the Height (where your player must reach a certain height in order for the Climate Zone to change; this can be perfect for Mountains) or based on an OnTrigger collision (where you player must hit the trigger in order for the Climate Zone to change; perfect for Desert areas, Rainforests, Swamps, etc).", MessageType.None, true);

		EditorGUILayout.Space();

		if (self.DetectionType == 1)
		{


			bool PlayerObject = !EditorUtility.IsPersistent (self);
			self.PlayerObject = (GameObject)EditorGUILayout.ObjectField ("Player Object", self.PlayerObject, typeof(GameObject), PlayerObject);

			EditorGUILayout.HelpBox("Assign your player object here. The Climate System will use your player's height (Y position) to detect when to change Climate Zones.", MessageType.None, true);

			EditorGUILayout.Space();

			self.climateHeight = EditorGUILayout.IntField ("Climate Height", self.climateHeight);

			EditorGUILayout.HelpBox("The height needed to change the Climate Zone.", MessageType.None, true);

			EditorGUILayout.Space();

			editorIfGreaterOrLessThan = (IfGreaterOrLessThan)self.ifGreaterOrLessThan;
			editorIfGreaterOrLessThan = (IfGreaterOrLessThan)EditorGUILayout.EnumPopup("If Greater Or Less Than", editorIfGreaterOrLessThan);
			self.ifGreaterOrLessThan = (int)editorIfGreaterOrLessThan;

			EditorGUILayout.HelpBox("Based on the height above, does your player need to be above or below " + self.climateHeight.ToString() + " to make the climate change? Example: Moutains are above 300 units and Grasslands are below 300 units." , MessageType.None, true);

			EditorGUILayout.Space();

			self.updateInterval = EditorGUILayout.FloatField ("Update Interval", self.updateInterval);

			EditorGUILayout.HelpBox("How often (in seconds) the Climate Zone is updated to check the player's height" , MessageType.None, true);
		}

		if (self.DetectionType == 0)
		{
			self.playerTag = EditorGUILayout.TextField ("Tag Name", self.playerTag);
			
			EditorGUILayout.HelpBox("The Tag name of your player.", MessageType.None, true);
			
			EditorGUILayout.Space();
		}

		EditorGUILayout.Space();
		EditorGUILayout.Space();

			
		EditorGUILayout.LabelField("Current Climate", EditorStyles.boldLabel);

		EditorGUILayout.HelpBox("This is the current climate that is generated.", MessageType.None, true);

		self.startingSpringTemp = EditorGUILayout.IntField ("Starting Spring Temp", self.startingSpringTemp);
		self.minSpringTemp = EditorGUILayout.IntField ("Min Spring", self.minSpringTemp);
		self.maxSpringTemp = EditorGUILayout.IntField ("Max Spring", self.maxSpringTemp);
		EditorGUILayout.Space();
		
		self.startingSummerTemp = EditorGUILayout.IntField ("Starting Summer Temp", self.startingSummerTemp);
		self.minSummerTemp = EditorGUILayout.IntField ("Min Summer", self.minSummerTemp);
		self.maxSummerTemp = EditorGUILayout.IntField ("Max Summer", self.maxSummerTemp);
		EditorGUILayout.Space();
		
		self.startingFallTemp = EditorGUILayout.IntField ("Starting Fall Temp", self.startingFallTemp);
		self.minFallTemp = EditorGUILayout.IntField ("Min Fall", self.minFallTemp);
		self.maxFallTemp = EditorGUILayout.IntField ("Max Fall", self.maxFallTemp);
		EditorGUILayout.Space();
		
		self.startingWinterTemp = EditorGUILayout.IntField ("Starting Winter Temp", self.startingWinterTemp);
		self.minWinterTemp = EditorGUILayout.IntField ("Min Winter", self.minWinterTemp);
		self.maxWinterTemp = EditorGUILayout.IntField ("Max Winter", self.maxWinterTemp);

		EditorGUILayout.Space();

		editorWeatherChance1 = (WeatherChanceDropDown1)self.weatherChanceSpring;
		editorWeatherChance1 = (WeatherChanceDropDown1)EditorGUILayout.EnumPopup("Spring %", editorWeatherChance1);
		self.weatherChanceSpring = (int)editorWeatherChance1;
		
		editorWeatherChance2 = (WeatherChanceDropDown2)self.weatherChanceSummer;
		editorWeatherChance2 = (WeatherChanceDropDown2)EditorGUILayout.EnumPopup("Summer %", editorWeatherChance2);
		self.weatherChanceSummer = (int)editorWeatherChance2;
		
		editorWeatherChance3 = (WeatherChanceDropDown3)self.weatherChanceFall;
		editorWeatherChance3 = (WeatherChanceDropDown3)EditorGUILayout.EnumPopup("Fall %", editorWeatherChance3);
		self.weatherChanceFall = (int)editorWeatherChance3;
		
		editorWeatherChance4 = (WeatherChanceDropDown4)self.weatherChanceWinter;
		editorWeatherChance4 = (WeatherChanceDropDown4)EditorGUILayout.EnumPopup("Winter %", editorWeatherChance4);
		self.weatherChanceWinter = (int)editorWeatherChance4;
		
		//EditorGUILayout.LabelField("Zone Weather Options", EditorStyles.boldLabel);
		//editorWeatherType = (WeatherTypeDropDown)self.zoneWeather;
		//editorWeatherType = (WeatherTypeDropDown)EditorGUILayout.EnumPopup("Zone Weather Type", editorWeatherType);
    	//self.zoneWeather = (int)editorWeatherType;

		EditorGUILayout.Space();
		EditorGUILayout.Space();

		if(GUILayout.Button("Generate Climate"))
		{
			confirmationToGenerate = !confirmationToGenerate;
		}

			
			EditorGUILayout.HelpBox("Generate climate cannot be undone. Once this button has been pressed, your old settings will be gone.", MessageType.Warning, true);
			
			EditorGUILayout.HelpBox("Generate Climate will randomize several UniStorm settings to generate a climate for you. This includeds Weather Odds, Min and Max Temperautes (as well as calculating your seasonal averages), Starting Time, Date, Starting Weather, Moon Phases, and more. This can be useful for testing randomized settings or even generating a climate for your games. The Presets all use real world data (excluding the Random Preset) to give you a well rounded generated climate of that type.", MessageType.None, true);
			
			
		if (confirmationToGenerate)
		{
			EditorGUILayout.Space();

			editorTemperatureType = (TemperatureType)self.TemperatureType;
			editorTemperatureType = (TemperatureType)EditorGUILayout.EnumPopup("Temperautre Type", editorTemperatureType);
			self.TemperatureType = (int)editorTemperatureType;

			EditorGUILayout.HelpBox("The Temperautre Type determins whether Fahrenheit or Celsius temperatures will be generated. Both types will still use real-world data.", MessageType.None, true);

			EditorGUILayout.Space();

			EditorGUILayout.HelpBox("Generate climate cannot be undone. Once this button has been pressed, your old settings will be gone.", MessageType.Warning, true);

				EditorGUILayout.HelpBox("Generating a new climate will change your current settings. This process cannot be undone. However, you can always reset to the default settings we used with our demos.", MessageType.Warning, true);
				
				EditorGUILayout.Space();
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Random"))
				{
					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = Random.Range(35, 45);
						self.maxSpringTemp = Random.Range(46, 60);
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = Random.Range(70, 80);
						self.maxSummerTemp = Random.Range(81, 115);
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = Random.Range(35, 45);
						self.maxFallTemp = Random.Range(46, 60);
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = Random.Range(-25, 0);
						self.maxWinterTemp = Random.Range(1, 40);
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((Random.Range(35, 45)) - 32) * 5/9;
						self.maxSpringTemp = ((Random.Range(46, 60)) - 32) * 5/9;
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = ((Random.Range(70, 80)) - 32) * 5/9;
						self.maxSummerTemp = ((Random.Range(81, 115)) - 32) * 5/9;
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = ((Random.Range(35, 45)) - 32) * 5/9;
						self.maxFallTemp = ((Random.Range(46, 60)) - 32) * 5/9;
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = ((Random.Range(-25, 0)) - 32) * 5/9;
						self.maxWinterTemp = ((Random.Range(1, 40)) - 32) * 5/9;
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}
				}
				
				EditorGUILayout.HelpBox("A Random Climate will generate a random climate with no real world data. Everything is completely randomized, while still being realistic. This can give you very unique results which you can then alter how you'd like.", MessageType.None, true);
				
				EditorGUILayout.Space();
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Rainforest"))
				{
					
					self.weatherChanceSpring = 80;
					self.weatherChanceSummer = 80;
					self.weatherChanceFall = 80;
					self.weatherChanceWinter = 80;
					
					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = Random.Range(75, 80);
						self.maxSpringTemp = Random.Range(80, 85);
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = Random.Range(80, 85);
						self.maxSummerTemp = Random.Range(85, 93);
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = Random.Range(75, 80);
						self.maxFallTemp = Random.Range(80, 85);
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = Random.Range(68, 70);
						self.maxWinterTemp = Random.Range(70, 75);
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((Random.Range(75, 80)) - 32) * 5/9;
						self.maxSpringTemp = ((Random.Range(80, 85)) - 32) * 5/9;
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = ((Random.Range(80, 85)) - 32) * 5/9;
						self.maxSummerTemp = ((Random.Range(85, 93)) - 32) * 5/9;
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = ((Random.Range(75, 80)) - 32) * 5/9;
						self.maxFallTemp = ((Random.Range(80, 85)) - 32) * 5/9;
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = ((Random.Range(68, 70)) - 32) * 5/9;
						self.maxWinterTemp = ((Random.Range(70, 75)) - 32) * 5/9;
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}
				}
				
				EditorGUILayout.HelpBox("The Rainforest Preset will generate a random Rainforest like Climate according to real world data.\n\nThe Rainforest climate consists of high odds of precipitation evenly distributed throughout the year. The yearly average temperature is relatively warm. It ralely exceeds 90° during the summer months and rarely falls below 68° during the winter.\n\nAfter your climate has been generated, you can tweak the settings to your liking.", MessageType.None, true);
				
				EditorGUILayout.Space();
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Desert"))
				{
					
					self.weatherChanceSpring = 20;
					self.weatherChanceSummer = 20;
					self.weatherChanceFall = 20;
					self.weatherChanceWinter = 20;
					
					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = Random.Range(70, 85);
						self.maxSpringTemp = Random.Range(85, 90);
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = Random.Range(90, 95);
						self.maxSummerTemp = Random.Range(100, 120);
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = Random.Range(70, 85);
						self.maxFallTemp = Random.Range(85, 90);
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = Random.Range(0, 50);
						self.maxWinterTemp = Random.Range(50, 60);
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((Random.Range(70, 85)) - 32) * 5/9;
						self.maxSpringTemp = ((Random.Range(85, 90)) - 32) * 5/9;
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = ((Random.Range(90, 95)) - 32) * 5/9;
						self.maxSummerTemp = ((Random.Range(100, 120)) - 32) * 5/9;
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = ((Random.Range(70, 85)) - 32) * 5/9;
						self.maxFallTemp = ((Random.Range(85, 90)) - 32) * 5/9;
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = ((Random.Range(0, 50)) - 32) * 5/9;
						self.maxWinterTemp = ((Random.Range(50, 60)) - 32) * 5/9;
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}
				}
				
				EditorGUILayout.HelpBox("The Desert Preset will generate a random Desert like Climate according to real world data.\n\nThe Desert climate consists of very low odds of precipitation throughout the year. The average temperature is very hot duirng the Summer, but can be very cold during the Winter. Temperatures can often exceed 100° during the summer months and fall as cold as 0° during the winter.\n\nAfter your climate has been generated, you can tweak the settings to your liking.", MessageType.None, true);
				
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Mountainous"))
				{
					
					self.weatherChanceSpring = 60;
					self.weatherChanceSummer = 60;
					self.weatherChanceFall = 60;
					self.weatherChanceWinter = 60;
					
					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = Random.Range(45, 55);
						self.maxSpringTemp = Random.Range(55, 70);
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = Random.Range(70, 90);
						self.maxSummerTemp = Random.Range(90, 96);
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = Random.Range(40, 50);
						self.maxFallTemp = Random.Range(50, 65);
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = Random.Range(-30, 10);
						self.maxWinterTemp = Random.Range(10, 30);
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((Random.Range(45, 55)) - 32) * 5/9;
						self.maxSpringTemp = ((Random.Range(55, 70)) - 32) * 5/9;
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = ((Random.Range(70, 90)) - 32) * 5/9;
						self.maxSummerTemp = ((Random.Range(90, 96)) - 32) * 5/9;
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = ((Random.Range(40, 50)) - 32) * 5/9;
						self.maxFallTemp = ((Random.Range(50, 65)) - 32) * 5/9;
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = ((Random.Range(-30, 10)) - 32) * 5/9;
						self.maxWinterTemp = ((Random.Range(10, 30)) - 32) * 5/9;
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}
				}
				
				EditorGUILayout.HelpBox("The Mountainous Preset will generate a random Mountainous like Climate according to real world data. \n\nThe Mountainous climate consists of medium to high odds of precipitation throughout the year. The average temperature is relatively mild during the Summer and very cold during the Winter. Temperatures can rarely exceed 86° during the summer months and fall as cold as -22° during the winter.\n\nAfter your climate has been generated, you can tweak the settings to your liking.", MessageType.None, true);
				
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Grassland"))
				{
					
					self.weatherChanceSpring = 60;
					self.weatherChanceSummer = 60;
					self.weatherChanceFall = 20;
					self.weatherChanceWinter = 20;
					
					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = Random.Range(50, 85);
						self.maxSpringTemp = Random.Range(85, 90);
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = Random.Range(90, 95);
						self.maxSummerTemp = Random.Range(95, 115);
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = Random.Range(50, 85);
						self.maxFallTemp = Random.Range(85, 90);
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = Random.Range(30, 40);
						self.maxWinterTemp = Random.Range(40, 50);
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((Random.Range(50, 85)) - 32) * 5/9;
						self.maxSpringTemp = ((Random.Range(85, 90)) - 32) * 5/9;
						self.startingSpringTemp = (self.minSpringTemp + self.maxSpringTemp) / 2;
						
						self.minSummerTemp = ((Random.Range(90, 95)) - 32) * 5/9;
						self.maxSummerTemp = ((Random.Range(95, 115)) - 32) * 5/9;
						self.startingSummerTemp = (self.minSummerTemp + self.maxSummerTemp) / 2;
						
						self.minFallTemp = ((Random.Range(50, 85)) - 32) * 5/9;
						self.maxFallTemp = ((Random.Range(85, 90)) - 32) * 5/9;
						self.startingFallTemp = (self.minFallTemp + self.maxFallTemp) / 2;
						
						self.minWinterTemp = ((Random.Range(30, 40)) - 32) * 5/9;
						self.maxWinterTemp = ((Random.Range(40, 50)) - 32) * 5/9;
						self.startingWinterTemp = (self.minWinterTemp + self.maxWinterTemp) / 2;
					}
				}
				
				EditorGUILayout.HelpBox("The Grassland Preset will generate a random Grassland like Climate according to real world data. \n\nThe Grassland climate consists of medium odds of precipitation mainly in the Spring and Summer months. The average temperature is hot during the Summer and cold during the Winter. Temperatures can exceed 100° during the summer months and fall as cold as 30° during the winter.\n\nAfter your climate has been generated, you can tweak the settings to your liking.", MessageType.None, true);
				
				EditorGUILayout.Space();
				
				if(GUILayout.Button("Reset to Default settings"))
				{
					
					self.weatherChanceSpring = 60;
					self.weatherChanceSummer = 20;
					self.weatherChanceFall = 40;
					self.weatherChanceWinter = 80;

					if (self.TemperatureType == 0)
					{
						self.minSpringTemp = 45;
						self.maxSpringTemp = 65;
						self.minSummerTemp = 70;;
						self.maxSummerTemp = 100;
						self.minFallTemp = 35;
						self.maxFallTemp = 55;
						self.minWinterTemp = 0;
						self.maxWinterTemp = 40;
						
						self.startingSpringTemp = 55;
						self.startingSummerTemp = 85;
						self.startingFallTemp = 45;
						self.startingWinterTemp = 30;
					}

					if (self.TemperatureType == 1)
					{
						self.minSpringTemp = ((45) - 32) * 5/9;
						self.maxSpringTemp = ((65) - 32) * 5/9;
						self.minSummerTemp = ((70) - 32) * 5/9;
						self.maxSummerTemp = ((100) - 32) * 5/9;
						self.minFallTemp = ((35) - 32) * 5/9;
						self.maxFallTemp = ((55) - 32) * 5/9;
						self.minWinterTemp = ((0) - 32) * 5/9;
						self.maxWinterTemp = ((40) - 32) * 5/9;
						
						self.startingSpringTemp = ((55) - 32) * 5/9;
						self.startingSummerTemp = ((85) - 32) * 5/9;
						self.startingFallTemp = ((45) - 32) * 5/9;
						self.startingWinterTemp = ((30) - 32) * 5/9;
					}
				}
				
				EditorGUILayout.Space();
				
			
		
		}

    	
		if (GUI.changed) 
		{ 
			EditorUtility.SetDirty(self); 
		}
		

    
    }
示例#40
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Vector2 originalEnd,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit, missile) { OriginalEnd = originalEnd });
 }
示例#41
0
        public Skillshot(DetectionType detectionType,
            SkillshotData skillshotData,
            int startT,
            Vector2 startPosition,
            Vector2 endPosition,
            Obj_AI_Base caster)
        {
            DetectionType = detectionType;
            SkillshotData = skillshotData;
            StartTick = startT;
            StartPosition = startPosition;
            EndPosition = endPosition;
            MissilePosition = startPosition;
            Direction = (endPosition - startPosition).Normalized();
            Caster = caster;

            //Create the spatial object for each type of skillshot.
            switch (skillshotData.Type)
            {
                case SkillShotType.SkillshotCircle:
                    Circle = new SkillshotGeometry.Circle(CollisionEnd, skillshotData.Radius);
                    break;
                case SkillShotType.SkillshotLine:
                    Rectangle = new SkillshotGeometry.Rectangle(StartPosition, CollisionEnd, skillshotData.Radius);
                    break;
                case SkillShotType.SkillshotMissileLine:
                    Rectangle = new SkillshotGeometry.Rectangle(StartPosition, CollisionEnd, skillshotData.Radius);
                    break;
                case SkillShotType.SkillshotCone:
                    Sector = new SkillshotGeometry.Sector(
                        startPosition, CollisionEnd - startPosition, skillshotData.Radius*(float) Math.PI/180,
                        skillshotData.Range);
                    break;
                case SkillShotType.SkillshotRing:
                    Ring = new SkillshotGeometry.Ring(CollisionEnd, skillshotData.Radius, skillshotData.RingRadius);
                    break;
            }

            UpdatePolygon(); // Create the polygon
        }
        public MoveResult CanMoveInterpolated(FloatRectangle bounds, Vector2 interpolation, DetectionType detectionType)
        {
            FloatRectangle xTarget = new FloatRectangle(bounds).Offset(interpolation.X, 0);
            FloatRectangle yTarget = new FloatRectangle(bounds).Offset(0, interpolation.Y);
            FloatRectangle target = new FloatRectangle(bounds).Offset(interpolation.X, interpolation.Y);

            return CanMove(bounds, interpolation, detectionType, xTarget, yTarget, target);
        }
示例#43
0
 public Skillshot(DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     DetectionType = detectionType;
     SpellData = spellData;
     StartTick = startT;
     Start = start;
     End = end;
     MissilePosition = start;
     Direction = (end - start).Normalized();
     Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22);
             break;
         case SkillShotType.SkillshotLine:
         case SkillShotType.SkillshotMissileLine:
             Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             Sector = new Geometry.Polygon.Sector(
                 start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range, 22);
             break;
         case SkillShotType.SkillshotRing:
             Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
             break;
     }
     UpdatePolygon();
 }
示例#44
0
 /// <summary>
 /// Активирует событие, говорящее об обнаружении подозрительного процесса.
 /// </summary>
 /// <param name="processName">Название процесса.</param>
 /// <param name="processesCount">Количество порожденных процессов.</param>
 /// <param name="detectionType">Тип обнаружения.</param>
 /// <returns>Реакция пользователя на обнаружение процесса.</returns>
 private UserResponse RaiseProcessDetection(String processName, int processesCount, DetectionType detectionType)
 {
     if (this.ProcessDetected != null)
     {
         return this.ProcessDetected(new ProcessDetectedEventArgs(processName, processesCount, detectionType));
     }
     else
     {
         return UserResponse.Kill;
     }
 }
示例#45
0
 public DetectionReturn DetectFace(DetectionType detectionType, String fileName, DetectionSensibility detectionSensibility)
 {
     return this.DetectFace(detectionType, fileName, (int)detectionSensibility, 20);
 }
示例#46
0
 public Skillshot(DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     DetectionType = detectionType;
     SpellData = spellData;
     StartTick = startT;
     Start = start;
     End = end;
     Direction = (end - start).Normalized();
     Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotLine:
             Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotMissileLine:
             Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             Sector = new Geometry.Sector(
                 start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range);
             break;
         case SkillShotType.SkillshotRing:
             Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
             break;
         case SkillShotType.SkillshotArc:
             Arc = new Geometry.Arc(
                 start, end, Config.SkillShotsExtraRadius + (int) ObjectManager.Player.BoundingRadius);
             break;
     }
     UpdatePolygon();
 }
示例#47
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit));
 }
 private void RefreshDiagnostics(DetectionType detectionType, FitResult fit, FitResult fitX, FitResult fitY, MoveResult flags)
 {
     if (detectionType == DetectionType.Collision)
     {
         Diagnostic.Write("fit ", fit);
         Diagnostic.Write("fitX", fitX);
         Diagnostic.Write("fitY", fitY);
         Diagnostic.Write("rslt", flags);
     }
     else if (detectionType == DetectionType.Retrace)
     {
         Diagnostic.Write("rFt ", fit);
         Diagnostic.Write("rFtX", fitX);
         Diagnostic.Write("rFtY", fitY);
         Diagnostic.Write("RSLT", flags);
     }
 }
 /// <summary>
 /// Checks whether the given alert type was used
 /// </summary>
 private bool IsDetectionTypeOn(DetectionType lookedForType, DetectionType[] userSelectedTypes)
 {
     if (userSelectedTypes.Contains(lookedForType))
     {
         return true;
     }
     return false;
 }
示例#50
0
 private static void TriggerOnDetectSkillshot(
     this SpellData spellData,
     DetectionType detectionType,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     if (OnDetectSkillshot != null)
     {
         OnDetectSkillshot(new Skillshot(detectionType, spellData, startT, start, end, unit));
     }
 }
        private static void TriggerOnDetectSkillshot(DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit);

            if (OnDetectSkillshot != null)
            {
                OnDetectSkillshot(skillshot);
            }
        }
        public MoveResult CanMove(
			FloatRectangle bounds, Vector2 interpolation, DetectionType detectionType,
			FloatRectangle xTarget, FloatRectangle yTarget, FloatRectangle target)
        {
            MoveResult flags = MoveResult.None;

            FitResult fitX = CanFitInMatrix(xTarget);
            FitResult fitY = CanFitInMatrix(yTarget);
            FitResult fit = CanFitInMatrix(target);

            try
            {
                if (detectionType == DetectionType.Collision) // senseless to test this when retracing.
                {
                    flags |= CheckInboundMapLimits(bounds, interpolation);
                }

                if (fitX == FitResult.Mortal || fitY == FitResult.Mortal)
                {
                    flags |= MoveResult.Died;
                    return flags;
                }

                if (fitX == FitResult.LevelComplete || fitY == FitResult.LevelComplete)
                {
                    flags |= MoveResult.LevelCompleted;
                    return flags;
                }

                if (fitX == FitResult.Solid && fitY == FitResult.Solid)
                {
                    flags = MoveResult.Blocked;
                    return flags;
                }

                if (fit == FitResult.Mortal)
                {
                    flags |= MoveResult.Died;
                    return flags;
                }

                if (fit == FitResult.LevelComplete)
                {
                    flags |= MoveResult.LevelCompleted;
                    return flags;
                }

                if (fit == FitResult.Ok)
                {
                    flags |= MoveResult.X | MoveResult.Y;
                    return flags;
                }

                flags |= AdjustFlags(interpolation, fitX, fitY);

                return flags;
            }
            finally
            {
                RefreshDiagnostics(detectionType, fit, fitX, fitY, flags);
            }
        }