private static void EnemyHorizontalMove(int index, bool direction, Vector pos, Vector size, int speed, bool wait) { if (!lstEnemyData[index].valueSetComp) { EnemyBehaviorValuesSetup(index); } if (lstEnemyData[index].totalDistance.X < lstEnemyData[index].targetDistance.X) { if (!direction) { if (!BlockCheck.BlockCheckLeft(pos.X, pos.Y, (int)size.Y, speed) && pos.X > 0) { if (pos.X - SystemOperator.PixelPerSecond(speed) > 0) { pos.X -= SystemOperator.PixelPerSecond(speed); } else { lstEnemyData[index].targetDistance = new Vector(0, lstEnemyData[index].targetDistance.Y); lstEnemyData[index].direction = true; } } } else { if (!BlockCheck.BlockCheckRight(pos.X, pos.Y, (int)size.X, (int)size.Y, speed) && pos.X + size.X < 1024 - lstEnemyData[index].size.X) { if (pos.X + SystemOperator.PixelPerSecond(speed) < 992) { pos.X += SystemOperator.PixelPerSecond(speed); } else { lstEnemyData[index].targetDistance = new Vector(0, lstEnemyData[index].targetDistance.Y); lstEnemyData[index].direction = false; } } } lstEnemyData[index].position.X = pos.X; lstEnemyData[index].totalDistance.X += SystemOperator.PixelPerSecond(speed); } else { if (wait) { lstEnemyData[index].isWaiting = true; lstEnemyData[index].totalWaitTime = 0; lstEnemyData[index].targetWaitTime = 2000; } lstEnemyData[index].targetDistance = new Vector(0, 0); lstEnemyData[index].totalDistance = new Vector(0, 0); lstEnemyData[index].valueSetComp = false; } }
public void EnemyJumping(int index, bool direction, Vector pos, int width, int jumpPower, Vector target) { if (!BlockCheck.BlockCheckTop(pos.X, pos.Y, width, jumpPower)) { if (pos.Y - SystemOperator.PixelPerSecond(jumpPower) > 0) { lstEnemyData[index].jumpCount++; lstEnemyData[index].isJumping = true; } } if (lstEnemyData[index].isJumping) { if (lstEnemyData[index].jumpTotalLength < lstEnemyData[index].jumpMaxHeight) { lstEnemyData[index].position.Y -= SystemOperator.PixelPerSecond(jumpPower); lstEnemyData[index].jumpTotalLength += SystemOperator.PixelPerSecond(jumpPower); } else { lstEnemyData[index].isJumping = false; lstEnemyData[index].jumpTotalLength = 0; } } }
public static void SubWeaponPosUpdate(Canvas canvas) { if (ImageData.imgSubWeapon.Count == 1) { double posX = Canvas.GetLeft(ImageData.imgSubWeapon[0]); double posY = Canvas.GetTop(ImageData.imgSubWeapon[0]); if (subWeaponTotalDistance < subWeaponRange) { if (!subWeaponDirection) { posX -= SystemOperator.PixelPerSecond(subWeaponSpeed); } else { posX += SystemOperator.PixelPerSecond(subWeaponSpeed); } subWeaponTotalDistance += (int)SystemOperator.PixelPerSecond(subWeaponSpeed); Canvas.SetLeft(ImageData.imgSubWeapon[0], posX); Canvas.SetZIndex(ImageData.imgSubWeapon[0], ImageZindex.subWeapon); } else { subWeaponTotalDistance = 0; ImageData.imgSubWeapon[0].Name = ""; canvas.Children.Remove(ImageData.imgSubWeapon[0]); ImageData.imgSubWeapon.Remove(ImageData.imgSubWeapon[0]); } } }
public static void MainWeaponAttack(Canvas canvas) { double posx = Canvas.GetLeft(ImageData.imgPlayer); double posy = Canvas.GetTop(ImageData.imgPlayer); Canvas.SetLeft(imgMainWeapon, posx); Canvas.SetTop(imgMainWeapon, posy); if (PlayerStatus.meleeDirection) { if (rtMainWeapon.Angle < 360 + 45) { double temp = SystemOperator.PixelPerSecond(PlayerStatus.meleeSpeed); rtMainWeapon.Angle += Math.Round(temp, 0); double radian = rtMainWeapon.Angle * Math.PI / 180; for (int i = 0; i < lstMainWeaponCollider.Count; i++) { lstMainWeaponCollider[i] = new Vector(posx + 32 * (i + 1) * Math.Cos(radian), posy + 32 * (i + 1) * Math.Sin(radian)); } } else { rtMainWeapon.Angle = 270; imgMainWeapon.Visibility = Visibility.Hidden; PlayerStatus.isMainAttack = false; } } else { if (rtMainWeapon.Angle >= 180 - 45) { double temp = SystemOperator.PixelPerSecond(PlayerStatus.meleeSpeed); rtMainWeapon.Angle -= Math.Round(temp, 0); double radian = rtMainWeapon.Angle * Math.PI / 180; for (int i = 0; i < lstMainWeaponCollider.Count; i++) { lstMainWeaponCollider[i] = new Vector(posx + 32 * (i + 1) * Math.Cos(radian), posy + 32 * (i + 1) * Math.Sin(radian)); } } else { rtMainWeapon.Angle = 270; imgMainWeapon.Visibility = Visibility.Hidden; PlayerStatus.isMainAttack = false; } } }
private void Canvas_MouseMove(object sender, MouseEventArgs e) { Vector blockPos; switch (StageEditorOperator.paletteMode) { case PaletteMode.Player: Point point = e.GetPosition(mainCanvas); if (point.X < 1024 - 32) { Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, point.X); mouseMainCanvasPosition.X = point.X; } else { Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, 1024 - 32); mouseMainCanvasPosition.X = 1024 - 32; } if (point.Y < 768 - 64) { Canvas.SetTop(StageEditorOperator.imgEditorPlayer, point.Y); mouseMainCanvasPosition.Y = point.Y; } else { Canvas.SetTop(StageEditorOperator.imgEditorPlayer, 768 - 64); mouseMainCanvasPosition.Y = 768 - 64; } break; case PaletteMode.Block: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32); Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32); break; case PaletteMode.Object: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32); Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32); break; case PaletteMode.Enemy: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32); Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32); break; case PaletteMode.Item: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); Canvas.SetLeft(StageEditorOperator.imgEditorPointerCursor, (blockPos.X - 1) * 32); Canvas.SetTop(StageEditorOperator.imgEditorPointerCursor, (blockPos.Y - 1) * 32); break; } }
public static void CollisionPtoE() { if (!flagDamaged) { for (int i = 0; i < SpawnEnemy.lstEnemyData.Count; i++) { Vector p1 = new Vector(Canvas.GetLeft(ImageData.imgPlayer), Canvas.GetTop(ImageData.imgPlayer)); Vector size1 = new Vector(playerSize.X, playerSize.Y); Vector p2 = new Vector(Canvas.GetLeft(SpawnEnemy.lstEnemyData[i].imgEnemy), Canvas.GetTop(SpawnEnemy.lstEnemyData[i].imgEnemy)); Vector size2 = new Vector(SpawnEnemy.lstEnemyData[i].size.X, SpawnEnemy.lstEnemyData[i].size.Y); if (CollisionCheck.Collision(p1, p2, size1, size2)) { if (!Sound.seStop) { Sound.SoundEffectSelector(SeName.Player_Damage); Sound.SoundEffectPlayer(SeName.Player_Damage); Sound.seStop = true; } if (!isKnockBack) { //playerPos = new Vector(Canvas.GetLeft(ImageData.imgPlayer), Canvas.GetTop(ImageData.imgPlayer)); boundDirectionX = SystemOperator.FaceEachOther(playerPos.X, SpawnEnemy.lstEnemyData[i].position.X); knockBackTotalDis = new Vector(0, 0); knockBackBps = new Vector(0, 0); coefficient = 0; boundDirectionY = false; knockBackTargetDis = new Vector(64, 64); isKnockBack = true; } if (playerNowHp > 0) { playerNowHp -= SpawnEnemy.lstEnemyData[i].ofepower; ImageData.imgPlayer.Opacity = 0.6; } flagDamaged = true; damageInvincibleTotal = 0; Console.WriteLine("Break"); break; } } } }
public static void FallingPlayer() { if (!isLadder && !isPlat && !jumping) { if (!BlockCheck.BlockCheckBottom(playerPos.X, playerPos.Y, (int)playerSize.X, (int)playerSize.Y, weight)) { if (!isKnockBack) { playerPos.Y += SystemOperator.PixelPerSecond(weight); SystemOperator.moveCommonAmountY = SystemOperator.PixelPerSecond(weight); } if (!fallingStart) { fallingStartPoint = playerPos.Y; } fallingStart = true; isGround = false; } else { if (!isGround) { playerPos.Y = Math.Floor(playerPos.Y + SystemOperator.PixelPerSecond(weight) / 32) - 1; } if (fallingStart) { int block = 0; block = (int)(playerPos.Y - fallingStartPoint) / 32; if (block > fallingEndure) { Sound.SoundEffectSelector(SeName.Player_Damage); Sound.SoundEffectPlayer(SeName.Player_Damage); } } fallingStart = false; isGround = true; jumpCount = 0; } } Canvas.SetTop(ImageData.imgPlayer, playerPos.Y); }
public static void FallingItems() { for (int i = 0; i < lstItemData.Count; i++) { double posX = Canvas.GetLeft(lstItemData[i].imgItem); double posY = Canvas.GetTop(lstItemData[i].imgItem); if (!BlockCheck.BlockCheckBottom(posX, posY, (int)lstItemData[i].size.X, (int)lstItemData[i].size.Y, lstItemData[i].weight)) { posY += SystemOperator.PixelPerSecond(lstItemData[i].weight); } Canvas.SetTop(lstItemData[i].imgItem, posY); } }
private void Canvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (!isMouseRightClicked) { Vector blockPos; switch (StageEditorOperator.paletteMode) { case PaletteMode.Player: StageEditorOperator.imgEditorPlayer.Opacity = 1; Canvas.SetLeft(StageEditorOperator.imgEditorPlayer, StageEditorOperator.memoryPlayerStartPos.X); Canvas.SetTop(StageEditorOperator.imgEditorPlayer, StageEditorOperator.memoryPlayerStartPos.Y); StageEditorOperator.paletteMode = PaletteMode.None; StageEditorWindow.ctlGridMain.IsEnabled = true; stageEditor.Focus(); break; case PaletteMode.Block: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditRemoveBlockOnMainCanvas(blockPos); break; case PaletteMode.Object: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditRemoveObjectOnMainCanvas(blockPos); break; case PaletteMode.Enemy: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditRemoveEnemyOnMainCanvas(blockPos); break; case PaletteMode.Item: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditRemoveItemOnMainCanvas(blockPos); break; } isMouseRightClicked = true; } }
private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (!isMouseLeftClicked) { Vector blockPos; switch (StageEditorOperator.paletteMode) { case PaletteMode.Player: StageEditorOperator.EditorPlayerStartPosDecision(); break; case PaletteMode.Block: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditSetupBlockOnMainCanvas(blockPos); break; case PaletteMode.Object: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditSetupObjectOnMainCanvas(blockPos); break; case PaletteMode.Enemy: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditSetupEnemyOnMainCanvas(blockPos); break; case PaletteMode.Item: blockPos = SystemOperator.FromCodeToBlocks(e.GetPosition(mainCanvas)); StageEditorOperator.EditSetupItemOnMainCanvas(blockPos); break; } isMouseLeftClicked = true; } }
private void btnObjectUpdate_Click(object sender, RoutedEventArgs e) { int row = lsvObjectList.SelectedIndex; if (row >= 0) { if (SystemOperator.IsNumeric(txbObjSizeX.Text) && SystemOperator.IsNumeric(txbObjSizeY.Text) && SystemOperator.IsNumeric(txbObjTargetID.Text) && SystemOperator.IsNumeric(txbObjectTalkID.Text)) { if (rdbZindexBack.IsChecked == true) { stageEditorData.objectZindex[row] = 5; } else { stageEditorData.objectZindex[row] = 11; } stageEditorData.objectSize[row] = new Vector(int.Parse(txbObjSizeX.Text), int.Parse(txbObjSizeY.Text)); stageEditorData.objectTargetType[row] = (TargetType)Enum.Parse(typeof(TargetType), cmbObjectTargetType.SelectedItem.ToString()); stageEditorData.objectTargetId[row] = int.Parse(txbObjTargetID.Text); stageEditorData.objectToggleSwitch[row] = (bool)ckbObjToggleSwitch.IsChecked; stageEditorData.objectTalkID[row] = int.Parse(txbObjectTalkID.Text); ListViewObjectDataUpdate(); } else { MessageBox.Show("値は数字のみ有効です。半角数字を入力してください。", "入力エラー", MessageBoxButton.OK, MessageBoxImage.Information); } } }
private static void EnemyFalling(int index, bool direction, Vector pos, Vector size, int speed, Vector target) { if (!lstEnemyData[index].isLadder) { if ((!BlockCheck.BlockCheckBottom(pos.X, pos.Y, (int)size.X, (int)size.Y, lstEnemyData[index].weight))) { lstEnemyData[index].position.Y += SystemOperator.PixelPerSecond(lstEnemyData[index].weight); if (!lstEnemyData[index].isFalling) { lstEnemyData[index].fallingStartPoint = pos.Y; } lstEnemyData[index].isFalling = true; } else { if (lstEnemyData[index].isFalling) { int block = 0; block = (int)(pos.Y - lstEnemyData[index].fallingStartPoint) / 32; if (block > lstEnemyData[index].fallingEndure) { Sound.SoundEffectSelector(SeName.Shock); Sound.SoundEffectPlayer(SeName.Shock); lstEnemyData[index].life -= 1; } } lstEnemyData[index].isFalling = false; lstEnemyData[index].jumpCount = 0; } } }
private void OptionDataUpdate(int row) { switch (cmbEventType.SelectedItem) { case "Wait": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "Balloon": if (SystemOperator.IsNumeric(txbOptBalloonX.Text) && SystemOperator.IsNumeric(txbOptBalloonY.Text) && SystemOperator.IsNumeric(txbOptTargetId.Text)) { propertyEventData[row].balloonPos = new Vector(int.Parse(txbOptBalloonX.Text), int.Parse(txbOptBalloonY.Text)); propertyEventData[row].balloonMsg = txbOptMessage.Text; propertyEventData[row].balloonEnterClose = (bool)ckbOptEnterClose.IsChecked; propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "BgmPlay": propertyEventData[row].bgmName = (BgmName)Enum.Parse(typeof(BgmName), cmbOptBgmName.SelectedItem.ToString()); break; case "SePlay": propertyEventData[row].seName = (SeName)Enum.Parse(typeof(SeName), cmbOptSeName.SelectedItem.ToString()); break; case "Move": if (SystemOperator.IsNumeric(txbOptTargetId.Text) && SystemOperator.IsNumeric(txbOptSpeed.Text)) { propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); propertyEventData[row].moveDistance = new Vector(int.Parse(txbOptDistanceX.Text), int.Parse(txbOptDistanceY.Text)); propertyEventData[row].moveSpeed = int.Parse(txbOptSpeed.Text); propertyEventData[row].direction = (bool)ckbOptDirection.IsChecked; } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "KeyLock": propertyEventData[row].flagKeyLock = (bool)ckbOptKeyLock.IsChecked; break; case "UiVisibility": propertyEventData[row].uiVisible = (bool)ckbOptUiVisibility.IsChecked; break; case "CharaFadeIn": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "CharaImageChange": if (SystemOperator.IsNumeric(txbOptTargetId.Text)) { propertyEventData[row].targetImgType = (TargetType)Enum.Parse(typeof(TargetType), cmbOptTargetImage.SelectedItem.ToString()); propertyEventData[row].targetId = int.Parse(txbOptTargetId.Text); propertyEventData[row].categoryName = (CategoryName)Enum.Parse(typeof(CategoryName), cmbOptCategoryName.SelectedItem.ToString()); propertyEventData[row].patternName = cmbOptPatternName.SelectedItem.ToString(); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "ScreenFadeIn": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].fadeType = (bool)ckbOptFadeType.IsChecked; propertyEventData[row].color = (ColorEnum)Enum.Parse(typeof(ColorEnum), cmbOptColor.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "ScreenFadeOut": if (SystemOperator.IsNumeric(txbOptValue.Text)) { propertyEventData[row].eventValue = int.Parse(txbOptValue.Text); propertyEventData[row].fadeType = (bool)ckbOptFadeType.IsChecked; propertyEventData[row].color = (ColorEnum)Enum.Parse(typeof(ColorEnum), cmbOptColor.SelectedItem.ToString()); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "GenerateEnemy": if (SystemOperator.IsNumeric(txbOptStartX.Text) && SystemOperator.IsNumeric(txbOptStartY.Text)) { propertyEventData[row].setPosition = new Vector(int.Parse(txbOptStartX.Text), int.Parse(txbOptStartY.Text)); } else { MessageBox.Show("値が正しくありません。半角数字を入力してください。", "入力", MessageBoxButton.OK, MessageBoxImage.Information); } break; case "EventEnd": propertyEventData[row].eventOnly = (bool)ckbOptEventOnly.IsChecked; break; } }
public static void EnemyAction() { for (int i = 0; i < lstEnemyData.Count; i++) { EnemyTriggerAreaSetting(i); //DebugView if (lstEnemyData[i].isDamage) { EnemyInvincibleTimeCount(i); if (lstEnemyData[i].isKnockBack) { SystemOperator.BoundObject(ref lstEnemyData[i].position, SystemOperator.FaceEachOther(lstEnemyData[i].position.X, PlayerStatus.playerPos.X), ref lstEnemyData[i].totalDistance, lstEnemyData[i].targetDistance, ref lstEnemyData[i].bps, ref lstEnemyData[i].coefficient, ref lstEnemyData[i].boundDirection, lstEnemyData[i].weight, lstEnemyData[i].speed, lstEnemyData[i].jumpPower, lstEnemyData[i].size, ref lstEnemyData[i].isKnockBack); } } if (!lstEnemyData[i].isKnockBack) { EnemyFalling(i, lstEnemyData[i].direction, lstEnemyData[i].position, lstEnemyData[i].size, lstEnemyData[i].speed, lstEnemyData[i].targetDistance); } switch (lstEnemyData[i].state) { case EnemyState.Spawn: lstEnemyData[i].state = EnemyState.Idle; break; case EnemyState.Idle: EnemyIdle(i); break; case EnemyState.Normal: EnemyNormal(i); break; case EnemyState.Active: EnemyActiv(i); break; case EnemyState.Death: if (!lstEnemyData[i].isWaiting && !lstEnemyData[i].isDeath) { lstEnemyData[i].totalWaitTime = 0; lstEnemyData[i].targetWaitTime = 2000; lstEnemyData[i].isWaiting = true; } else { EnemyWaiting(i); } break; } Canvas.SetLeft(lstEnemyData[i].imgEnemy, lstEnemyData[i].position.X); Canvas.SetTop(lstEnemyData[i].imgEnemy, lstEnemyData[i].position.Y); } }
public static void MovePlayer(Canvas canvas) { if (KeyController.keyLeft) { if (!BlockCheck.BlockCheckLeft(playerPos.X, playerPos.Y, (int)playerSize.Y, moveSpeed) && !ObjectChecker.obstacleLeft) { if (playerPos.X - SystemOperator.PixelPerSecond(moveSpeed) > 0) { playerPos.X -= SystemOperator.PixelPerSecond(moveSpeed); SystemOperator.moveCommonAmountX = moveSpeed; } playerDirection = false; } } if (KeyController.keyRight) { if (!BlockCheck.BlockCheckRight(playerPos.X, playerPos.Y, (int)playerSize.X, (int)playerSize.Y, moveSpeed) && !ObjectChecker.obstacleRight) { if (playerPos.X + SystemOperator.PixelPerSecond(moveSpeed) < 992) { playerPos.X += SystemOperator.PixelPerSecond(moveSpeed); SystemOperator.moveCommonAmountX = moveSpeed; } playerDirection = true; } } if (KeyController.keyLeft || KeyController.keyRight) { isMove = true; } else { isMove = false; } if (KeyController.keyUp && !TalkCommander.isTalk && !ObjectChecker.obstacleUp) { if (isLadder) { if (playerPos.Y - SystemOperator.PixelPerSecond(moveSpeed) > 0) { playerPos.Y -= SystemOperator.PixelPerSecond(moveSpeed); SystemOperator.moveCommonAmountY = moveSpeed; } } } if (KeyController.keyDown && !TalkCommander.isTalk && !ObjectChecker.obstacleDown) { if (isLadder) { if (playerPos.Y + SystemOperator.PixelPerSecond(moveSpeed) < 768) { playerPos.Y += SystemOperator.PixelPerSecond(moveSpeed); SystemOperator.moveCommonAmountY = moveSpeed; } } if (isPlat) { if (playerPos.Y + SystemOperator.PixelPerSecond(moveSpeed) < 768) { playerPos.Y += SystemOperator.PixelPerSecond(moveSpeed); SystemOperator.moveCommonAmountY = moveSpeed; } } if (!isLadder) { isSquat = true; } } else { isSquat = false; } //jump if (KeyController.keySpace && jumpCount == 0) { if (playerPos.Y - jumpPower > 0) { jumpCount++; jumping = true; } } if (jumping) { if (jumpTotalLength < jumpMaxHeight && !BlockCheck.BlockCheckTop(playerPos.X, playerPos.Y, (int)playerSize.X, jumpPower) && !ObjectChecker.obstacleUp) { playerPos.Y -= SystemOperator.PixelPerSecond(jumpPower); SystemOperator.moveCommonAmountY = SystemOperator.PixelPerSecond(jumpPower); jumpTotalLength += SystemOperator.PixelPerSecond(jumpPower); } else { jumping = false; jumpTotalLength = 0; } } //itemget if (KeyController.keyA) { PlayerItemGetting(canvas); } //Attack if (KeyController.keyS) { SubWeapon.SubWeaponGenerate(canvas, playerPos.X, playerPos.Y); } if (KeyController.keyD) { if (!isMainAttack) { MainWeapon.imgMainWeapon.Visibility = Visibility.Visible; meleeDirection = playerDirection; isMainAttack = true; } } if (KeyController.keyE) { if (ObjectChecker.isTrigger && !TalkCommander.isTalk) { ObjectBehavior.OnTriggerReactEvent(); } } if (isKnockBack) { SystemOperator.BoundObject(ref playerPos, boundDirectionX, ref knockBackTotalDis, knockBackTargetDis, ref knockBackBps, ref coefficient, ref boundDirectionY, weight, moveSpeed, jumpPower, playerSize, ref isKnockBack); } //image change if (GameTransition.gameTransition == GameTransitionType.StageDuring) { if (KeyController.keyLeft || KeyController.keyRight) { if (!playerDirection) { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteMoveL); } else { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteMoveR); } } else { if (!playerDirection) { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteIdleL); } else { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteIdleR); } } if (isSquat) { if (!playerDirection) { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteSquatL); } else { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteSquatR); } } if (jumping) { if (!playerDirection) { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteJumpL); } else { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteJumpR); } } if (isLadder && (KeyController.keyUp || KeyController.keyDown)) { ImageData.imgPlayer.Source = ImageData.ImageSourceSelector(CategoryName.Player, StageData.lstDbPlayer.spriteLadder); } } Canvas.SetLeft(ImageData.imgPlayer, playerPos.X); Canvas.SetTop(ImageData.imgPlayer, playerPos.Y); }
//frameupdate protected void FrameUpdateTimer_Update(object sender, ElapsedEventArgs e) { try { this.Dispatcher.Invoke(() => { //TimeManagement this.GetNowTime(); elapsedTime = nowTime - lastTime; //debug lblDebugA.Content = PlayerStatus.playerPos.X + "," + PlayerStatus.playerPos.Y; lblDebugB.Content = SystemOperator.PixelPerSecond(PlayerStatus.weight); if (elapsedTime < 0) { elapsedTime += 59999; } KeyController.KeyInterval(); //GameTransition if (!GameTransition.duringTransition) { GameTransition.GameTransitionController(Canvas, CaLife, CaMana); } //EventAction if (GameTransition.eventStart) { if (GameTransition.lstEventTask.Count > 0) { GameTransition.EventTaskCommander(); } if (GameTransition.charaRenderStart) { GameTransition.CharaRender(); } if (GameTransition.screenFadeStart) { GameTransition.ScreenFade(Canvas); } if (!GameTransition.eventBalloonIsOpen) { if (GameTransition.eventCount < StageEvent.listEvent.Count) { GameTransition.EventController(Canvas); } } else { if (KeyController.keyReturn) { EnterKeyAction(Canvas); } } } if (KeyController.keyReturn) { EnterKeyAction(Canvas); } //got to Edit Mode if (GameTransition.gameTransition == GameTransitionType.Title) { if (KeyController.keyE) { mainCanvas.Children.Remove(ImageData.imgTitle[0]); mainCanvas.Children.Remove(ImageData.imgTitle[1]); countTime = 0; GameTransition.gameTransition = GameTransitionType.EditMode; timerFrameUpdate.Stop(); btnViewStageEditorWindow.IsEnabled = true; btnViewMaterialBrowser.IsEnabled = true; btnViewImageManager.IsEnabled = true; btnViewDatabaseWindow.IsEnabled = true; lblMode.Content = "ゲームモード:エディット"; } } //StageDuring game play if (GameTransition.gameTransition == GameTransitionType.StageDuring && !isDeactivated) { Animator.AnimationItem(); Animator.AnimationObject(); if (ObjectChecker.isTrigger && !TalkCommander.isTalk) { ObjectBehavior.OnTriggerTouchEvent(); } if (TalkCommander.isTalk && !TalkCommander.isTalkOpenBalloon) { TalkCommander.TalkWithNpc(Canvas); } if (TalkCommander.isTalkSelecting) { TalkCommander.TalkSelecting(Canvas); } //first action,last Processing including deletion of list SystemOperator.moveCommonAmountX = 0; SystemOperator.moveCommonAmountY = 0; ObjectChecker.CollisionPtoActionCollider(); PlayerBehavior.CollisionPtoE(); PlayerBehavior.MovePlayer(Canvas); PlayerBehavior.FallingPlayer(); Item.FallingItems(); EnemyBehavior.EnemyAction(); Animator.AnimationEnemy(); SubWeapon.SubWeaponPosUpdate(Canvas); if (PlayerStatus.isMainAttack) { MainWeapon.MainWeaponAttack(Canvas); MainWeapon.MainWeaponCollision(Canvas); } SubWeapon.CollisionSubWeapon(Canvas); PlayerStatus.PlayerStatusUpdate(); PlayerBehavior.DamageInvinsibleTimer(); SpawnEnemy.RemoveEnemy(Canvas); SpawnEnemy.ReSpawnEnemy(Canvas); } if (Sound.seStop) { if (Sound.sePlayTime < 60) { Sound.sePlayTime++; } else { Sound.sePlayTime = 0; Sound.seStop = false; } } lastTime = nowTime; }); } catch (TaskCanceledException) { } }