Exemple #1
0
 public void Attack(Transform[] _list)
 {
     list           = _list;
     state          = AnimState.Attack;
     SkillAttackDto = null;
     animatorManage.SetInt("state", (int)state);
 }
Exemple #2
0
 // Update is called once per frame
 private void Update()
 {
     if (dir != Vector3.zero && info.state != AnimState.Attack && info.state != AnimState.Skill1 && info.state != AnimState.Skill2 && info.state != AnimState.Skill2 && info.state != AnimState.Control)
     {
         cc.SimpleMove(dir * info.UserDto.speed);
         if (info.state != AnimState.Run)
         {
             info.state = AnimState.Run;
             animatorManage.SetInt("state", (int)info.state);
         }
     }
 }
Exemple #3
0
 private void DamageBro(DamageDTO damagedto)//damagedto.targets[i][0]//0为被攻击者id,1为收到伤害的值,2被攻击者是否死亡,3是否触发暴击
 {
     for (int i = 0; i < damagedto.targets.Length; i++)
     {
         UserDTO    userDto = IdToUserDtoDic[damagedto.targets[i][0]] as UserDTO;
         GameObject model   = idToGameObjectDic[damagedto.targets[i][0]];
         if (userDto != null)
         {
             if (userDto.id >= 0)                       //受到伤害的是否为玩家
             {
                 if (userDto.id == GameData.UserDto.id) //受到攻击为本人,更新ui界面的数据
                 {
                     GameData.SetHpMp(-damagedto.targets[i][1]);
                 }
                 else
                 {
                     userDto.hp -= damagedto.targets[i][1];
                     if (userDto.hp <= 0)
                     {
                         userDto.hp = 0;
                     }
                 }
                 //更新玩家血条数据
                 model.transform.Find("infoUi").GetComponent <CameraFacingBillboard>().SetInfo(userDto.name, (float)userDto.hp / userDto.maxHp, (float)userDto.mp / userDto.maxMp);
             }
             else
             {
                 model.transform.Find("infoUi").GetComponent <CameraFacingBillboard>().SetInfo(userDto.name, (float)userDto.hp / userDto.maxHp);
             }
             Info info = model.GetComponent <Info>();
             InitFallBoold(info, damagedto.targets[i][1], Color.red, damagedto.targets[i][3]);//实例化掉血
             AnimatorManage animatorManage = model.GetComponent <AnimatorManage>();
             info.state = AnimState.Control;
             animatorManage.SetInt("state", (int)AnimState.Control);
             if (damagedto.targets[i][2] == 0 || userDto.hp <= 0)
             {
                 if (userDto.id == GameData.UserDto.id)//自己死亡,显示复活时间和开启ui遮罩
                 {
                     mask.gameObject.SetActive(true);
                     fuhuoText.gameObject.SetActive(true);
                     timer   = 11;
                     isFuhuo = true;
                 }
                 info.state = AnimState.Die;
                 animatorManage.SetInt("state", (int)AnimState.Die);
             }
         }
     }
 }
Exemple #4
0
    private void ReviveBro(int id)
    {
        UserDTO    userDto = IdToUserDtoDic[id] as UserDTO;
        GameObject go      = idToGameObjectDic[id];

        if (userDto != null)
        {
            userDto.hp = (int)(userDto.maxHp * 0.5);
            userDto.mp = (int)(userDto.maxMp * 0.5);
            Info           info           = go.GetComponent <Info>();
            AnimatorManage animatorManage = go.GetComponent <AnimatorManage>();
            info.state = AnimState.Idle;
            animatorManage.SetInt("state", info.state);
            go.transform.Find("infoUi")
            .GetComponent <CameraFacingBillboard>()
            .SetInfo(userDto.name, (float)userDto.hp / userDto.maxHp, (float)userDto.mp / userDto.maxMp);
            go.transform.position = fuhuoTransform.position;


            if (id == GameData.UserDto.id)
            {
                isFuhuo = false;
                mask.gameObject.SetActive(false);
                fuhuoText.gameObject.SetActive(false);
                GameData.SavaHpMp(userDto.hp, userDto.mp);
            }
        }
    }