public void Demaged(float demage, string operation) { if (operation.Equals("-")) { HP -= demage; } else if (operation.Equals("+")) { HP += demage; } HP = Mathf.Clamp(HP, 0f, HPMax); if (HP <= 0f) { OnDead?.Invoke(); } var hpMsg = new UiEvent.UiMsgs.Hp() { hp = HP, hpMax = HPMax }; uiMgr.SendEvent(hpMsg); }
public override void Enter() { base.Enter(); process = 1; if (_weaponAttribute.active) { _animator.animator.SetTrigger("pickWeapon"); _animator.animator.SetInteger("weaponTarget", (int)_weaponAttribute.type); _animator.AddEvent("weaponType", (int)_weaponAttribute.type); _iKManager.SetHoldTarget(_weaponAttribute.holdPoint); _iKManager.SetAim(false); _iKManager.SetHold(false); _iKManager.SetLook(true); endTimer.Enter(endTime); pickTimer.Enter(pickTime); _weaponHandle.locked = true; var cutMsg = new UiEvent.UiMsgs.WeaponCut() { texture = _weaponAttribute.cutPicInBattle }; _uiMgr.SendEvent(cutMsg); var ammoMsg = new UiEvent.UiMsgs.Ammo() { ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1f : 0f), mag = _weaponAttribute.mag }; _uiMgr.SendEvent(ammoMsg); var spreadMsg = new UiEvent.UiMsgs.Spread() { value = _weaponAttribute.spread }; _uiMgr.SendEvent(spreadMsg); } else { _weaponAttribute.constraint.weight = 1; foreach (var state in _weaponAttribute.states.Values) { if (!state._name.Equals(this._name)) { if (state._active) { state.Exit(); } } } _weaponAttribute.ready = false; this._exitTick = true; } _iKManager.SetAim(false); _iKManager.SetHold(false); }
void SendSpreadMsg(float v) { var spreadMsg = new UiEvent.UiMsgs.Spread() { value = v }; _uiMgr.SendEvent(spreadMsg); }
public void AddKill(string loser = "") { kill++; tempMultikill++; score += 100; Sound.PlayOneShot(this.audioSource, this.killMsgSound); uiMgr.SendEvent(new UiEvent.UiMsgs.Kill()); Battle.battleMgr.battleKillList.AddKillMsg(this.nickName, loser, (this.attributes.camp == Battle.localPlayerCamp)); OnKill?.Invoke(attributes.camp); SyncData(); }
private void FixedUpdate() { if (weaponAttribute.active) { var visi = false; var posi = Vector3.zero; var aimPoint = myCamera.GetAimPoint(); if (Physics.Raycast(occlusionPoint.position, aimPoint - occlusionPoint.position, out hitInfo, OcclusionSensorDistance, occlusionLayer.layerMask)) { visi = true; posi = hitInfo.point; } if (!velocity.Daim) { visi = false; } var msg = new Dot() { visible = visi, position = posi }; uiMgr.SendEvent(msg); } }
public override void OnUpdate() { var _anim = _animator.animator; AnimatorStateInfo animatorInfo; animatorInfo = _anim.GetCurrentAnimatorStateInfo(animLayer); _iKManager.SetAim(false); _iKManager.SetHold(false); if (animatorInfo.IsTag("reload")) { if (animatorInfo.normalizedTime >= exitTime) { if (_weaponAttribute.bore) { _weaponAttribute.runtimeMag = _weaponAttribute.mag; } else { _weaponAttribute.runtimeMag = _weaponAttribute.mag - 1; _weaponAttribute.bore = true; } var ammoMsg = new UiEvent.UiMsgs.Ammo() { ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1 : 0), mag = _weaponAttribute.mag }; _uiMgr.SendEvent(ammoMsg); this._exitTick = true; } } }
public override void Enter() { base.Enter(); if (!_weaponAttribute.reload) { _iKManager.SetAim(true); } _velocity.Drun = false; _velocity.aiming = true; _camera.FOVtarget = FOV; var spreadMsg = new UiEvent.UiMsgs.Spread() { value = _weaponAttribute.runingSpread + 5f }; _uiMgr.SendEvent(spreadMsg); }
void SendSpreadMsg(float v) { var spreadMsg = new Spread() { value = v }; uiMgr.SendEvent(spreadMsg); }
public override void OnUpdate() { this.timer.Update(); var _anim = _animator.animator; AnimatorStateInfo animatorInfo; animatorInfo = _anim.GetCurrentAnimatorStateInfo(animLayer); _iKManager.SetAim(false); if (process == 1) { _audioSource.PlayOneShot(sounds[0]); process = 2; } if (animatorInfo.IsTag("reload")) { if (process == 2) { if (animatorInfo.normalizedTime >= this.magInTime) { _audioSource.PlayOneShot(sounds[1]); if (_velocity.isLocalPlayer) { if (_weaponAttribute.bore) { _weaponAttribute.runtimeMag = _weaponAttribute.mag; } else { _weaponAttribute.runtimeMag = _weaponAttribute.mag - 1; _weaponAttribute.bore = true; } var ammoMsg = new UiEvent.UiMsgs.Ammo() { ammo = _weaponAttribute.runtimeMag + (_weaponAttribute.bore ? 1 : 0), mag = _weaponAttribute.mag }; _uiMgr.SendEvent(ammoMsg); } process = 3; } } else if (process == 3) { if (!this.timer.isRunning) { this._exitTick = true; process = 4; } } } }