Skip to content

Instantly share code, notes, and snippets.

View flushpot1125's full-sized avatar

Limes2018 flushpot1125

View GitHub Profile
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");
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._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);
import SwiftUI
import FoundationModels
import UniformTypeIdentifiers // ファイルタイプ判別用
import UIKit // UIApplication 用
// 文字列拡張:繰り返しパターンの検出用
extension String {
// 特定の部分文字列が何回出現するかをカウント
func contains(_ string: String, times: Int) -> Bool {
var count = 0
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) {
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;
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) {
private _shoot(): void {
const offset = new Vector3(20, 0, 0); // プレイヤーの前方に配置
const position = this._mesh.position.add(offset);
new Bullet(this._mesh.getScene(), position);
}
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;
}
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
android {
namespace 'com.example.objrecognition'
compileSdk 35