//换弹 public void OnSwapBullet() { //发消息 LoginMsg.C2S_NPC_Animation msg = new LoginMsg.C2S_NPC_Animation(); msg.npcId = anictr.baseActor.info.guid; msg.animatiom = "SwapBullet"; msg.roomNum = ActorManager.Instance.controlActor.info.roomID; anictr.baseActor.info.sendAnimationNum++; msg.num = anictr.baseActor.info.sendAnimationNum; LoginServerManager.Instance.Server.SendMessage(ActorManager.Instance.controlActor.info.guid, ICmdNum.CmdNum.CS_NPC_Animation, msg, LoginServerManager.Instance.sendTime.interval_3, LoginServerManager.Instance.sendTime.count_3); //动画 anictr.baseActor.info.obj.GetComponent<AnimationControl>().SwapBullet(); anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.curCount = anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.count; //弹药 anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.curCount = anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.count; }
//换枪 public void OnSwapGun() { ////换枪 //anictr.baseActor.info.useGunIndex++; //if (anictr.baseActor.info.useGunIndex > anictr.baseActor.info.m_GunList.Count - 1) // anictr.baseActor.info.useGunIndex = 0; //int index = anictr.baseActor.info.useGunIndex - 1; //if (index < 0) index = anictr.baseActor.info.m_GunList.Count - 1; //anictr.baseActor.info.m_GunList[index].info.obj.SetActive(false); //anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.obj.SetActive(true); //动画事件处理换枪 //发消息 LoginMsg.C2S_NPC_Animation msg = new LoginMsg.C2S_NPC_Animation(); msg.npcId = anictr.baseActor.info.guid; msg.animatiom = "SwapGun"; msg.roomNum = ActorManager.Instance.controlActor.info.roomID; anictr.baseActor.info.sendAnimationNum++; msg.num = anictr.baseActor.info.sendAnimationNum; LoginServerManager.Instance.Server.SendMessage(ActorManager.Instance.controlActor.info.guid, ICmdNum.CmdNum.CS_NPC_Animation, msg, LoginServerManager.Instance.sendTime.interval_3, LoginServerManager.Instance.sendTime.count_3); //动画 anictr.baseActor.info.obj.GetComponent<AnimationControl>().SwapGun(); //频率 if (anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.frequency == 0) fireControl.delta = 10000; else { if (ai.attack_delta_time > 0.0001f) fireControl.delta = ai.attack_delta_time; else fireControl.delta = 1.0f / anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.frequency; } }