public static void BubblesWaterAnimation(SceneManager sceneMgr, Vector3 pos, string baseName, int count, Vector2 range, Vector2 size) { Vector2 sizeRand; string name; for (uint i = 0; i < count; i++) { float h = Mogre.Math.RangeRandom(-20, -5); float angle = Mogre.Math.RangeRandom(-10, 10); Vector2 rand = ViewHelper.RandomVector2(range.x, range.y); Vector3 posView = new Vector3(pos.x + rand.x, pos.y + h, pos.z + rand.y); name = EffectsManager.BuildSpriteEffectName(sceneMgr.RootSceneNode, EffectsManager.EffectType.BUBBLES, baseName + "_bubbles_" + i); NodeAnimation.NodeAnimation node = EffectsManager.Singleton.GetEffect(name); if (!EffectsManager.Singleton.EffectExists(name) || (node != null && node.Ended)) { sizeRand = size * Math.RangeRandom(0.9f, 1.1f); VisibilityNodeAnimation ani = EffectsManager.Singleton.RectangularEffect(sceneMgr, sceneMgr.RootSceneNode, baseName + "_bubbles_" + i, EffectsManager.EffectType.BUBBLES, posView, sizeRand, new Quaternion(new Radian(new Degree(90)), Vector3.UNIT_X) * new Quaternion(new Radian(new Degree(angle)), Vector3.UNIT_Y), false); ani.Duration = Mogre.Math.RangeRandom(ani.Duration, 2 * ani.Duration); ani.TimeScale = Mogre.Math.RangeRandom(0.5f, 1.5f); } } }
protected void register(NodeAnimation animation) { animations[animation.Name] = animation; if (animations.Count == 0) { currentName = animation.Name; } }
public bool switchTo(string animationName) { if (this[animationName] != null) { currentName = animationName; currentAnimation = this[currentName]; currentAnimation.TimeScale = 1.0f; return(true); } else { return(false); } }
public static void SinkingWaterAnimation(SceneManager sceneMgr, Vector3 pos, string baseName, int count, Vector2 range, Vector2 size) { string name; Vector2 sizeRand; for (uint i = 0; i < count; i++) { Vector2 rand = ViewHelper.RandomVector2(range.x, range.y); Vector3 posView = new Vector3(pos.x + rand.x, pos.y, pos.z + rand.y); name = EffectsManager.BuildSpriteEffectName(sceneMgr.RootSceneNode, EffectsManager.EffectType.SUBMERGE, baseName + "_" + i); NodeAnimation.NodeAnimation node = EffectsManager.Singleton.GetEffect(name); if (!EffectsManager.Singleton.EffectExists(name) || (node != null && node.getPercent() > 0.6f)) { sizeRand = size * Math.RangeRandom(0.9f, 1.1f); VisibilityNodeAnimation ani = EffectsManager.Singleton.RectangularEffect(sceneMgr, sceneMgr.RootSceneNode, baseName + "_" + i, EffectsManager.EffectType.SUBMERGE, posView, sizeRand, Quaternion.IDENTITY, false); ani.Duration = Mogre.Math.RangeRandom(ani.Duration, 2 * ani.Duration); ani.TimeScale = Mogre.Math.RangeRandom(0.5f, 1.5f); } } }
public void OnShipSinking(LevelTile shipTile) { LevelTile tile = shipTile; Vector2 v = UnitConverter.LogicToWorldUnits(new PointD(Mathematics.IndexToPosition(tile.TileIndex), 1.5f)); string name; SinkingWaterAnimation(sceneMgr, new Vector3(v.x, v.y, 0), tile.GetHashCode().ToString(), 3, new Vector2(6, 6), new Vector2(25, 25)); if (!EngineConfig.LowDetails) { BubblesWaterAnimation(sceneMgr, new Vector3(v.x, v.y, 0), shipTile.GetHashCode().ToString(), 8, new Vector2(6, 6), new Vector2(6, 6)); BubblesWaterAnimation(sceneMgr, new Vector3(v.x, v.y, 0), shipTile.GetHashCode() + "2", 8, new Vector2(10, 10), new Vector2(20, 20)); } // zgaœ ogieñ - pierwotnie mia³o byæ realizowane przez LevelView.OnShipUnderWater. Z przyczyn technicznych realizowane jest tutaj for (uint i = 0; i < 6; i++) { name = EffectsManager.BuildSpriteEffectName(staticNode, EffectsManager.EffectType.FIRE, i.ToString()); NodeAnimation.NodeAnimation node = EffectsManager.Singleton.GetEffect(name); if (node != null && node.FirstNode._getDerivedPosition().y < 0.0f) { EffectsManager.Singleton.NoSprite(sceneMgr, staticNode, EffectsManager.EffectType.FIRE, i); } } }
public bool isRegistered(NodeAnimation animation) { return(isRegistered(animation.Name)); }
protected void unregister(NodeAnimation animation) { unregister(this[animation.Name]); }