Skip to content

Instantly share code, notes, and snippets.

View ftvoid's full-sized avatar

ftvoid ftvoid

  • from the void
  • the earth
View GitHub Profile
// ステージにオブジェクトを配置する
private GameObject Put(LayoutRow layout) {
var obj = MasterManager.Instance.LoadObject(layout.obj_id);
obj.transform.SetParent(root);
obj.transform.position = new Vector3(layout.x, layout.y);
obj.transform.rotation = Quaternion.Euler(0, 0, layout.rot);
obj.transform.localScale = new Vector3(layout.sx, layout.sy, 1);
var velocity = new Vector2(layout.vx, layout.vy);
foreach ( var motion in obj.GetComponents<IShootableMotion>() )
// 次のオブジェクトを配置する
private void OnLayoutNext() {
var nextLayouts = layoutMaster.GetNext();
if ( nextLayouts.Length > 0 ) {
var nextTime = nextLayouts[0].time;
Observable.Timer(TimeSpan.FromMilliseconds(nextTime))
.Subscribe(x => {
// 初期化
private void Start() {
// TODO : 途中ステージからでもロードできるように対応する
var firstStage = MasterManager.Instance.FirstStage;
layoutMaster = MasterManager.Instance.LoadLayout(firstStage);
OnLayoutNext();
}
using DPV.Master;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UniRx;
using UniRx.Triggers;
using System;
using Core.App;
using DPV.Motion;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DPV.Master {
/// <summary>
/// マスター管理
/// </summary>
public interface IMaster {
void Load(string path);
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DPV.Master {
/// <summary>
/// メインマスター管理
/// </summary>
public class MainMaster : IMaster {
// マスターデータ保存
private void Save<T>(T obj) {
var serializer = new JsonSerializer();
var path = EditorUtility.SaveFilePanel("", "/Assets/Project/Masters/Resources/", "", "json");
if ( string.IsNullOrEmpty(path) ) {
return;
}
using ( var sw = new FileStream(path, FileMode.Create) ) {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DPV.Master;
using UnityEditor;
using System.IO;
namespace DPV {
public class MasterMaker : MonoBehaviour {
[SerializeField]
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DPV.Master {
/// <summary>
/// JSON形式のシリアライザ
/// </summary>
public class JsonSerializer : IMasterSerializer {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DPV.Master {
/// <summary>
/// マスターデータのシリアライザ
/// </summary>
public interface IMasterSerializer {
byte[] Serialize<T>(T obj);