Example #1
0
    void OnChangedBattlePhase(BattleGroup b)
    {
        if (b != battleGroup)
        {
            return;
        }

        if (b.battlePhase == BattleGroup.BattlePhase.FadeOut)
        {
        }

        //페이드인 시작되면 몬스터건 영웅이건 지네들 스폰포인트 있는 곳으로 돌아감.
        //(페이드아웃이 끝날 때 해야 하는 게 맞지만, 페이드아웃 끝날 때를 알기 힘들어서-귀찮아서- 여기서 함)
        if (b.battlePhase == BattleGroup.BattlePhase.FadeIn)
        {
            if (isDie)
            {
                //부활 대기중이면 중단.
                if (coroutineWaitToRevive != null)
                {
                    StopCoroutine(coroutineWaitToRevive);
                    coroutineWaitToRevive = null;
                }

                //즉시 부활 시킴
                curHP = maxHP;
            }


            SpawnPoint.UnitType t = team == Team.Red ? SpawnPoint.UnitType.Red : SpawnPoint.UnitType.Blue;

            SpawnPoint spawnPoint = b.spawnPoints.Find(x => x.unitType == t);
            if (!spawnPoint)
            {
                return;
            }

            //다음 스폰 전까지 안 움직이게 막음
            isFinishSpawned = false;

            if (spawnPoint != null)
            {
                transform.position = spawnPoint.transform.position;
            }
        }
    }
Example #2
0
    public void ReGen(bool keepPosition = false)
    {
        //피 꽉 채움
        //curHP = maxHP;

        //부활 가능
        if (!isSummonded)
        {
            canResurrect = true;
        }

        tomestone = null;

        if (skeletonAnimation != null)
        {
            skeletonAnimation.gameObject.SetActive(true);
            skeletonAnimation.enabled = true;
        }

        //제자리에서 시작이면 스폰포인트로 안 감
        if (!keepPosition && battleGroup)
        {
            //스폰 가능 한 곳중 랜덤 한 곳에서 스폰
            SpawnPoint.UnitType t = team == Team.Red ? SpawnPoint.UnitType.Red : SpawnPoint.UnitType.Blue;
            List <SpawnPoint>   availableSpawnPoints = battleGroup.spawnPoints.FindAll(x => !x.isAssigned && x.unitType == t);

            int r = UnityEngine.Random.Range(0, availableSpawnPoints.Count);
            transform.position = availableSpawnPoints[r].transform.position;
            lastSpawnTime      = Time.time;
        }


        transform.localScale = originalScale;

        //누적 데미지 초기화
        cumulativeDamage = 0;

        //피 꽉 채움
        curHP = maxHP;

        isFinishSpawned = true;
    }