public void door(int x, int y, TileData otherTileData) { TRAnimation door = otherTileData.gameObject.GetComponent <TRAnimation>(); if (_PA._key_yellow > 0 && door.CurrentIndex == 1) { GameObject.Destroy(door.gameObject); otherTileData.Clear(); _PA._key_yellow -= 1; _DM.tipContent = "黄钥匙-1"; _DM.tipTime = 3f; } if (_PA._key_blue > 0 && door.CurrentIndex == 2) { GameObject.Destroy(door.gameObject); otherTileData.Clear(); _PA._key_blue -= 1; _DM.tipContent = "蓝钥匙-1"; _DM.tipTime = 3f; } if (_PA._key_red > 0 && door.CurrentIndex == 3) { GameObject.Destroy(door.gameObject); otherTileData.Clear(); _PA._key_red -= 1; _DM.tipContent = "红钥匙-1"; _DM.tipTime = 3f; } if (door.SpriteTexture.name == "door-02") { GameObject.Destroy(door.gameObject); otherTileData.Clear(); } }
void Start() { _DM = GameController.GetComponent <DialogManager>(); _TM = GameController.GetComponent <TileManager>(); _TRA = this.GetComponent <TRAnimation>(); _Collider2D = GetComponent <Collider2D>(); }
private void PackStateChanges(PackedAnimation packedAnimation, TRAnimation animation) { for (int stateChangeIndex = 0; stateChangeIndex < animation.NumStateChanges; stateChangeIndex++) { TRStateChange stateChange = Level.StateChanges[animation.StateChangeOffset + stateChangeIndex]; packedAnimation.StateChanges.Add(stateChange); int dispatchOffset = stateChange.AnimDispatch; for (int i = 0; i < stateChange.NumAnimDispatches; i++, dispatchOffset++) { if (!packedAnimation.AnimationDispatches.ContainsKey(dispatchOffset)) { TRAnimDispatch dispatch = Level.AnimDispatches[dispatchOffset]; packedAnimation.AnimationDispatches[dispatchOffset] = dispatch; } } } }
private void PackAnimCommands(PackedAnimation packedAnimation, TRAnimation animation) { int cmdOffset = animation.AnimCommand; for (int i = 0; i < animation.NumAnimCommands; i++) { int cmdIndex = cmdOffset++; TRAnimCommand cmd = Level.AnimCommands[cmdIndex]; int paramCount; switch ((TR2AnimCommand)cmd.Value) { case TR2AnimCommand.SetPosition: paramCount = 3; break; case TR2AnimCommand.JumpDistance: case TR2AnimCommand.PlaySound: case TR2AnimCommand.FlipEffect: paramCount = 2; break; default: paramCount = 0; break; } short[] paramArr = new short[paramCount]; for (int j = 0; j < paramCount; j++) { paramArr[j] = Level.AnimCommands[cmdOffset++].Value; } packedAnimation.Commands[cmdIndex] = new PackedAnimationCommand { Command = (TR2AnimCommand)cmd.Value, Params = paramArr }; } }
public override void Export() { Definition.Animations = new Dictionary <int, PackedAnimation>(); int endAnimation = GetModelAnimationCount(Level, Definition.Model) + Definition.Model.Animation; for (int animationIndex = Definition.Model.Animation; animationIndex < endAnimation; animationIndex++) { TRAnimation animation = Level.Animations[animationIndex]; PackedAnimation packedAnimation = new PackedAnimation { Animation = animation, }; Definition.Animations[animationIndex] = packedAnimation; PackStateChanges(packedAnimation, animation); PackAnimCommands(packedAnimation, animation); PackAnimSounds(packedAnimation); } ExportAnimationFrames(); }