This file contains 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
using System; | |
using UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Presenter : IDisposable | |
{ | |
//view | |
private View _view; |
This file contains 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
using System; | |
using UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Model | |
{ | |
public IReadOnlyReactiveProperty<int> Value => _value; | |
private IntReactiveProperty _value { set; get; } |
This file contains 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
using UniRx; | |
using UnityEngine; | |
namespace Gauge | |
{ | |
public class Presenter : MonoBehaviour | |
{ | |
//view | |
[SerializeField] private View _view; | |
//model |
This file contains 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
using System; | |
using TMPro; | |
using UniRx; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using DG.Tweening; | |
namespace Gauge | |
{ | |
public class View : MonoBehaviour |
This file contains 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
if (other.gameObject.tag == "爆弾") | |
{ | |
other.GetComponent<IIgnited>(); | |
hit?.Ignited(damege, this.gameObject); | |
} | |
if (other.gameObject.name=="爆弾") | |
{ | |
other.GetComponent<IIgnited>(); | |
hit?.Ignited(damege, this.gameObject); |
This file contains 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 void OnTriggerEnter(Collider other) | |
{ | |
//それぞれのヒット処理を呼び出す | |
var hit = other.GetComponent<IIgnited>(); | |
hit?.Ignited(damege, this.gameObject); | |
} |
This file contains 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 abstract class Enemy : MonoBehaviour | |
{ | |
protected string _name; | |
protected int _hp; | |
public abstract string GetName(); | |
public abstract int GetHp(); | |
public abstract void Attack(int damaged); | |
} |
This file contains 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 abstract class EnemyCreator | |
{ | |
public abstract Enemy Create(string name,int hp); | |
} |
This file contains 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
using UnityEngine; | |
public class FactoryTest : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void Start() | |
{ | |
var augerCreator = new AugerCreator(); | |
var auger=augerCreator.Create("鬼1",120); | |
auger.Attack(120); |
This file contains 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 class AugerCreator : EnemyCreator | |
{ | |
public override Enemy Create(string name, int hp) | |
{ | |
Enemy enemy = new Auger(name,hp); | |
return enemy; | |
} | |
} |
NewerOlder