예제 #1
0
        public void CheckLiveUnit(Unit.UnitController unit, Unit.UnitController damagedUnit, DataWeapons weapon)
        {
            HelthCheck helthCheck = damagedUnit.GetComponent <HelthCheck>();

            helthCheck.whoShoot      = unit;
            helthCheck.damagedWeapon = weapon;
        }
예제 #2
0
        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;
 }
예제 #4
0
        public void Shooting(Unit.UnitController unit)
        {
            DataWeapons weapon = unit.bulletsQuantity.currentWeapon;

            LinkManager.instance.bulletController.BulletsCount(unit);
            AnimShooting(unit, true);
            m_AudioSourceShooting.PlayOneShot(weapon.SoundShot);
        }
예제 #5
0
        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();
        }
예제 #6
0
        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;
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
 public void SetColorBar(Unit.UnitController unit)
 {
     if (unit.isEnemy)
     {
         unit.helthbarUnit.helthbar.color = m_Enemy;
     }
     else
     {
         unit.helthbarUnit.helthbar.color = m_Friendly;
     }
 }
예제 #9
0
        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;
        }
예제 #10
0
        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);
                }
            }
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
            }
        }
예제 #13
0
        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);
        }
예제 #14
0
 private void Start()
 {
     m_Unit = GetComponent <Unit.UnitController>();
 }
예제 #15
0
 public void NextWeapon(Unit.UnitController unit)
 {
     OnNextWeapon?.Invoke(unit);
 }
예제 #16
0
 private void Damage(Unit.UnitController unit, Unit.UnitController damagedUnit, DataWeapons weapon)
 {
     m_LinkManager.damageController.Damage(damagedUnit, weapon);
     m_LinkManager.helthController.CheckLiveUnit(unit, damagedUnit, weapon);
 }
예제 #17
0
 public void Damage(Unit.UnitController damagedUnit, DataWeapons weapon)
 {
     damagedUnit.health -= Convert.ToInt32(weapon.Damage);
     damagedUnit.helthbarUnit.helthbar.fillAmount -= weapon.Damage / 100;
 }
예제 #18
0
 public override void TakeBulletFromPool(Unit.UnitController unit)
 {
     StartRaycast(unit, 0);
     TakeBulletFromPool(unit, 0);
 }
예제 #19
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);
 }
예제 #20
0
 private void AnimShooting(Unit.UnitController unit, bool value)
 {
     unit.animator.SetBool(unit.bulletsQuantity.currentWeapon.NameAnim, value);
 }
예제 #21
0
 public abstract void TakeBulletFromPool(Unit.UnitController unit);
예제 #22
0
 public void EndShooting(Unit.UnitController unit)
 {
     AnimShooting(unit, false);
 }