Пример #1
0
    // TODO: change to OnHPChanged
    void OnUnitTookDamage(Unit unit, Damage dam)
    {
        var targetTrans = unit is Hero ? heroTransform : enemyTransform;

        FloatingText.Create(targetTrans, $"-{dam.amount}", Color.red, dam.icon);
        var HPBar = unit is Hero ? heroHPBar : enemyHPBar;

        HPBar.SetTargetShiftingValue((float)unit.HP / unit.HPMax);

        var anim = unit is Hero ? animHero : animEnemy;

        anim.animator.SetTrigger("Take Damage");
    }
        private void DisplayMonsterInformationEnd(string labelInfo)
        {
            if (_floatingText != null)
            {
                return;
            }
            Canvas.enabled               = false;
            _floatingText                = FloatingText.Create();
            _floatingText.fadeOutText    = true;
            _floatingText.tweenScaleFunc = TweenScaleFunctions.QuadraticEaseOut;
            _floatingText.ConfigureText();
            if (_is360Level)
            {
                _floatingText.transform.SetParent(transform.parent);
            }
            _floatingText.tweenEndPosition = new Vector3(BasePosition.x, BasePosition.y + 0.75f * (_is360Level ? 60f : 1f), BasePosition.z);
            _floatingText.DisplayText(BasePosition, BaseRotation, BaseScale, labelInfo, 3.5f);
            switch (CurrentStatus)
            {
            case MonsterStatus.Killed:
                SaveDataManager.instance.SaveData.killMonsterCount += 1;
                if (SaveDataManager.instance.SaveData.killMonsterCount % 4 == 0)
                {
                    QuestManager.instance.AddNewPickableQuest();
                }
                ExperienceSystem.instance.AddFightExperience(9 + (uint)_monsterDifficulty);
                break;

            case MonsterStatus.Flown:
                SaveDataManager.instance.SaveData.flownMonsterCount += 1;
                //ExperienceSystem.instance.AddFightExperience(9 + (uint)_monsterDifficulty); //TODO: Remove later, FPFC testing
                break;
            }

            ModifierManager.timeWarper?.DisableModifier();
            Destroy(ScoreControllerManager);
            MonsterGenerator.instance.EndCurrentMonsterEncounter();
        }
Пример #3
0
        /// <summary>
        /// 显示飘字
        /// </summary>
        /// <param name="amount"></param>
        private void OnPopupFloatingText(int amount)
        {
            var pos = gameObject.transform.position;

            FloatingText.Create(battleScene, pos, amount);
        }
