Exemple #1
0
    void ItemThrow() //아이템 플레이어 정방향으로 던지기
    {
        itemCntrl cntrl = getItem.GetComponent <itemCntrl>();

        cntrl.throwChar   = gameObject;
        cntrl.isDestroyOK = true;
        getItem           = null;

        sThrowObj throwObj = new sThrowObj((int)eMSG.em_THROWOBJ);

        SocketServer.SingleTonServ().SendMsg(throwObj);

        Debug.Log("item throw");
    }
    void ItemThrow()
    {
        getItem.GetComponent <Rigidbody>().useGravity = true;
        getItem.GetComponent <Rigidbody>().velocity   = transform.forward * 15;
        itemCntrl cntrl = getItem.GetComponent <itemCntrl>();

        cntrl.isDestroyOK = true;
        getItem           = null;
        transform.Find("Canvas").Find("ThrowPoint").gameObject.SetActive(false);

        sThrowObj throwObj = new sThrowObj((int)eMSG.em_THROWOBJ);

        SocketServer.SingleTonServ().SendMsg(throwObj);
    }
    private void Update()
    {
        if (enemyHp != nowHp)
        {
            enemyHp = nowHp;
            enemyHpBar.changeHpBar(enemyHp);
            hpText.text = "Enemy Hp: " + enemyHp;
            if (enemyHp <= 0)
            {
                playerAniCon.PlayDeath("Death");
            }
        }

        if (MoveLimit(enemyPos.x, transform.position.x) ||
            MoveLimit(enemyPos.y, transform.position.y) || MoveLimit(enemyPos.z, transform.position.z)) //움직임
        {
            transform.position = Vector3.Lerp(transform.position, enemyPos, 0.5f);
        }

        if (atkAni == true) //공격
        {
            atkAni = false;
            string atkName = "";
            if (atkAniNum == 0)
            {
                atkName = "Attack01";
            }
            else if (atkAniNum == 1)
            {
                atkName = "Attack02";
            }
            else if (atkAniNum == 2)
            {
                atkName = "Critical01";
            }
            else if (atkAniNum == 3)
            {
                atkName = "Critical02";
            }

            playerAniCon.PlayAtkDmg(atkName);
            if (weaponType == (int)eWEAPON.em_BOW)
            {
                effSound.PlayEff((int)eEFFSOUND.em_ARROW);
            }
            else
            {
                if (atkAniNum % 2 == 0)
                {
                    effSound.PlayEff((int)eEFFSOUND.em_SWING1);
                }
                if (atkAniNum % 2 == 1)
                {
                    effSound.PlayEff((int)eEFFSOUND.em_SWING2);
                }
            }
            StartCoroutine(EndAni(playerAniCon.GetAniLength(atkName)));
        }
        else if (MoveLimit(enemyPos.x, transform.position.x) || MoveLimit(enemyPos.z, transform.position.z))
        {
            playerAniCon.PlayAnimation("Move");//움직임 애니메이션(점프일때 적용x)
            Debug.Log("enemy Move");
        }
        else //가만히 있을 때 애니메이션
        {
            playerAniCon.PlayAnimation("Idle");
        }

        if (enemyRot != transform.rotation) //회전
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, enemyRot, 0.5f);
        }

        if (objGet == true)//물건 들기
        {
            objGet = false;
            getObj = s_itemSpawn2.GetObj(objNum);
            getObj.GetComponent <Rigidbody>().useGravity = false;
            Vector3 newPos = transform.position;
            newPos.y += 5;
            getObj.transform.position = newPos;
        }

        if (objThrow == true)//물건 던지기
        {
            objThrow = false;
            itemCntrl cntrl = getObj.GetComponent <itemCntrl>();
            cntrl.isDestroyOK = true;
            cntrl.TransferItem(targetPos);
        }
    }