/// <summary> /// Associe un indice à une orientation donnée, selon l'existence des sous-dossiers. /// </summary> /// <param name="orientation"> L'orientation </param> /// <returns> L'indice associé à l'orientation </returns> private int GetIndice(general.Point orientation) { if (!_hasSideSprites) { return(0); } // Right if (orientation.X > Math.Abs(orientation.Y) + 0.001) { return(3); } // Left if (orientation.X < -(Math.Abs(orientation.Y) + 0.001)) { return(1); } // Top / Bottom return(orientation.Y < 0 ? 2 : 0); }
/// <summary> /// Retourne le sprite correspondant au pourcentage de progression de l'animation, aninsi que son orientation. /// </summary> /// <param name="percent"> Le pourcentage de progression </param> /// <param name="orientation"> L'orientation </param> /// <returns> Le sprite correspondant </returns> public BasicSprite GetSprite(double percent, general.Point orientation) { return(_sprites[(int)(_nbFrames * percent), GetIndice(orientation)]); }