private static void TriggerOnDetectSkillshot(DetectionType detectionType, SkillshotData skillshotData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit) { var skillshot = new Skillshot(detectionType, skillshotData, startT, start, end, unit); if (OnDetectSkillshot != null) { OnDetectSkillshot(skillshot); } }
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 }
private static void TriggerOnDetectSkillshot(DetectionType detectionType, SkillshotData skillshotData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit) { var skillshot = new Skillshot(detectionType, skillshotData, startT, start, end, unit); if (OnDetectSkillshot != null) { OnDetectSkillshot(skillshot); } }
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 }