Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (_PlayerController == null)
     {
         _PlayerController = transform.parent.GetComponent <wt_PlayerController>();
     }
 }
Пример #2
0
 void LateUpdate()
 {
     if (_PlayerCont == null)
     {
         _PlayerCont = GamePlayManager.Instance._PlayerManager._PlayerController;
     }
 }
Пример #3
0
    void OnTriggerEnter_Hero(Collider2D other)
    {
        if (other.tag == "P_AttackRange" ||
            other.tag == "Bolt"
            )
        {
            return;
        }
//        Debug.Log("~~~~~~~~~~~~~~~~~~OnTriggerEnter_Hero : " + other.tag);
        Instantiate(explosion, transform.position, transform.rotation);
        if (other.tag == "Asteroid" ||
            other.tag == "Bolt_enemy"
            )
        {
            wt_PlayerController hero   = _RootObject.GetComponent <wt_PlayerController>();
            DamageTrigger       damage = other.GetComponent <DamageTrigger>();
            if (damage)
            {
                hero.Hurt(damage._DamageValue);
            }

            if (other.tag == "Bolt_enemy")
            {
                Destroy(other.gameObject);
            }
        }
    }
Пример #4
0
    public void SpawnPlayer()
    {
        if (_PlayerController)
        {
            Destroy(_PlayerController.gameObject);
        }

        GameObject obj = (GameObject)Instantiate(_pfPlayerController, _SpawnPos.position, _SpawnPos.rotation);

        obj.transform.parent = this.transform;

        _PlayerController = obj.GetComponent <wt_PlayerController>();
    }
Пример #5
0
    void LateUpdate()
    {
        {
            if (_UnitInfo == null)
            {
                if (_BaseObject == null)
                {
                    Enemy en = this.transform.parent.GetComponent <Enemy>();
                    if (en)
                    {
                        _UnitInfo = en._UnitInfo;
                    }
                    else
                    {
                        wt_PlayerController cont = this.transform.parent.GetComponent <wt_PlayerController>();
                        if (cont)
                        {
                            _UnitInfo = cont._UnitInfo;
                        }
                    }
                }
                else
                {
                    Enemy en = _BaseObject.GetComponent <Enemy>();
                    if (en)
                    {
                        _UnitInfo = en._UnitInfo;
                    }
                    else
                    {
                        wt_PlayerController cont = _BaseObject.GetComponent <wt_PlayerController>();
                        if (cont)
                        {
                            _UnitInfo = cont._UnitInfo;
                        }
                    }
                }
            }
            else
            {
                if (_UnitInfo._DeathFlag == false)
                {
                    if (_HPBar.gameObject.activeInHierarchy == false)
                    {
                        GameWorld.SetActiveRecursively(_HPBar.gameObject, true);
                    }

                    this.transform.rotation = Quaternion.identity;

                    //월드좌표의 카메라객체입니다.
                    if (_AICam == null)
                    {
                        _AICam = NGUITools.FindCameraForLayer(this.gameObject.layer);
                        if (_AICam == null)
                        {
                            return;
                        }
                    }

                    //GUI객체의 카메라 객체입니다.
                    Camera guiCam = UICamera.currentCamera;
                    if (guiCam == null)
                    {
                        return;
                    }

                    //타겟의 포지션을 월드좌표에서 ViewPort좌표로 변환하고 다시 ViewPort좌표를 NGUI월드좌표로 변환합니다.
                    Vector3 targetPos = _UnitInfo.transform.position + targetOffset;
                    Vector3 pos       = guiCam.ViewportToWorldPoint(_AICam.WorldToViewportPoint(targetPos));
                    //Z는 0으로...
                    pos.z = 0f;

                    _HPBar.transform.position = pos;
                    _HPBar.sliderValue        = (float)_UnitInfo._HP / (float)_UnitInfo._HP_Default;

                    if (_Lb_Lv)
                    {
                        _Lb_Lv.transform.position = pos + _lb_LvOffset;
                        _Lb_Lv.text = "Lv" + _UnitInfo._Level.ToString();
                    }

                    return;
                }
                else
                {
                    if (_HPBar.gameObject.activeInHierarchy == true)
                    {
                        GameWorld.SetActiveRecursively(_HPBar.gameObject, false);
                    }
                    if (_Lb_Lv)
                    {
                        if (_Lb_Lv.gameObject.activeInHierarchy == true)
                        {
                            GameWorld.SetActiveRecursively(_Lb_Lv.gameObject, false);
                        }
                    }
                }
            }
        }
    }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     _PlayerController = transform.parent.GetComponent <wt_PlayerController>();
 }