private void Start() { LoadResources resources = new LoadResources(); resources.Initialize(); //アクターの作成とメンバーの追加 ActorDataModel actorData = ActorDataModel.Instance; MemberDataModel memberData = MemberDataModel.Instance; memberData.Add(ActorLogic.Create("Mandrake", 3)); memberData.Add(ActorLogic.Create("Slime", 3)); memberData.Add(ActorLogic.Create("MechanicSoldier", 3)); memberData.Add(ActorLogic.Create("Kyubi", 3)); //エネミーの作成 EnemyDataModel enemyData = EnemyDataModel.Instance; enemyData.Initialize(); enemyData.Add(EnemyLogic.Create("Goblin", 3)); enemyData.Add(EnemyLogic.Create("GreenDragon", 3)); enemyData.Add(EnemyLogic.Create("Goblin", 4)); //アイテム InventoryDataModel.GetInstance().StartUp(); var manager = gameObject.GetComponent <BattleManager>(); manager.Initialize(); }
private float GetAddExpDuration(BattlerSerializable battler, int addExp) { var duration = 2f; var levelUpSize = ActorLogic.VirtualLevelUpSize(battler.uniqId, addExp); Debug.Log(levelUpSize); if (levelUpSize > 0) { duration *= levelUpSize * 0.5f; if (duration > 9f) { return(9f); } } return(duration); }
private void Start() { LoadResources resources = new LoadResources(); resources.Initialize(); //アクターの作成とメンバーの追加 ActorDataModel actorData = ActorDataModel.Instance; MemberDataModel memberData = MemberDataModel.Instance; memberData.Add(ActorLogic.Create("Mandrake", "植物", 1)); memberData.Add(ActorLogic.Create("Slime", "すらりん", 1)); memberData.Add(ActorLogic.Create("MechanicSoldier", "ろぼ兵士", 100)); //memberData.Add(ActorLogic.Create("Kyubi", 1)); //アイテム InventoryDataModel.GetInstance().StartUp(); //ダンジョン DungeonPresenter.GetInstance().Initialize("FirstForest"); }
/// <summary> /// 経験値追加 /// TODO 使わないので仕様をfixしたら消す /// </summary> /// <param name="addExp"></param> /// <returns></returns> private AsyncSubject <Unit> AddExp(int addExp) { AsyncSubject <Unit> subject = new AsyncSubject <Unit>(); _itemTransform.GetComponent <CanvasGroup>() .DOFade(0, 0.2f).Play(); _actorTransform.GetComponent <CanvasGroup>().DOFade(1, 0.2f).Play(); var actors = MemberDataModel.Instance.GetActorData(); var maxDuration = 0f; actors.ForEach(actor => { var duration = GetAddExpDuration(actor, addExp); if (duration > maxDuration) { maxDuration = duration; } }); var countUp = 0; DOVirtual.Float(0, 1, maxDuration, value => { countUp++; if (countUp > 10) { countUp = 0; //TODO SEないほうがいいかも //PlaySe.GetInstance().Play("SE/GaugeUp", 0.4f); } }).SetEase(Ease.InQuad).Play(); actors.ForEach(actor => { var actorObject = Object.Instantiate((GameObject)Resources.Load("Prefabs/GUI/ResultActor"), Vector3.zero, Quaternion.identity, _actorTransform); var image = actorObject.transform.Find("Image").GetComponent <Image>(); image.sprite = MonsterDicionary.GetSprite(actor.monsterId); image.GetComponent <RectTransform>().localScale = MonsterDicionary.GetScale(actor.monsterId); image.SetNativeSize(); var bar = actorObject.transform.Find("ExpBar").GetComponent <Slider>(); bar.value = (float)actor.hasExp / actor.needExp; var needExpText = actorObject.transform.Find("ExpBar/ExpText/Exp/NeedExpText") .GetComponent <TextMeshProUGUI>(); needExpText.text = $"/{actor.needExp.ToString()}"; var hasExpText = actorObject.transform.Find("ExpBar/ExpText/Exp/HasExpText") .GetComponent <TextMeshProUGUI>(); hasExpText.text = actor.hasExp.ToString(); var addExpText = actorObject.transform.Find("ExpBar/AddExpText").GetComponent <TextMeshProUGUI>(); addExpText.text = $"+{addExp}"; var levelText = actorObject.transform.Find("ExpBar/LvText/Level").GetComponent <TextMeshProUGUI>(); levelText.text = actor.level.ToString(); // TODO float virtualHasExp = actor.hasExp; float virtualNeedExp = actor.needExp; int virtualLevel = actor.level; var currentValue = 0f; var duration = GetAddExpDuration(actor, addExp); DOVirtual.Float(0, addExp, duration, value => { var addValue = value - currentValue; currentValue = value; virtualHasExp += addValue; if (virtualHasExp >= virtualNeedExp) { virtualHasExp -= virtualNeedExp; virtualLevel++; virtualNeedExp = ActorLogic.CalcNeedExp(actor.monsterId, virtualLevel); needExpText.text = $"/{((int) virtualNeedExp).ToString()}"; levelText.text = virtualLevel.ToString(); LevelUpPopUp(actorObject.transform); PlaySe.GetInstance().Play("SE/LevelUp"); } hasExpText.text = ((int)virtualHasExp).ToString(); bar.value = virtualHasExp / virtualNeedExp; }).SetEase(Ease.InQuad).Play(); }); return(subject); }