예제 #1
0
        /// <summary>
        /// Создать представление выстрела.
        /// </summary>
        /// <param name="shot">Выстрел.</param>
        public void InstantiateShot(ShotLogic shot)
        {
            GameObject prefab = null;

            // TODO: Customize shot here.

            prefab = GameModel.Instance.GameSettings.Bullet;

            if (prefab == null)
            {
                Debug.LogWarning("Prefab for this kind of bullet is not specified.");
                return;
            }

            var instance = Instantiate(prefab, transform);
            var shotView = instance.GetComponent <ShotView>();

            if (shotView != null)
            {
                shotView.Logic = shot;
            }
            else
            {
                Debug.LogWarning("Shot view must have behaviour of ShotView class.");
            }
        }
예제 #2
0
        public void SetShootLogic(Unit.UnitController unit)
        {
            BulletsQuantityUnit bulletsQuantityUnit = unit.bulletsQuantity;
            var currentWeaponId = bulletsQuantityUnit.currentWeapon.IdWeapon;

            switch (unit.bulletsQuantity.currentWeapon.TypeShooting)
            {
            case DataWeapons.ChoiceTypeShooting.Automatic:
                m_ShotLogic = bulletsQuantityUnit.allWeaponUnit[currentWeaponId].GetComponent <AutoWeapon>();
                break;

            case DataWeapons.ChoiceTypeShooting.Shotgun:
                m_ShotLogic = bulletsQuantityUnit.allWeaponUnit[currentWeaponId].GetComponent <ShotgunWeapon>();
                break;
            }

            m_ShotLogic.shootingCheck = this;
        }
예제 #3
0
 /// <summary>
 /// Создать выстрел.
 /// </summary>
 /// <param name="shot">Выстрел.</param>
 public void AddShot(ShotLogic shot)
 {
     Field.InstantiateShot(shot);
 }