public bool OverridesFlat(string textureName, GameObject gameObject, MeshRenderer mr) { if (!OverrideFlatMaterials.ContainsKey(textureName)) { return(false); } MaterialOverride mo = OverrideFlatMaterials [textureName]; if (mo.overrideName.Contains("NUKAGE")) { gameObject.layer = LayerMask.NameToLayer("NUKAGE"); } if (mo.material != null) { mr.material = mo.material; } else { mr.material = defaultMaterial; } if (mo.animation.textureFrames.Length > 0) { TextureAnimation anim = gameObject.AddComponent <TextureAnimation>(); anim.frames = mo.animation.textureFrames; anim.textureType = TextureAnimation.TextureType.Flat; anim.frameTime = mo.animation.frameTime; } return(true); }
public static TextureAnimation DeSerializeTextureAnimation(byte[] buffer, ref int offset, int length) { byte len = buffer[offset++]; if (len == 0) { return(null); } if (len != 16) { throw new Exception($"TextureAnimation length should be 16. It was {len}."); } TextureAnimation animation = new TextureAnimation(); animation.Mode = (TextureAnimationMode)DeSerializeUInt8(buffer, ref offset, length); animation.Face = DeSerializeInt8(buffer, ref offset, length); if (animation.Mode.HasFlag(TextureAnimationMode.SMOOTH)) { animation.SizeX = (byte)Mathf.Max(0, DeSerializeUInt8(buffer, ref offset, length)); animation.SizeY = (byte)Mathf.Max(0, DeSerializeUInt8(buffer, ref offset, length)); } else { animation.SizeX = (byte)Mathf.Max(1, DeSerializeUInt8(buffer, ref offset, length)); animation.SizeY = (byte)Mathf.Max(1, DeSerializeUInt8(buffer, ref offset, length)); } animation.Start = DeSerializeFloat_Le(buffer, ref offset, length); animation.Length = DeSerializeFloat_Le(buffer, ref offset, length); animation.Rate = DeSerializeFloat_Le(buffer, ref offset, length); return(animation); }
IEnumerator initLoadedAsset(Monster baseCha, GameObject model, CharacterManager.LoadBaseCharacterCompleteCallback callback) { yield return(null); SkinnedMeshRenderer[] smrs = model.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer smr in smrs) { smr.name = smr.name.Replace("(Clone)", ""); if (smr.gameObject.name.Contains("_line") == false) { if (smr.gameObject.name.Contains("_eye") || smr.gameObject.name.Contains("_mouth")) { TextureSpriteAnimation tsa = smr.gameObject.GetComponent <TextureSpriteAnimation>(); if (tsa == null) { tsa = smr.gameObject.AddComponent <TextureSpriteAnimation>(); } } } if (smr.name.Contains(ModelData.OUTLINE_RARE_NAME)) { // smr.material = (Material)GameObject.Instantiate(ResourceManager.instance.rareMaterial); TextureAnimation ta = smr.gameObject.AddComponent <TextureAnimation>(); ta.setMaterialType(false); ta.ySpeed = DebugManager.instance.rareAniSpeed; ta.useLimit = true; ta.limit = 1.0f; ta.limtTypeIsMinus = false; } else if (smr.name.Contains(ModelData.OUTLINE_NAME)) { string baseName = smr.name.Replace(ModelData.OUTLINE_NAME, ""); // if(GameManager.me.characterManager.monsterResource.ContainsKey(baseName)) // { // SkinnedMeshRenderer[] smrs2 = GameManager.me.characterManager.monsterResource[baseName].gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); // foreach(SkinnedMeshRenderer s in smrs2) // { // if(s.name.Equals(baseName)) // { // smr.material = s.material; // break; // } // } // } } } isReady = false; baseCha.onCompleteLoadModel(); if (callback != null) { callback(gameObject, baseCha); } isReady = true; }
protected override void Prepare() { var effect = Factory.Create1by1Sprite(); float size = 0.3f; effect.transform.localScale = new UnityEngine.Vector3(size, size, size); var target = ((XmasEntity)Spell.Targets[0][0]); var pos = Factory.ConvertPos(target.PositionAs <TilePosition>().Point, 0.8f); pos.y += 0.5f; effect.transform.position = pos; ParallelAnimation parallelani = new ParallelAnimation(); TextureAnimation texani = new TextureAnimation(this.Factory.LoadSpellTexture("lightningbolt"), 5, 5); texani.Frames = Enumerable.Range(1, 20).ToArray(); texani.FrameRepeats = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; parallelani.Add(texani, true); SizeChangeAnimation sizeani = new SizeChangeAnimation(0.02f); parallelani.Add(sizeani, false); this.EnqueueAnimation(effect, parallelani); }
public bool OverridesWall(string textureName, GameObject gameObject, MeshRenderer mr) { if (!OverrideWallMaterials.ContainsKey(textureName)) { return(false); } MaterialOverride mo = OverrideWallMaterials [textureName]; //if (mo.layer != -1) //gameObject.layer = mo.layer; if (mo.material != null) { mr.material = mo.material; } else { mr.material = defaultMaterial; } if (mo.animation.textureFrames.Length > 0) { TextureAnimation anim = gameObject.AddComponent <TextureAnimation>(); anim.frames = mo.animation.textureFrames; anim.textureType = TextureAnimation.TextureType.Wall; anim.frameTime = mo.animation.frameTime; } return(true); }
public TextureAnimation ConvertBack(Func <string, ISpriteImageSource> imageLoader) { var spriteImage = imageLoader(SpriteImageFile); var bitsPerPixel = spriteImage.BitsPerPixel; var back = new TextureAnimation { Unk1 = Unk1, TextureIndex = TextureIndex, FrameStride = FrameStride, BitsPerPixel = Convert.ToUInt16(bitsPerPixel), BaseSlotIndex = BaseSlotIndex, MaximumSlotIndex = Convert.ToUInt16(BaseSlotIndex + SlotTable.Length - 1), NumAnimations = Convert.ToUInt16(FrameGroupList.Length), NumSpritesInImageData = NumSpritesInImageData, UOffsetInBaseImage = UOffsetInBaseImage, VOffsetInBaseImage = VOffsetInBaseImage, SpriteWidth = Convert.ToUInt16(spriteImage.Size.Width), SpriteHeight = Convert.ToUInt16(spriteImage.Size.Height / NumSpritesInImageData), OffsetSlotTable = 0, OffsetAnimationTable = 0, OffsetSpriteImage = 0, DefaultAnimationIndex = DefaultAnimationIndex, SlotTable = SlotTable, FrameGroupList = FrameGroupList, SpriteImage = spriteImage.Data, }; return(back); }
public AnimatedObject(TextureAnimation textureAnimation) { this.textureAnimation = textureAnimation; actions = new List <ActionAnimation> { new ActionAnimation(null, Vector2.Zero, Vector2.Zero, 0) }; }
// Token: 0x060017AD RID: 6061 RVA: 0x00014EBD File Offset: 0x000130BD public void OnAnimationEnd(TextureAnimation anim) { this.StateMachine.Trigger <OnAnimationOrTransitionEnded>(); if (!this.SpriteEntity.Animation.Animator.IsTransitionPlaying) { this.StateMachine.Trigger <OnAnimationEnded>(); } }
// Use this for initialization void Start() { currentAnimation=animations[0]; renderer.material.mainTexture=currentAnimation.currentTexture; animationController.framesPerSecond=currentAnimation.FPS; animationController.columnCount=currentAnimation.columnCount; animationController.rowCount=currentAnimation.rowCount; }
public void PlayAnimation(string name) { currentAnimation=FindAnimation(name); renderer.material.mainTexture=currentAnimation.currentTexture; animationController.framesPerSecond=currentAnimation.FPS; animationController.columnCount=currentAnimation.columnCount; animationController.rowCount=currentAnimation.rowCount; }
public override TextureAnimation GenerateIdleAnimation() { var idle_ani = new TextureAnimation(this.Factory.LoadUnitTexture("monk"), 1, 1); idle_ani.Frames = Enumerable.Range(1, 1).ToArray(); idle_ani.FrameRepeats = Enumerable.Repeat <int>(50, 1).ToArray(); return(idle_ani); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); var ballTexture = Content.Load <Texture2D>(ASSET_NAME_BALL); _ball = new BallEntity(ballTexture, new Vector2(BALL_POS_X, BALL_POS_Y)); _ballManager = new BallManager(_ball); var groundTexture = Content.Load <Texture2D>(ASSET_NAME_GROUND); _groundManager = new GroundManager(groundTexture, _ball, _entityManager); _ballInputController = new BallInputController(_ball); _scoreBoardFont = Content.Load <SpriteFont>(ASSET_NAME_SCORE_BOARD_FONT); _scoreBoard = new ScoreBoardEntity(_scoreBoardFont, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _ball); var wallTexture = Content.Load <Texture2D>(ASSET_NAME_WALL); _wallManager = new WallManager(wallTexture, _ball, _scoreBoard, _entityManager); _coinPickupSoundEffect = Content.Load <SoundEffect>(ASSET_NAME_COIN_PICKUP); _rotatingCoinAnimation = new TextureAnimation(); _coin0 = Content.Load <Texture2D>(ASSET_NAME_COIN_0); _coin1 = Content.Load <Texture2D>(ASSET_NAME_COIN_1); _coin2 = Content.Load <Texture2D>(ASSET_NAME_COIN_2); _coin3 = Content.Load <Texture2D>(ASSET_NAME_COIN_3); _coin4 = Content.Load <Texture2D>(ASSET_NAME_COIN_4); _rotatingCoinAnimation.AddFrame(_coin0, ROTATING_COIN_ANIMATION_FRAME_DURATION); _rotatingCoinAnimation.AddFrame(_coin1, ROTATING_COIN_ANIMATION_FRAME_DURATION * 2); _rotatingCoinAnimation.AddFrame(_coin2, ROTATING_COIN_ANIMATION_FRAME_DURATION * 3); _rotatingCoinAnimation.AddFrame(_coin3, ROTATING_COIN_ANIMATION_FRAME_DURATION * 4); _rotatingCoinAnimation.AddFrame(_coin4, ROTATING_COIN_ANIMATION_FRAME_DURATION * 5); _rotatingCoinAnimation.Play(); _coinManager = new CoinManager(_coin0, _ball, _scoreBoard, _entityManager, _coinPickupSoundEffect, _rotatingCoinAnimation); _entityManager.AddEntity(_ball); _entityManager.AddEntity(_ballManager); _entityManager.AddEntity(_groundManager); _entityManager.AddEntity(_scoreBoard); _entityManager.AddEntity(_wallManager); _entityManager.AddEntity(_coinManager); _groundManager.Initialize(); }
public void ListViewItem_OpenTexAnim(object sender, MouseButtonEventArgs e) { TextureAnimation texAnimSelected = ((ListViewItem)sender).Content as TextureAnimation; byte[] clutPalette = null; if (texAnimSelected.TextureIndex < textureFileControlModel.textureData.Images.Count) { clutPalette = textureFileControlModel.textureData.Images[texAnimSelected.TextureIndex].GetClut(); } contentFrameAnimation.Content = new TexAnim_Control(texAnimSelected, clutPalette); }
public override TextureAnimation GenerateIdleAnimation() { TextureAnimation ani; Texture tex; tex = Factory.LoadHeroTexture("warlord_idle"); ani = new TextureAnimation(tex, 4, 4); ani.Frames = Enumerable.Range(1, 16).ToArray(); ani.FrameRepeats = Enumerable.Repeat <int>(3, 16).ToArray(); return(ani); }
public override TextureAnimation GenerateIdleAnimation() { TextureAnimation ani; Texture tex; tex = Factory.LoadUnitTexture("archer_idle"); ani = new TextureAnimation(tex, 6, 4); ani.Frames = Enumerable.Range(1, 21).ToArray(); ani.FrameRepeats = Enumerable.Repeat <int>(4, 21).ToArray(); return(ani); }
public void PlayAnimation(int index) { if (index<animations.Length-1) { currentAnimation=animations[index]; renderer.material.mainTexture=currentAnimation.currentTexture; animationController.framesPerSecond=currentAnimation.FPS; animationController.columnCount=currentAnimation.columnCount; animationController.rowCount=currentAnimation.rowCount; } }
protected override void PrepareUnitAnimations() { TextureAnimation ani; Texture tex; tex = Factory.LoadHeroTexture("warlord_walking"); ani = new TextureAnimation(tex, 5, 3); ani.Frames = Enumerable.Range(1, 14).ToArray(); ani.FrameRepeats = Enumerable.Repeat <int>(3, 14).ToArray(); this.SetUnitAnimation(StandardUnitAnimations.Move, ani); }
public CoinManager(Texture2D spriteSheet, BallEntity ball, ScoreBoardEntity scoreBoard, EntityManager entityManager, SoundEffect coinPickupSoundEffect, TextureAnimation rotatingCoinAnimation) { _ball = ball; _entityManager = entityManager; _texture = spriteSheet; _scoreBoard = scoreBoard; _random = new Random(); _coinPickupSoundEffect = coinPickupSoundEffect; _rotatingCoinAnimation = rotatingCoinAnimation; }
public override void OnInspectorGUI() { serializedObject.Update(); TextureAnimation myTarget = (TextureAnimation)target; myTarget.variableName = EditorGUILayout.TextField("ID", myTarget.variableName); myTarget.fps = EditorGUILayout.FloatField("FPS", myTarget.fps); myTarget.row = EditorGUILayout.IntField("Row", myTarget.row); myTarget.col = EditorGUILayout.IntField("Col", myTarget.col); list.DoLayoutList(); myTarget.debug = EditorGUILayout.Toggle("Debug", myTarget.debug); serializedObject.ApplyModifiedProperties(); }
public MinionPiece() { RelativeSizeAxes = Axes.Both; InternalChild = animation = new TextureAnimation { Origin = Anchor.Centre, Anchor = Anchor.Centre, FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, DefaultFrameLength = 250, }; }
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, string animationSeparator = "-") { const double default_frame_time = 1000 / 60d; Texture texture; Texture getFrameTexture(int frame) => source.GetTexture($"{componentName}{animationSeparator}{frame}"); TextureAnimation animation = null; if (animatable) { for (int i = 0;; i++) { if ((texture = getFrameTexture(i)) == null) { break; } if (animation == null) { animation = new TextureAnimation { DefaultFrameLength = default_frame_time, Repeat = looping } } ; animation.AddFrame(texture); } } if (animation != null) { return(animation); } if ((texture = source.GetTexture(componentName)) != null) { return new Sprite { Texture = texture } } ; return(null); } } }
public void TestAnimationTimeReferenceChange() { ISkin skin = new TestSkin(); AddStep("get animation", () => Add(animation = (TextureAnimation)skin.GetAnimation(animation_name, true, false))); AddAssert("frame count correct", () => animation.FrameCount == frame_count); assertPlaybackPosition(0); AddStep("set start time to 1000", () => animationTimeReference.AnimationStartTime.Value = 1000); assertPlaybackPosition(-1000); AddStep("set current time to 500", () => animationTimeReference.ManualClock.CurrentTime = 500); assertPlaybackPosition(-500); }
public TaikoMascotAnimation(TaikoMascotAnimationState state) { InternalChild = textureAnimation = createTextureAnimation(state).With(animation => { animation.Origin = animation.Anchor = Anchor.BottomLeft; animation.Scale = new Vector2(0.51f); // close enough to stable }); RelativeSizeAxes = Axes.Both; Origin = Anchor = Anchor.BottomLeft; // needs to be always present to prevent the animation clock consuming time spent when not present. AlwaysPresent = true; }
public override void Load() { // Load pacman. pacSheet = game.Content.Load <Texture2D>(@"Textures/Game/pacman-sheet"); pacTextureAnimation = new TextureAnimation(pacSheet, 16, 16, new TimeSpan(0, 0, 0, 0, 66)); pacman = new AnimatedObject(pacTextureAnimation); pacStartPosition = new Vector2(startDrawLocation.X - 5, startDrawLocation.Y); // Load ghost. ghostTexture = game.Content.Load <Texture2D>(@"Textures/Game/ghost_01"); ghostTextureAnimation = new TextureAnimation(ghostTexture, ghostTexture.Width, ghostTexture.Height, new TimeSpan(1, 0, 0)); ghost = new AnimatedObject(ghostTextureAnimation); ghostStartPosition = new Vector2(startDrawLocation.X - 60, startDrawLocation.Y + 1); }
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-") { Texture texture; if (animatable) { var textures = getTextures().ToArray(); if (textures.Length > 0) { var animation = new TextureAnimation { DefaultFrameLength = getFrameLength(source, applyConfigFrameRate, textures), Repeat = looping, }; foreach (var t in textures) { animation.AddFrame(t); } return(animation); } } // if an animation was not allowed or not found, fall back to a sprite retrieval. if ((texture = source.GetTexture(componentName)) != null) { return new Sprite { Texture = texture } } ; return(null); IEnumerable <Texture> getTextures() { for (int i = 0; true; i++) { if ((texture = source.GetTexture($"{componentName}{animationSeparator}{i}")) == null) { break; } yield return(texture); } } }
public TextureAnimationIMEx(TextureAnimation src) { _source = src; Unk1 = src.Unk1; TextureIndex = src.TextureIndex; FrameStride = src.FrameStride; BaseSlotIndex = src.BaseSlotIndex; NumSpritesInImageData = src.NumSpritesInImageData; UOffsetInBaseImage = src.UOffsetInBaseImage; VOffsetInBaseImage = src.VOffsetInBaseImage; DefaultAnimationIndex = src.DefaultAnimationIndex; SlotTable = src.SlotTable; FrameGroupList = src.FrameGroupList; }
protected override void Prepare() { var effect = Factory.Create1by1Sprite(); float effectSize = 0.2f; effect.transform.localScale = new UnityEngine.Vector3(effectSize,effectSize,effectSize); TextureAnimation texani; var terrain = (TerrainEntity)Spell.Targets[0][0]; var pos = Factory.ConvertPos(terrain.PositionAs<TilePosition>().Point, 1f); effect.transform.position = pos; texani = new TextureAnimation(this.Factory.LoadSpellTexture("summoning"), 5, 6); texani.Frames = Enumerable.Range(1, 30).ToArray(); texani.FrameRepeats = Enumerable.Repeat<int>(2, 30).ToArray(); this.EnqueueAnimation(effect, texani); }
// 开始动画 void _showStartEffect() { System.Action <Object> handler = (asset) => { if (asset != null) { GameObject effectObject = (GameObject)GameObject.Instantiate(asset); TextureAnimation anima = effectObject.GetComponent <TextureAnimation>(); anima.eventReceiver = gameObject; anima.finishEvent = "_startEffectEnd"; NGUIUtility.SetParent(transform, effectObject.transform); m_startEffect = anima; } }; StartCoroutine(Globals.It.BundleMgr.CreateObject(kResource.Effect, "StartEffect", "StartEffect", handler)); }
public CommonResource() { try { this.palette = new Palette(); this.colorMap = new ColorMap(); this.textures = new TextureLookup(); this.flats = new FlatLookup(); this.sprites = new SpriteLookup(); this.animation = new TextureAnimation(this.textures, this.flats); } catch (Exception e) { ExceptionDispatchInfo.Throw(e); } }
private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-") { Texture texture; Texture getFrameTexture(int frame) => GetTexture($"{componentName}{animationSeparator}{frame}"); TextureAnimation animation = null; if (animatable) { for (int i = 0;; i++) { if ((texture = getFrameTexture(i)) == null) { break; } if (animation == null) { animation = new TextureAnimation { DefaultFrameLength = default_frame_time, Repeat = looping } } ; animation.AddFrame(texture); } } if (animation != null) { return(animation); } if ((texture = GetTexture(componentName)) != null) { return new Sprite { Texture = texture } } ; return(null); }
protected override void Prepare() { var effect = Factory.Create1by1Sprite(); float effectSize = 0.2f; effect.transform.localScale = new UnityEngine.Vector3(effectSize, effectSize, effectSize); TextureAnimation texani; var terrain = (TerrainEntity)Spell.Targets[0][0]; var pos = Factory.ConvertPos(terrain.PositionAs <TilePosition>().Point, 1f); effect.transform.position = pos; texani = new TextureAnimation(this.Factory.LoadSpellTexture("summoning"), 5, 6); texani.Frames = Enumerable.Range(1, 30).ToArray(); texani.FrameRepeats = Enumerable.Repeat <int>(2, 30).ToArray(); this.EnqueueAnimation(effect, texani); }
protected override void Prepare() { var effect = Factory.Create1by1Sprite(); effect.transform.position = Factory.ConvertPos(Spell.Controller.Hero.PositionAs <TilePosition>().Point, 0.8f); ParallelAnimation parallelani = new ParallelAnimation(); TextureAnimation texani = new TextureAnimation(this.Factory.LoadSpellTexture("inspiration"), 5, 3); texani.Frames = Enumerable.Range(1, 15).ToArray(); texani.FrameRepeats = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; parallelani.Add(texani, true); SizeChangeAnimation sizeani = new SizeChangeAnimation(0.02f); parallelani.Add(sizeani, false); this.EnqueueAnimation(effect, parallelani); }
protected override void Prepare() { ParallelAnimation parallelani; var ball = Factory.Create1by1Sprite(); float ballSize = 0.5f; ball.transform.localScale = new UnityEngine.Vector3(ballSize, ballSize, ballSize); TextureAnimation texani; SizeChangeAnimation sizeani; MoveTransformAnimation moveani; var height = 1f; var terrain = (TerrainEntity)Spell.Targets[0][0]; var heropos = Spell.Controller.Hero.PositionAs <TilePosition>().Point; var fromPos = Factory.ConvertPos(heropos, height); var toPos = Factory.ConvertPos(terrain.PositionAs <TilePosition>().Point, 0.8f); parallelani = new ParallelAnimation(); texani = new TextureAnimation(this.Factory.LoadSpellTexture("fireball"), 8, 8); texani.Frames = new int[] { 6 }; texani.FrameRepeats = Enumerable.Repeat <int>(1, 2).ToArray(); texani.AutoLooping = true; parallelani.Add(texani, false); moveani = new MoveTransformAnimation(fromPos, toPos, 12f); parallelani.Add(moveani, true); this.EnqueueAnimation(ball, parallelani); parallelani.Completed += (sender, evt) => { var explosion = Factory.Create1by1Sprite(); explosion.transform.position = toPos; parallelani = new ParallelAnimation(); texani = new TextureAnimation(this.Factory.LoadSpellTexture("fireball"), 8, 8); texani.Frames = Enumerable.Range(1, 38).ToArray(); texani.FrameRepeats = Enumerable.Repeat <int>(1, 38).ToArray(); parallelani.Add(texani, true); sizeani = new SizeChangeAnimation(0.02f); parallelani.Add(sizeani, false); this.EnqueueAnimation(explosion, parallelani); }; }
public TexAnim_VM(TextureAnimation texAnim, byte[] clutPalette) { this.texAnim = texAnim; if (clutPalette != null) { bitmapImage = GetBimapSource(ToBgra32(texAnim.SpriteImage, clutPalette), texAnim.SpriteWidth, texAnim.SpriteHeight * texAnim.NumSpritesInImageData); } TexFrameGroupList = new ObservableCollection <TextureFrameGroupWrapper>(); for (int i = 0; i < texAnim.FrameGroupList.Length; i++) { TexFrameGroupList.Add(new TextureFrameGroupWrapper(texAnim.FrameGroupList[i], i.ToString())); } TextureFrameList = new ObservableCollection <TextureFrame>(); if (texAnim.FrameGroupList.Length > 0) { TextureFrameList = new ObservableCollection <TextureFrame>(texAnim.FrameGroupList[0].IndexedFrameList.Values); } }
protected override void Prepare() { ParallelAnimation parallelani; var ball = Factory.Create1by1Sprite(); float ballSize = 0.5f; ball.transform.localScale = new UnityEngine.Vector3(ballSize,ballSize,ballSize); TextureAnimation texani; SizeChangeAnimation sizeani; MoveTransformAnimation moveani; var height = 1f; var terrain = (TerrainEntity)Spell.Targets[0][0]; var heropos = Spell.Controller.Hero.PositionAs<TilePosition>().Point; var fromPos = Factory.ConvertPos(heropos, height); var toPos = Factory.ConvertPos(terrain.PositionAs<TilePosition>().Point, 0.8f); parallelani = new ParallelAnimation(); texani = new TextureAnimation(this.Factory.LoadSpellTexture("fireball"), 8, 8); texani.Frames = new int[]{6}; texani.FrameRepeats = Enumerable.Repeat<int>(1, 2).ToArray(); texani.AutoLooping = true; parallelani.Add(texani, false); moveani = new MoveTransformAnimation(fromPos,toPos,12f); parallelani.Add(moveani, true); this.EnqueueAnimation(ball, parallelani); parallelani.Completed += (sender, evt) => { var explosion = Factory.Create1by1Sprite(); explosion.transform.position = toPos; parallelani = new ParallelAnimation(); texani = new TextureAnimation(this.Factory.LoadSpellTexture("fireball"), 8, 8); texani.Frames = Enumerable.Range(1, 38).ToArray(); texani.FrameRepeats = Enumerable.Repeat<int>(1, 38).ToArray(); parallelani.Add(texani, true); sizeani = new SizeChangeAnimation(0.02f); parallelani.Add(sizeani, false); this.EnqueueAnimation(explosion, parallelani); }; }
// Update is called once per frame void Update() { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.MetroPlayerARM) { this.ray = Camera.main.ScreenPointToRay(Input.touches[0].position); if (Physics.Raycast(this.ray, out this.hit, 100, this.Mask) && Input.touches[0].phase == TouchPhase.Ended) { if (this.hit.collider.Equals(this.collider)) { this.AonBlink.GetComponent<MeshRenderer>().enabled = true; this.aonBlinkTextureAnimation = this.AonBlink.GetComponent<TextureAnimation>(); this.aonBlinkTextureAnimation.PlayAnimation(true, this); } } } else { Debug.Log("Current device is not mobile. (Windows 8 RT, Android or iOS)"); } }
public static TextureAnimation FromOSD(OSD osd) { TextureAnimation anim = new TextureAnimation(); OSDMap map = osd as OSDMap; if (map != null) { anim.Face = map["face"].AsUInteger(); anim.Flags = (TextureAnimMode)map["flags"].AsUInteger(); anim.Length = (float)map["length"].AsReal(); anim.Rate = (float)map["rate"].AsReal(); anim.SizeX = map["size_x"].AsUInteger(); anim.SizeY = map["size_y"].AsUInteger(); anim.Start = (float)map["start"].AsReal(); } return anim; }
// Use this for initialization void Start() { this.isMoving = false; this.aonShineTextureAnimation = this.AonFound.GetComponent<TextureAnimation>(); this.offestValueY = 0.0f; }