Exemplo n.º 1
0
 public ChangeSpriteVisualEffect(int objectID, long startTime, VisualEventTypeEnum type, string spritePath = null)
 {
     this.objectId   = objectID;
     this.startTime  = startTime;
     this.eventType  = type;
     this.paramsList = new List <string> {
         spritePath
     };
 }
Exemplo n.º 2
0
 public CreateDeleteVisualEvent(int objectID, long startTime, VisualEventTypeEnum type, string spritePath = null, float posX = 0, float posY = 0)
 {
     this.objectId   = objectID;
     this.startTime  = startTime;
     this.eventType  = type;
     this.paramsList = new List <string> {
         spritePath,
         posX.ToString(), posY.ToString(), 0.0f.ToString()
     };
 }
 public ChangeRotationLinearVisualEffect(int objectID, long startTime, VisualEventTypeEnum type, long duration, float roation)
 {
     this.objectId   = objectID;
     this.startTime  = startTime;
     this.eventType  = type;
     this.paramsList = new List <string>
     {
         duration.ToString(),
             roation.ToString()
     };
 }
 public ChangePositionDampingVisualEffect(int objectID, long startTime, VisualEventTypeEnum type, long duration, float posX, float posY)
 {
     this.objectId   = objectID;
     this.startTime  = startTime;
     this.eventType  = type;
     this.paramsList = new List <string>
     {
         duration.ToString(),
             posX.ToString(),
             posY.ToString()
     };
 }
 public ChangeColorLinearVisualEffect(int objectID, long startTime, VisualEventTypeEnum type, ArgbColor colorToSet, long timeToSet)
 {
     this.objectId   = objectID;
     this.startTime  = startTime;
     this.eventType  = type;
     this.paramsList = new List <string>
     {
         colorToSet.red.ToString(),
             colorToSet.green.ToString(),
             colorToSet.blue.ToString(),
             colorToSet.alpha.ToString(),
             timeToSet.ToString()
     };
 }
Exemplo n.º 6
0
 public static VisualEventBase InstantiateChangeRotationLinearEvent(int objectID, long startTime, VisualEventTypeEnum type, List <VisualEventBase> allEvents,
                                                                    long timeToSet, float rotation)
 {
     if (type == VisualEventTypeEnum.ChangeRotObjectLinear && allEvents.Exists(x => x.objectId == objectID) && !(allEvents.Exists(x => x.objectId == objectID && x.eventType == VisualEventTypeEnum.DeleteObject)))
     {
         return(new ChangeRotationLinearVisualEffect(objectID, startTime, type, timeToSet, rotation));
     }
     else
     {
         throw new Exception("Incorrect type, object doesn't exist or object already deleted");
     }
 }
Exemplo n.º 7
0
 public static VisualEventBase InstantiateChangeColorArcEvent(int objectID, long startTime, VisualEventTypeEnum type, List <VisualEventBase> allEvents,
                                                              ArgbColor colorToSet, long timeToSet)
 {
     if (type == VisualEventTypeEnum.ChangeColorObjectArc && allEvents.Exists(x => x.objectId == objectID) && !(allEvents.Exists(x => x.objectId == objectID && x.eventType == VisualEventTypeEnum.DeleteObject)))
     {
         return(new ChangeColorArcVisualEffect(objectID, startTime, type, colorToSet, timeToSet));
     }
     else
     {
         throw new Exception("Incorrect type, object doesn't exist or object already deleted");
     }
 }
Exemplo n.º 8
0
 public static VisualEventBase InstantiateChangeSpriteEvent(int objectID, long startTime, VisualEventTypeEnum type, List <VisualEventBase> allEvents
                                                            , string imagePath = null)
 {
     if (type == VisualEventTypeEnum.ChangeSprite && allEvents.Exists(x => x.objectId == objectID) && !(allEvents.Exists(x => x.objectId == objectID && x.eventType == VisualEventTypeEnum.DeleteObject)))
     {
         return(new ChangeSpriteVisualEffect(objectID, startTime, type, imagePath));
     }
     else
     {
         throw new Exception("Incorrect type, object doesn't exist or object already deleted");
     }
 }
Exemplo n.º 9
0
 public static VisualEventBase InstantiateCreateDestroyEvent(int objectID, long startTime, VisualEventTypeEnum type, List <VisualEventBase> allEvents
                                                             , string imagePath = null, float posX = 0, float posY = 0)
 {
     if (type == VisualEventTypeEnum.CreateObject)
     {
         if (allEvents.Exists(x => x.objectId == objectID))
         {
             throw new Exception("Object with this ID already exists");
         }
         else
         {
             if (imagePath == "" || imagePath is null)
             {
                 throw new Exception("Sprite object has to have any image attached");
             }
             return(new CreateDeleteVisualEvent(objectID, startTime, type, imagePath, posX, posY));
         }
     }
     if (type == VisualEventTypeEnum.DeleteObject)
     {
         if (allEvents.Exists(x => x.objectId == objectID && (x.startTime > startTime || x.eventType == VisualEventTypeEnum.DeleteObject)))
         {
             throw new Exception("Destroy event has to be the last event referring to this object");
         }
         else
         {
             return(new CreateDeleteVisualEvent(objectID, startTime, type));
         }
     }
     else
     {
         throw new Exception("Incorrect event type for this method");
     }
 }