コード例 #1
0
 public BulletPrefab GetBulletPrefab(int id)
 {
     if (!_bulletPrefabMap.TryGetValue(id, out var item))
     {
         var serializable = _content.GetBulletPrefab(id);
         item = new BulletPrefab(serializable, this);
         _bulletPrefabMap.Add(id, item);
     }
     return(item);
 }
コード例 #2
0
            public BulletPrefab GetBulletPrefab(ItemId <BulletPrefab> id, bool notNull = false)
            {
                if (_database._bulletPrefabMap.TryGetValue(id.Value, out var item))
                {
                    return(item);
                }
                var serializable = _content.GetBulletPrefab(id.Value);

                if (serializable != null && !serializable.Disabled)
                {
                    return(BulletPrefab.Create(serializable, this));
                }

                var value = BulletPrefab.DefaultValue;

                if (notNull && value == null)
                {
                    throw new DatabaseException("Data not found " + id);
                }
                return(value);
            }
コード例 #3
0
        private void Shoot()
        {
            if (!EmptyMagazine)
            {
                if (_isShooting)
                {
                    return;
                }

                GameObject bullet = BulletPrefab.CreateBullet(WeaponNozzle);
                Owner.Scene.Add(bullet);
                _fireRateTimer = FireRate;
                _isShooting    = true;
                return;
            }
            else if (AutoReload)
            {
                Reload();
                return;
            }
        }
コード例 #4
0
ファイル: WallShooterAbstract.cs プロジェクト: jeffmur/RedRum
    private void colesCole(Collider2D other)
    {
        if (other.CompareTag("Wall"))
        {
            if (direction == 0 || direction == 1)
            {
                if (direction == 1)
                {
                    Sprite change = Resources.Load <Sprite>("Textures/Animations/WallShooterEnemy/WallshooterFaceUp");
                    enemyAnimator.SetFloat("State", 1);
                    enemySprite.sprite = change;
                }
                else
                {
                    enemyAnimator.SetFloat("State", 0);
                }
                currentStates = (int)States.TopDownWallAttack;
            }
            else
            {
                Sprite change = Resources.Load <Sprite>("Textures/Animations/WallShooterEnemy/WallshooterFaceRight");
                enemySprite.sprite = change;
                if (direction == 3)
                {
                    enemySprite.flipX = true;
                }

                enemyAnimator.SetFloat("State", 2);
                currentStates = (int)States.SideWallAttack;
            }
        }
        else if (other.CompareTag("Player"))
        {
            other.GetComponent <Casper>().changeHealth(-BulletPrefab.GetComponent <Bullet>().bulletDamage);
        }
    }
コード例 #5
0
 public void ClearData(GameObject gameObject)
 {
     BulletPrefab.ClearBehaviour();
 }
コード例 #6
0
 public void SetData(GameObject gameObject)
 {
     BulletPrefab = gameObject.GetComponent <ThousandBulletPrefab>();
     BulletPrefab.SerBehaviour(BulletBehaviour);
 }
