private static void ApplyMonsterChanges(ClassicStageInfo self, StageInfo stage) { var monsters = self.GetFieldValue <DirectorCardCategorySelection>("monsterCategories"); var monsterCards = new List <DirectorCardHolder>(); foreach (var cat in monsters.categories) { MonsterCategory monstCat = GetMonsterCategory(cat.name); InteractableCategory interCat = GetInteractableCategory(cat.name); foreach (var t in cat.cards) { monsterCards.Add(new DirectorCardHolder { InteractableCategory = interCat, MonsterCategory = monstCat, Card = t }); } } MonsterActions?.Invoke(monsterCards, stage); var monsterBasic = new List <DirectorCard>(); var monsterSub = new List <DirectorCard>(); var monsterChamp = new List <DirectorCard>(); foreach (var hold in monsterCards) { switch (hold.MonsterCategory) { case MonsterCategory.BasicMonsters: monsterBasic.Add(hold.Card); break; case MonsterCategory.Champions: monsterChamp.Add(hold.Card); break; case MonsterCategory.Minibosses: monsterSub.Add(hold.Card); break; } } for (int i = 0; i < monsters.categories.Length; i++) { DirectorCardCategorySelection.Category cat = monsters.categories[i]; switch (cat.name) { case "Champions": cat.cards = monsterChamp.ToArray(); break; case "Minibosses": cat.cards = monsterSub.ToArray(); break; case "Basic Monsters": cat.cards = monsterBasic.ToArray(); break; } monsters.categories[i] = cat; } }
//RandomStateChange public static IEnumerator ChangeState(this MonsterManager monster) { MonsterActions RandomChangeAction = monster.GetRandomMonsterAction <MonsterActions>(); while (monster.Player != null) { //while (monster.Ani.GetCurrentAnimatorStateInfo(0).normalizedTime <= 1.0f) //{ if (RandomChangeAction == monster.currentAction) { RandomChangeAction = monster.GetRandomMonsterAction <MonsterActions>(); } yield return(null); //} if (!monster.IsTargetPosReach) { yield return(null); continue; } if (monster.currentState == MonsterStates.Dead) { break; } monster.setAction(RandomChangeAction); yield return(CoroutineManager.Instance.Delay); } yield return(null); }
protected override void Start() { Init(data.nbMaxLP); highlighter.SetActive(false); canvas.SetActive(false); base.Start(); actions = GetComponent <MonsterActions>(); }
//행동 설정 public void setAction(MonsterActions newAction) { if (_init) { _actions[currentAction].enabled = false; _actions[currentAction].EndState(); } currentAction = newAction; _actions[currentAction].enabled = true; _actions[currentAction].BeginState(); _ani.SetInteger(_aniParamID, (int)currentAction); }
// Use this for initialization void Start() { if (Application.isPlaying) { CoroutineManager.DoCoroutine(_actionChangeCoroutine); //행동체인지 코루틴 시작 CoroutineManager.DoCoroutine(_moveCoroutine); //이동 코루틴 시작 startState = MonsterStates.Stand; //처음 상태 startAction = this.GetRandomMonsterAction <MonsterActions>(); //랜덤행동 가져오기 setState(startState); //상태 초기화 setAction(startAction); //행동 초기화 _init = true; } }