public void CheckLiveUnit(Unit.UnitController unit, Unit.UnitController damagedUnit, DataWeapons weapon) { HelthCheck helthCheck = damagedUnit.GetComponent <HelthCheck>(); helthCheck.whoShoot = unit; helthCheck.damagedWeapon = weapon; }
protected void grdEmployees_ItemDatabound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { this.employees = e.Item.DataItem as EmployeesInfo; Unit.UnitController objUnit = new Unit.UnitController(); ImageButton imgDelete = e.Item.FindControl("imgDelete") as ImageButton; Label lblPosition = e.Item.FindControl("lblPosition") as Label; Label lblParentUnit = e.Item.FindControl("lblParentUnit") as Label; Label lblCurrentUnit = e.Item.FindControl("lblCurrentUnit") as Label; if (imgDelete != null) { imgDelete.Attributes.Add("onClick", "javascript:return confirm('Bạn có muốn xóa');"); } //if (lblPosition != null) //{ // Position.PositionController objPosition = new Position.PositionController(); // lblPosition.Text = objPosition.GetPosition(this.employees.positionid).name; //} if (lblParentUnit != null) { lblParentUnit.Text = objUnit.GetUnit(objUnit.GetUnit(this.employees.unitid).parentid).name; } if (lblCurrentUnit != null) { lblCurrentUnit.Text = objUnit.GetUnit(this.employees.unitid).name; } } }
public void SetPlayerMoveSettings(Unit.UnitController unit) { m_PlayerTransform = unit.transform; animator = unit.animator; m_ChController = unit.chController; speedWalk = unit.speedWalk; }
public void Shooting(Unit.UnitController unit) { DataWeapons weapon = unit.bulletsQuantity.currentWeapon; LinkManager.instance.bulletController.BulletsCount(unit); AnimShooting(unit, true); m_AudioSourceShooting.PlayOneShot(weapon.SoundShot); }
public IEnumerator NoAmmo(Unit.UnitController unit) { m_AudioSourceShooting.PlayOneShot(m_SoundNoAmmo); unit.shootingCheck.DisableShooting(); yield return(new WaitForSeconds(0.3f)); unit.shootingCheck.isNoAmmo = true; unit.shootingCheck.EnableShooting(); }
public void AddKillToList(Unit.UnitController unit, Unit.UnitController damagedUnit, DataWeapons weapon) { EventMurderParameters parameters; GameObject createdMurederEvent = Instantiate(m_EventMurder, m_ParrentForEventMurder) as GameObject; parameters = createdMurederEvent.GetComponent <EventMurderParameters>(); parameters.nameUnit1.text = unit.nickname; parameters.nameUnit2.text = damagedUnit.nickname; parameters.iconWeapon.sprite = weapon.Icon; }
public override void TakeBulletFromPool(Unit.UnitController unit) { var offsetBulletPos = 0.0f; for (int i = 1; i <= unit.bulletsQuantity.currentWeapon.QuantityBulletsPerShot; i++) { StartRaycast(unit, offsetBulletPos); TakeBulletFromPool(unit, offsetBulletPos); offsetBulletPos = IdentifyMultipleBullets(unit, i, offsetBulletPos); } }
public void SetColorBar(Unit.UnitController unit) { if (unit.isEnemy) { unit.helthbarUnit.helthbar.color = m_Enemy; } else { unit.helthbarUnit.helthbar.color = m_Friendly; } }
private void Start() { m_LinkManager = LinkManager.instance; if (m_LinkManager.player != null && target == null) { target = m_LinkManager.player.transform; } m_BotUnit = GetComponent <Unit.UnitController>(); m_BotTransform = transform; }
public void StartRaycast(Unit.UnitController unit, float offsetBulletPos) { Vector3 pointForBullets = unit.pointForGenerateBullets.position; Vector3 startPos = new Vector3(pointForBullets.x - offsetBulletPos, pointForBullets.y, pointForBullets.z); if (Physics.Raycast(startPos, unit.pointForGenerateBullets.forward, out m_Hit)) { unit.shootingCheck.bulletTargetPoint = new Vector3(m_Hit.point.x + offsetBulletPos, m_Hit.point.y, m_Hit.point.z); if (m_Hit.transform.TryGetComponent(out Unit.UnitController damagedUnit)) { Damage(unit, damagedUnit); } } }
public void TakeBulletFromPool(Unit.UnitController unit, float offsetBulletPos) { m_LinkManager.bulletsPool.CheckBulletsInPool(); ShootingCheck shootingCheck = unit.shootingCheck; var bullet = m_LinkManager.bulletsPool.DeleteFromList(); var bulletPos = unit.pointForGenerateBullets.position; var bulletMove = bullet.GetComponent <BulletMove>(); bullet.transform.position = bulletPos; bulletMove.targetPos = new Vector3(shootingCheck.bulletTargetPoint.x - offsetBulletPos, shootingCheck.bulletTargetPoint.y, shootingCheck.bulletTargetPoint.z); bulletMove.speed = shootingCheck.speedMoveBullet; bullet.gameObject.SetActive(true); }
private void RayCastForDamage(Unit.UnitController nearbyUnit, Transform grenade) { RaycastHit hit; Transform nearbyUnitTarget = nearbyUnit.pointForDamage; Vector3 pos = nearbyUnitTarget.position - grenade.position; float distance = pos.magnitude; Vector3 targetDirection = pos / distance; if (!Physics.Raycast(grenade.position, targetDirection, out hit)) { return; } if (hit.collider.CompareTag("Player") || hit.collider.CompareTag("Bot")) { Damage(m_LinkManager.player, nearbyUnit, m_Grenade); } }
private float IdentifyMultipleBullets(Unit.UnitController unit, int i, float offsetBulletPos) { var centerBullet = Math.Truncate(unit.bulletsQuantity.currentWeapon.QuantityBulletsPerShot / 2.0f); if (i < centerBullet) { offsetBulletPos -= marginBetweenBullets; } else { if (i == centerBullet) { offsetBulletPos = 0.0f; } offsetBulletPos += marginBetweenBullets; } return(offsetBulletPos); }
private void Start() { m_Unit = GetComponent <Unit.UnitController>(); }
public void NextWeapon(Unit.UnitController unit) { OnNextWeapon?.Invoke(unit); }
private void Damage(Unit.UnitController unit, Unit.UnitController damagedUnit, DataWeapons weapon) { m_LinkManager.damageController.Damage(damagedUnit, weapon); m_LinkManager.helthController.CheckLiveUnit(unit, damagedUnit, weapon); }
public void Damage(Unit.UnitController damagedUnit, DataWeapons weapon) { damagedUnit.health -= Convert.ToInt32(weapon.Damage); damagedUnit.helthbarUnit.helthbar.fillAmount -= weapon.Damage / 100; }
public override void TakeBulletFromPool(Unit.UnitController unit) { StartRaycast(unit, 0); TakeBulletFromPool(unit, 0); }
private void Damage(Unit.UnitController unit, Unit.UnitController damagedUnit) { m_LinkManager.damageController.Damage(damagedUnit, unit.bulletsQuantity.currentWeapon); m_LinkManager.helthController.CheckLiveUnit(unit, damagedUnit, unit.bulletsQuantity.currentWeapon); }
private void AnimShooting(Unit.UnitController unit, bool value) { unit.animator.SetBool(unit.bulletsQuantity.currentWeapon.NameAnim, value); }
public abstract void TakeBulletFromPool(Unit.UnitController unit);
public void EndShooting(Unit.UnitController unit) { AnimShooting(unit, false); }