Exemple #1
0
    void Start()
    {
        startPos = transform.position;
        BattleGroupElement be = GetComponent <BattleGroupElement>();

        be.SetBattleGroup(battleGroup);
    }
Exemple #2
0
    protected override void Awake()
    {
        Instance   = this;
        battleType = BattleType.DayDoungen;
        //unitArea = GetComponentInChildren<BoxCollider>();
        BattleGroupElement be = GetComponentInChildren <BattleGroupElement>();

        if (be)
        {
            be.SetBattleGroup(this);
        }

        //스폰포인트 설정
        if (spawnPoints == null || spawnPoints.Count == 0)
        {
            spawnPoints = GetComponentsInChildren <SpawnPoint>().ToList();
        }


        List <MeshRenderer> sr  = streetRoot.GetComponentsInChildren <MeshRenderer>().ToList().OrderBy(x => x.transform.position.x).ToList();
        MeshRenderer        min = sr[0];
        MeshRenderer        max = sr[sr.Count - 1];

        spwonPointXMin = min.bounds.min.x;
        spwonPointXMax = max.bounds.max.x;
    }
Exemple #3
0
    //#####################################################################################################

    protected virtual void Awake()
    {
        BattleGroupElement be = GetComponentInChildren <BattleGroupElement>();

        if (be)
        {
            be.SetBattleGroup(this);
        }

        artifactController = gameObject.GetComponent <ArtifactController>();
        if (artifactController == null)
        {
            artifactController = gameObject.AddComponent <ArtifactController>();
        }

        battleQuestController = gameObject.GetComponent <BattleQuestController>();
        if (battleQuestController == null)
        {
            battleQuestController = gameObject.AddComponent <BattleQuestController>();
        }

        battleLevelUpController = gameObject.GetComponent <BattleLevelUpController>();
        if (battleLevelUpController == null)
        {
            battleLevelUpController = gameObject.AddComponent <BattleLevelUpController>();
        }



        //스폰포인트 설정
        if (spawnPoints == null || spawnPoints.Count == 0)
        {
            spawnPoints = GetComponentsInChildren <SpawnPoint>().ToList();
        }


        List <MeshRenderer> sr  = streetRoot.GetComponentsInChildren <MeshRenderer>().ToList().OrderBy(x => x.transform.position.x).ToList();
        MeshRenderer        min = sr[0];
        MeshRenderer        max = sr[sr.Count - 1];

        spwonPointXMin = min.bounds.min.x;
        spwonPointXMax = max.bounds.max.x;
    }
Exemple #4
0
    //################################################################################
    void Start()
    {
        renderers = GetComponentsInChildren <Renderer>(true);

        particleRenderers = GetComponentsInChildren <ParticleSystemRenderer>(true);

        for (int i = 0; i < renderers.Length; i++)
        {
            if (renderers[i].gameObject.name == "Shadow")
            {
                shadowRenderer = renderers[i];
                break;
            }
        }

        be = GetComponentInParent <BattleGroupElement>();

        startSize = transform.localScale;
        //startSizeAmount = transform.localScale.y;
    }
Exemple #5
0
    IEnumerator AddParticle(Buff buff)
    {
        if (string.IsNullOrEmpty(buff.baseData.effectPrefab))
        {
            yield break;
        }

        string effectPrefabName = buff.baseData.effectPrefab;
        string buffID           = buff.baseData.id;


        Transform parent = owner.transform;

        if (owner.collider)
        {
            parent = owner.collider.transform;
        }

        //이펙트 연출 띄움
        GameObject effectObj = Battle.GetObjectInPool(effectPrefabName);

        if (!effectObj)
        {
            GameObject effectPrefab = null;
            yield return(StartCoroutine(AssetLoader.Instance.LoadGameObjectAsync("buff", buff.baseData.effectPrefab, x => effectPrefab = x)));

            if (owner.isDie)
            {
                yield break;
            }

            if (!effectPrefab)
            {
                yield break;
            }



            effectObj      = Instantiate(effectPrefab, parent, false);
            effectObj.name = effectPrefabName;

            Battle.AddObjectToPool(effectObj);
        }

        effectObj.transform.parent   = parent;
        effectObj.transform.position = parent.transform.position;

        buff.effectObject = effectObj;

        OrderController oc = effectObj.GetComponent <OrderController>();

        if (!oc)
        {
            oc = effectObj.AddComponent <OrderController>();
        }
        oc.parent = owner.GetComponent <OrderController>();

        BattleGroupElement be = effectObj.GetComponent <BattleGroupElement>();

        if (!be)
        {
            be = effectObj.AddComponent <BattleGroupElement>();
        }
        be.SetBattleGroup(owner.battleGroup);

        effectObj.SetActive(true);

        if (!buff.effectObject.activeInHierarchy)
        {
            yield break;
        }

        ParticleSystem particle = buff.effectObject.GetComponentInChildren <ParticleSystem>();

        if (particle)
        {
            particle.Play();
        }

        Animation anim = buff.effectObject.GetComponentInChildren <Animation>();

        if (anim)
        {
            anim.Play();
        }

        Animator animator = buff.effectObject.GetComponentInChildren <Animator>();

        if (animator)
        {
            animator.SetTrigger("start");
        }
    }
Exemple #6
0
    void OnDie(BattleUnit unit)
    {
        //사망하면 모든 행동 종료
        //Issue: 예외도 있어야 하나?
        //skeletonAnimation.state.SetAnimation(0, idleAnimation, true);

        if (spineAnimationDie != null)
        {
            skeletonAnimation.state.SetAnimation(0, spineAnimationDie, false);
            skeletonAnimation.state.ClearTrack(1);
        }

        //if (skeletonAnimation.state.Data.SkeletonData.FindAnimation("Die") != null)
        //    skeletonAnimation.state.SetAnimation(0, "Die", false);
        else
        {
            skeletonAnimation.state.SetAnimation(0, spineAnimationIdle, false);

            if (coroutineFadeOut == null)
            {
                coroutineFadeOut = StartCoroutine(FadeOut());
            }
        }

        if (!isSummonded && tomestone)
        {
            BattleGroupElement be = tomestone.GetComponentInChildren <BattleGroupElement>();
            if (be)
            {
                be.SetBattleGroup(battleGroup);
            }

            //OrderController oc = tomestone.GetComponentInChildren<OrderController>();
            //if (oc)
            //    oc.parent = orderController;

            tomestone.gameObject.SetActive(true);
            if (airborne)
            {
                tomestone.transform.position = beforeAirbornePos;
            }
            else
            {
                tomestone.transform.position = transform.position;
            }
            tomestone.transform.localScale = transform.localScale;
        }

        if (objShadow)
        {
            objShadow.gameObject.SetActive(false);
        }

        //skeletonAnimation.gameObject.SetActive(false);
        //skeletonAnimation.enabled = false;

        //아군 영웅만 자동 부활 함
        //Todo: 자동 부활 여부에 의해서 판단해야 할 듯
        if (!isSummonded && team == Team.Red)
        {
            return;

            if (coroutineWaitToRevive != null)
            {
                return;
            }

            coroutineWaitToRevive = StartCoroutine(WaitToRevive());
        }
        else if (isSummonded || team == Team.Blue)
        {
            if (coroutineWaitToDespawn != null)
            {
                StopCoroutine(coroutineWaitToDespawn);
            }

            coroutineWaitToDespawn = StartCoroutine(WaitToDespawn());
        }



        //battleGroup.Die(transform.position);
        //ReGen();
    }