예제 #1
0
    void Start()
    {
        GetComponent <NavMeshAgent>().enabled = true;
        m_transform = this.gameObject.GetComponent <Transform>();
        //m_playerTransform = GameObject.FindWithTag("Player").GetComponent<Transform>();
        nvAgent          = this.gameObject.GetComponent <NavMeshAgent>();
        m_animator       = this.gameObject.GetComponent <Animator>();
        m_originPosition = this.transform.position;


        marker = transform.Find("MarkerPivot/Marker.Crosshair").gameObject;
        marker.SetActive(false);

        m_Material = transform.Find("Body").GetComponent <SkinnedMeshRenderer>().material;

        m_deadMat = Instantiate(Resources.Load <Material>("Materials/DissolveTexRampNor"));

        m_playerTransform = null;
        //m_playerTransform = FindPlayer();

        Coroutine();

        //monster info
        m_monsterHp    = m_monsterInfo.monHp;
        m_monsterStr   = m_monsterInfo.monStr;
        m_monsterDef   = m_monsterInfo.monDef;
        m_monsterCri   = m_monsterInfo.monCri;
        m_monsterAtDis = m_monsterInfo.monAtDis;
        m_monsterLevel = m_monsterInfo.monLevel;
        m_monsterName  = m_monsterInfo.monName;

        health       = GetComponent <MonsterHealth>();
        health.GetHp = m_monsterHp;
        health.Init();
    }
예제 #2
0
    void Update()
    {
        if (m_playerTransform != null)
        {
            if (m_playerTransform.gameObject.tag == "Player")
            {
                if (m_playerTransform.GetComponent <PlayerHealth>().IsDie)
                {
                    m_playerTransform = null;
                    curState          = CurrentState.idle;
                }
            }
            else if (m_playerTransform.gameObject.tag == "Mercenary")
            {
                if (m_playerTransform.GetComponent <MercenaryHealth>().IsDie)
                {
                    m_playerTransform = null;
                    curState          = CurrentState.idle;
                }
            }
        }
        AnimatorStateInfo stateinfo = m_animator.GetCurrentAnimatorStateInfo(0);

        if (m_playerTransform == null && traceCheck)
        {
            m_playerTransform = FindPlayer();
        }
        float hp = health.GetHp;

        if (hp <= 0 && !isDead)
        {
            //GetComponent<CapsuleCollider>().isTrigger = true;
            marker.SetActive(false);
            DieToPlayer();
            transform.Find("Body").GetComponent <SkinnedMeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

            m_animator.SetTrigger("Die");
            isDead = true;
        }
        if (isDead)
        {
            nvAgent.isStopped = true;
            float currentRatio = stateinfo.normalizedTime * stateinfo.length;
            transform.Find("Body").GetComponent <SkinnedMeshRenderer>().material = m_deadMat;
            if (stateinfo.IsName("Die") && currentRatio >= stateinfo.length * 0.5f)
            {
                if (f >= 1.0f)
                {
                    transform.Find("Body").GetComponent <SkinnedMeshRenderer>().material = m_Material;
                    health.GetHp = m_monsterHp;
                    health.Init();
                    isDead            = false;
                    traceCheck        = false;
                    m_playerTransform = null;
                    f = 0.0f;
                    gameObject.SetActive(false);
                    return;
                }
                else
                {
                    f += Time.deltaTime;
                    transform.Find("Body").GetComponent <SkinnedMeshRenderer>().material.SetFloat("_DissolveAmount", f);
                }
                if (currentRatio >= stateinfo.length * 0.95f)
                {
                    m_animator.speed = 0;
                }
            }
        }

        if (hitEffectcheck)
        {
            Transform t = transform.Find("RigPelvis/FrontHitPivot/MetalExplosion");
            if (t != null)
            {
                ParticleSystem particle = t.GetComponent <ParticleSystem>();
                particle.gameObject.SetActive(true);
                particle.Play();
            }
            hitEffectcheck = false;
        }
    }
예제 #3
0
    void Start()
    {
        m_MercenartHpUI = GameObject.Find("DCanvas/MercenaryHp");

        m_bossStr = 300.0f;
        m_bossDef = 200.0f;
        m_bossHp  = 10000.0f;
        GameObject[] g = GameObject.FindGameObjectsWithTag("Path");
        for (int i = 0; i < g.Length; ++i)
        {
            m_path.Add(g[i].transform);
        }

        m_path.Sort(SortByName <Transform>);

        m_nvAgent              = GetComponent <NavMeshAgent>();
        m_animator             = GetComponent <Animator>();
        m_bossHealth           = GetComponent <MonsterHealth>();
        m_flyBreathRangeShader = transform.Find("FlyBreathRange").gameObject;
        target = null;

        Transform t = transform.Find("FirstEffect");

        if (t != null)
        {
            ParticleSystem[] ps = t.GetComponentsInChildren <ParticleSystem>(true);
            m_firstParticles.AddRange(ps);
        }
        t = transform.Find("SecondEffect");
        if (t != null)
        {
            ParticleSystem[] ps = t.GetComponentsInChildren <ParticleSystem>(true);
            m_FlyParticles.AddRange(ps);
        }
        t = transform.Find("AreaDamageFire");
        if (t != null)
        {
            ParticleSystem[] ps = t.GetComponentsInChildren <ParticleSystem>(true);
            m_AreaDamageFire.AddRange(ps);
        }
        t = transform.Find("TailAttackEffect");
        if (t != null)
        {
            ParticleSystem[] ps = t.GetComponentsInChildren <ParticleSystem>(true);
            m_tailAttackEffect.AddRange(ps);
        }
        m_bossHealth.GetHp = m_bossHp;
        m_bossHealth.Init();

        m_ui        = GameObject.Find("Canvas").transform.Find("UI").gameObject;
        m_outDgUi   = GameObject.Find("DCanvas").transform.Find("OutDungeon").gameObject;
        m_miniMapUi = GameObject.Find("DCanvas").transform.Find("MiniMap").gameObject;

        m_appearBossImg       = GameObject.Find("DCanvas").transform.Find("Boss").gameObject;
        m_camera              = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MainCamera>();
        m_camera.isAppearBoss = true;
        m_appearBossImg.SetActive(true);
        m_ui.SetActive(false);
        m_outDgUi.SetActive(false);
        m_miniMapUi.SetActive(false);
        m_MercenartHpUI.SetActive(false);
    }