コード例 #7
0
            public void Load()
            {
                foreach (var item in _content.AmmunitionObsoleteList)
                {
                    if (!item.Disabled && !_database._ammunitionObsoleteMap.ContainsKey(item.Id))
                    {
                        AmmunitionObsolete.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentList)
                {
                    if (!item.Disabled && !_database._componentMap.ContainsKey(item.Id))
                    {
                        Component.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentModList)
                {
                    if (!item.Disabled && !_database._componentModMap.ContainsKey(item.Id))
                    {
                        ComponentMod.Create(item, this);
                    }
                }
                foreach (var item in _content.ComponentStatsList)
                {
                    if (!item.Disabled && !_database._componentStatsMap.ContainsKey(item.Id))
                    {
                        ComponentStats.Create(item, this);
                    }
                }
                foreach (var item in _content.DeviceList)
                {
                    if (!item.Disabled && !_database._deviceMap.ContainsKey(item.Id))
                    {
                        Device.Create(item, this);
                    }
                }
                foreach (var item in _content.DroneBayList)
                {
                    if (!item.Disabled && !_database._droneBayMap.ContainsKey(item.Id))
                    {
                        DroneBay.Create(item, this);
                    }
                }
                foreach (var item in _content.FactionList)
                {
                    if (!item.Disabled && !_database._factionMap.ContainsKey(item.Id))
                    {
                        Faction.Create(item, this);
                    }
                }
                foreach (var item in _content.SatelliteList)
                {
                    if (!item.Disabled && !_database._satelliteMap.ContainsKey(item.Id))
                    {
                        Satellite.Create(item, this);
                    }
                }
                foreach (var item in _content.SatelliteBuildList)
                {
                    if (!item.Disabled && !_database._satelliteBuildMap.ContainsKey(item.Id))
                    {
                        SatelliteBuild.Create(item, this);
                    }
                }
                foreach (var item in _content.ShipList)
                {
                    if (!item.Disabled && !_database._shipMap.ContainsKey(item.Id))
                    {
                        Ship.Create(item, this);
                    }
                }
                foreach (var item in _content.ShipBuildList)
                {
                    if (!item.Disabled && !_database._shipBuildMap.ContainsKey(item.Id))
                    {
                        ShipBuild.Create(item, this);
                    }
                }
                foreach (var item in _content.SkillList)
                {
                    if (!item.Disabled && !_database._skillMap.ContainsKey(item.Id))
                    {
                        Skill.Create(item, this);
                    }
                }
                foreach (var item in _content.TechnologyList)
                {
                    if (!item.Disabled && !_database._technologyMap.ContainsKey(item.Id))
                    {
                        Technology.Create(item, this);
                    }
                }
                foreach (var item in _content.CharacterList)
                {
                    if (!item.Disabled && !_database._characterMap.ContainsKey(item.Id))
                    {
                        Character.Create(item, this);
                    }
                }
                foreach (var item in _content.FleetList)
                {
                    if (!item.Disabled && !_database._fleetMap.ContainsKey(item.Id))
                    {
                        Fleet.Create(item, this);
                    }
                }
                foreach (var item in _content.LootList)
                {
                    if (!item.Disabled && !_database._lootMap.ContainsKey(item.Id))
                    {
                        LootModel.Create(item, this);
                    }
                }
                foreach (var item in _content.QuestList)
                {
                    if (!item.Disabled && !_database._questMap.ContainsKey(item.Id))
                    {
                        QuestModel.Create(item, this);
                    }
                }
                foreach (var item in _content.QuestItemList)
                {
                    if (!item.Disabled && !_database._questItemMap.ContainsKey(item.Id))
                    {
                        QuestItem.Create(item, this);
                    }
                }
                foreach (var item in _content.AmmunitionList)
                {
                    if (!item.Disabled && !_database._ammunitionMap.ContainsKey(item.Id))
                    {
                        Ammunition.Create(item, this);
                    }
                }
                foreach (var item in _content.BulletPrefabList)
                {
                    if (!item.Disabled && !_database._bulletPrefabMap.ContainsKey(item.Id))
                    {
                        BulletPrefab.Create(item, this);
                    }
                }
                foreach (var item in _content.VisualEffectList)
                {
                    if (!item.Disabled && !_database._visualEffectMap.ContainsKey(item.Id))
                    {
                        VisualEffect.Create(item, this);
                    }
                }
                foreach (var item in _content.WeaponList)
                {
                    if (!item.Disabled && !_database._weaponMap.ContainsKey(item.Id))
                    {
                        Weapon.Create(item, this);
                    }
                }

                foreach (var item in _content.Images)
                {
                    if (!_database._images.ContainsKey(item.Key))
                    {
                        _database._images.Add(item.Key, item.Value);
                    }
                }

                foreach (var item in _content.AudioClips)
                {
                    if (!_database._audioClips.ContainsKey(item.Key))
                    {
                        _database._audioClips.Add(item.Key, item.Value);
                    }
                }

                foreach (var item in _content.Localizations)
                {
                    if (!_database._localizations.ContainsKey(item.Key))
                    {
                        _database._localizations.Add(item.Key, item.Value);
                    }
                }

                if (_database.DatabaseSettings == null)
                {
                    _database.DatabaseSettings = DatabaseSettings.Create(_content.DatabaseSettings ?? new Serializable.DatabaseSettingsSerializable {
                        ItemType = Enums.ItemType.DatabaseSettings
                    }, this);
                }
                if (_database.ExplorationSettings == null)
                {
                    _database.ExplorationSettings = ExplorationSettings.Create(_content.ExplorationSettings ?? new Serializable.ExplorationSettingsSerializable {
                        ItemType = Enums.ItemType.ExplorationSettings
                    }, this);
                }
                if (_database.GalaxySettings == null)
                {
                    _database.GalaxySettings = GalaxySettings.Create(_content.GalaxySettings ?? new Serializable.GalaxySettingsSerializable {
                        ItemType = Enums.ItemType.GalaxySettings
                    }, this);
                }
                if (_database.ShipSettings == null)
                {
                    _database.ShipSettings = ShipSettings.Create(_content.ShipSettings ?? new Serializable.ShipSettingsSerializable {
                        ItemType = Enums.ItemType.ShipSettings
                    }, this);
                }
            }
コード例 #8
0
 public void AddBulletPrefab(int id, BulletPrefab item)
 {
     _database._bulletPrefabMap.Add(id, item);
 }
コード例 #9
0
 public void AddBullet(BulletPrefab bullet)
 {
     bullet.SetActive(false);
     _bulletsStack.Enqueue(bullet);
 }