add シーンリロード(デバッグ) fixポイント追加処理

This commit is contained in:
kimura 2022-06-20 18:30:25 +09:00
parent aa08a62cdc
commit 87f562552f
4 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#if UNITY_EDITOR
using System;
using UniRx;
using UniRx.Triggers;
using UnityEngine;
namespace MyGame.Scenes.MiniGame.Scripts
@ -39,7 +40,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
lineRendererFront.endColor = Color.green;
var boundsSize = character.GetComponent<Collider2D>()?.bounds.size ?? default;
var centerOffset = new Vector3(-boundsSize.x / 2, -boundsSize.y / 2);
var centerOffset = new Vector3(-boundsSize.x / 2, boundsSize.y / 2);
var frontOffset = new Vector3(boundsSize.x / 2, -boundsSize.y / 2);
lineRendererCenter.SetPosition(0, character.position + centerOffset);
@ -53,6 +54,13 @@ namespace MyGame.Scenes.MiniGame.Scripts
lineRendererFront.positionCount++;
lineRendererFront.SetPosition(lineRendererFront.positionCount-1, character.position + frontOffset);
}).AddTo(this);
this.UpdateAsObservable()
.Where(_ => Input.GetKeyDown(KeyCode.R))
.Subscribe(_ =>
{
UnityEngine.SceneManagement.SceneManager.LoadScene("MiniGame");
}).AddTo(this);
}
}
}

View File

@ -119,7 +119,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
switch (item.ItemType)
{
case StageItem.Type.Item1:
headerView.AddCount();
headerView.AddCount(item.Point);
break;
case StageItem.Type.Obstacle:
player.Hit();

View File

@ -32,9 +32,9 @@ namespace MyGame.Scenes.MiniGame.Scripts
timeCount.Value = 0;
}
public void AddCount()
public void AddCount(int value)
{
itemCount.Value++;
itemCount.Value += value;
}
public void ChangeTimeCount(float newTime)

View File

@ -134,4 +134,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/MyGame/Scenes/marketing/CustomizeExplanation.unity
guid: dd7c837547bf89f489bc36b6a2ebbca4
- enabled: 1
path: Assets/MyGame/Scenes/MiniGame/MiniGame.unity
guid: c21a0a611342d4e4b90e83df43aa3e5e
m_configObjects: {}