示例#1
0
        private void Start()
        {
            m_LinkManager        = LinkManager.instance;
            m_MovementController = GetComponent <MovementController>();
            bulletsQuantity      = GetComponent <BulletsQuantityUnit>();
            chController         = GetComponent <CharacterController>();
            shootingCheck        = GetComponent <ShootingCheck>();
            helthbarUnit         = GetComponent <HelthbarUnit>();
            animator             = GetComponent <Animator>();

            if (!isBot)
            {
                movementController   = GetComponent <MovementController>();
                inputController      = GetComponent <InputController>();
                setTarget            = GetComponent <SetTarget>();
                m_LinkManager.player = this;
                SetPlayerMoveSettings();
                setTarget.SetTargetForBotAttack();
                SetMobileGrenadeSettings();
            }
            else
            {
                bot = GetComponent <Bot>();
            }

            SetWeapon(idWeaponAtStart);
        }
示例#2
0
        private IEnumerator ReloadWeapon(Unit.UnitController unit)
        {
            BulletsQuantityUnit bulletsQuantity = unit.bulletsQuantity;
            ShootingCheck       shootingCheck   = unit.shootingCheck;
            Animator            animator        = unit.animator;

            //m_LinkManager.shootingController.StopAllCoroutines();

            shootingCheck.DisableShooting();
            shootingCheck.isShoot  = false;
            shootingCheck.isNoAmmo = true;
            shootingCheck.StopAllCoroutines();

            animator.SetTrigger("ReloadGun");

            m_AudioSource.PlayOneShot(m_SoundReload);

            yield return(new WaitForSeconds(bulletsQuantity.currentWeapon.ReloadTime));

            if (!bulletsQuantity.currentWeapon.InfinityBullets)
            {
                bulletsQuantity.allBulletsWeapon -= bulletsQuantity.defaultBulletsInClip;
            }

            m_AudioSource.Stop();

            bulletsQuantity.quantityBulletsInClip = bulletsQuantity.defaultBulletsInClip;

            SetUIWeaponParameters(unit);
            shootingCheck.isNoAmmo = false;
            shootingCheck.isShoot  = true;
        }
示例#3
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);
        }