Пример #4
0
    /// <summary>
    /// 연출 시작
    /// </summary>
    public void StartDirecting()
    {
        StartCoroutine(Coroutine());

        IEnumerator Coroutine()
        {
            isDirecting = true;
            var waitObject = new WaitForSeconds(0.5f);

            #region 심사위원 생성 및 이동
            int i = 0;
            foreach (var judgePrefab in judgePrefabs.OrderBy((item) => Random.Range(0, int.MaxValue)))
            {
                var judgeInstance = Instantiate(judgePrefab);
                judgeInstance.transform.position = pathNodeManager.exitNode.transform.position;
                judgeInstance.SetTarget(pathNodeManager.judgeNodes[i].transform);

                judgeInstances.Add(judgeInstance);

                i++;
                yield return(waitObject);
            }
            #endregion

            #region 심사위원이 위치할때까지 대기
            bool isWait;
            do
            {
                isWait = false;
                foreach (var judgeInstance in judgeInstances)
                {
                    // 심사위원이 아직 위치에 도착하지 않았으면 계속 대기
                    if (judgeInstance.targetTransform != null)
                    {
                        isWait = true;
                        break;
                    }
                    //// 도착했으면 정면을 바라봄
                    //else
                    //{
                    //    judgeInstance.RandomDirection();
                    //}
                }
                if (isWait)
                {
                    yield return(null);
                }
            } while (isWait);
            #endregion

            #region 위치했으면 텍스트 띄우기
            var text = FloatingText.Create(judgeInstances[judgeInstances.Count - 1].transform, new Vector3(1, 1), "");

            waitObject = new WaitForSeconds(1);
            // 귀찮으므로 하드코딩
            {
                text.Text = "심사숙고중";
                yield return(waitObject);

                text.Text = "심사숙고중.";
                yield return(waitObject);

                text.Text = "심사숙고중..";
                yield return(waitObject);

                text.Text = "심사숙고중...";
                yield return(waitObject);

                text.Text = "한눈 파는 중";
                yield return(waitObject);

                text.Text = "한눈 파는 중.";
                yield return(waitObject);

                text.Text = "한눈 파는 중..";
                yield return(waitObject);

                text.Text = "한눈 파는 중...";
                yield return(waitObject);

                text.Text = "쓰레기 확인 중";
                yield return(waitObject);

                text.Text = "쓰레기 확인 중.";
                yield return(waitObject);

                text.Text = "쓰레기 확인 중..";
                yield return(waitObject);

                text.Text = "쓰레기 확인 중...";
                yield return(waitObject);

                text.Text = "물 마시는 중";
                yield return(waitObject);

                text.Text = "물 마시는 중.";
                yield return(waitObject);

                text.Text = "물 마시는 중..";
                yield return(waitObject);

                text.Text = "물 마시는 중...";
                yield return(waitObject);

                text.Text = "의논 중";
                yield return(waitObject);

                text.Text = "의논 중.";
                yield return(waitObject);

                text.Text = "의논 중..";
                yield return(waitObject);

                text.Text = "의논 중...";
                yield return(waitObject);
            }
            Destroy(text.gameObject);
            #endregion

            #region 심사위원 퇴장
            foreach (var judgeInstance in judgeInstances)
            {
                judgeInstance.SetTarget(pathNodeManager.exitNode.transform);
            }
            #endregion

            #region 심사 결과창
            // 목표 인지도 설정
            int goal          = 0;
            int successReward = 0;
            int failReward    = 0;
            switch (PlayData.CurrentData.Level)
            {
            case 1:
                goal          = 500;
                successReward = 30000;
                failReward    = 5000;
                break;

            case 2:
                goal          = 1500;
                successReward = 50000;
                failReward    = 5000;
                break;

            default:
                goal          = int.MaxValue;
                successReward = 0;
                failReward    = 0;
                break;
            }

            if (PlayData.CurrentData.Awareness > goal)
            {
                // 퀘스트 트리거
                if (PlayData.CurrentData.Level == 0)
                {
                    QuestManager.Trigger(ProjectTrader.Datas.QuestData.GoalType.BronzeToSilver, 1);
                }
                else if (PlayData.CurrentData.Level == 1)
                {
                    QuestManager.Trigger(ProjectTrader.Datas.QuestData.GoalType.SilverToGold, 1);
                }

                // 상금 지급
                PlayData.CurrentData.Money += successReward;
                // 등급 업 처리
                PlayData.CurrentData.Level += 1;
                resultWindow.ShowSucess(successReward);

                FindObjectOfType <TextUiControl>().CreativeTextBox(0, 0, 300, "업그레이드는 영업이\n끝난후 진행됩니다.", 4);
            }
            else
            {
                PlayData.CurrentData.Money += failReward;
                resultWindow.ShowFail(failReward);
            }
            isDirecting = false;
            #endregion

            #region 심사위원 나가기 체크
            do
            {
                isWait = false;
                foreach (var judgeInstance in judgeInstances)
                {
                    // 심사위원이 아직 위치에 도착하지 않았으면 계속 대기
                    if (judgeInstance != null)
                    {
                        if (judgeInstance.targetTransform != null)
                        {
                            isWait = true;
                            //break;
                        }
                        // 도착했으면 삭제
                        else
                        {
                            Destroy(judgeInstance.gameObject);
                        }
                    }
                }
                if (isWait)
                {
                    yield return(null);
                }
            } while (isWait);
            judgeInstances.Clear();
            #endregion
        }
    }