This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public setBlockCount(count: number): void { | |
| this._numberOfUnCollideBlocks -= count; | |
| const total = this._totalBlocks; | |
| if (this._blockCountText) { | |
| this._blockCountText.text = `blocks ${this._numberOfUnCollideBlocks}/${total}`; | |
| } | |
| if (this._numberOfUnCollideBlocks <= 0) { | |
| this.showMessage("Congratuation! Please Press Enter Key to Restart"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const observable = (aggregate.body as any).getCollisionObservable?.(); | |
| if (observable && typeof observable.add === "function") { | |
| const observer = observable.add((collisionEvent: any) => { | |
| // notify the shared GameManager instance | |
| GameManager.instance?.setBlockCount(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this._gameMessageControl = new TextBlock(); | |
| this._gameMessageControl.textHorizontalAlignment = TextBlock.HORIZONTAL_ALIGNMENT_CENTER; | |
| this._gameMessageControl.fontSize = "48px"; | |
| this._gameMessageControl.color = "white"; | |
| this._gameMessageControl.text = "Please Press Enter Key to Start"; | |
| this._gameMessageControl.resizeToFit = true; | |
| this._gameMessageControl.height = "80px"; | |
| this._gameMessageControl.width = "600px"; | |
| this._gameMessageControl.fontFamily ="Viga"; | |
| playerUI.addControl(this._gameMessageControl); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import FoundationModels | |
| import UniformTypeIdentifiers // ファイルタイプ判別用 | |
| import UIKit // UIApplication 用 | |
| // 文字列拡張:繰り返しパターンの検出用 | |
| extension String { | |
| // 特定の部分文字列が何回出現するかをカウント | |
| func contains(_ string: String, times: Int) -> Bool { | |
| var count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import FoundationModels | |
| struct ContentView: View { | |
| @State private var prompt: String = "" | |
| @State private var response: String = "ここに回答が表示されます" | |
| @State private var isLoading: Bool = false | |
| var body: some View { | |
| VStack(spacing: 20) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Mesh, Vector3, PhysicsAggregate, PhysicsShapeType,} from "@babylonjs/core"; | |
| import Bullet from "./Bullet"; | |
| export default class Player { | |
| private _mesh: Mesh; | |
| private _leftKeyDown = false; | |
| private _rightKeyDown = false; | |
| private _spaceKeyDown = false; | |
| private _shootKeyProcessed = false; | |
| private _aggregate: PhysicsAggregate | null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Mesh, MeshBuilder, Scene, StandardMaterial, Color3, Vector3, PhysicsAggregate, PhysicsShapeType } from "@babylonjs/core"; | |
| let bulletMaterial: StandardMaterial | null = null; | |
| export default class Bullet { | |
| public mesh: Mesh | null; | |
| private _aggregate: PhysicsAggregate | null; | |
| private _observerHandle: any; | |
| constructor(scene: Scene, position: Vector3) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private _shoot(): void { | |
| const offset = new Vector3(20, 0, 0); // プレイヤーの前方に配置 | |
| const position = this._mesh.position.add(offset); | |
| new Bullet(this._mesh.getScene(), position); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Mesh, Vector3, Space } from "@babylonjs/core"; | |
| export default class Player { | |
| private _mesh: Mesh; | |
| private _leftKeyDown = false; | |
| private _rightKeyDown = false; | |
| constructor(mesh: Mesh) { | |
| this._mesh = mesh; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| alias(libs.plugins.android.application) | |
| alias(libs.plugins.kotlin.android) | |
| alias(libs.plugins.kotlin.compose) | |
| } | |
| android { | |
| namespace 'com.example.objrecognition' | |
| compileSdk 35 |
NewerOlder