void CreateDatabase() { weapons = ScriptableObject.CreateInstance<WeaponDatabase>(); AssetDatabase.CreateAsset(weapons, DATABASE_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
private Vector3 moveDirection; // Bringing this back to do more raw movement using the character controller //private Vector3 start; //private Vector3 end; // Use this for initialization void Start() { // Cache various Components audioSource = GetComponent <AudioSource>(); // Load weapon database weaponDB = Resources.Load <WeaponDatabase>("Databases/WeaponDatabase"); if (weaponDB == null) { Debug.Log("Failed to load weapon database"); } else { Debug.Log("Loaded weapon database successfully"); } AttachWeapon(weaponDB.WeaponList[SelectedWeapon].WeaponPrefab); // Make sure to set up the proper values for each weapon, as the database saves the values foreach (var weapon in weaponDB.WeaponList) { if (weapon.IsUnlimitedClips) { weapon.Ammo = weapon.ClipSize; } else { weapon.Ammo = 0; weapon.AmmoInClips = 0; } } }
void CreateDatabase() { weapons = ScriptableObject.CreateInstance <WeaponDatabase>(); AssetDatabase.CreateAsset(weapons, DATABASE_PATH); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public void AddItem(int itemType) { ItemType i = (ItemType)itemType; switch (i) { case ItemType.Weapon: if (WeaponDatabase.Instance.Count >= 0) { int rand = Mathf.FloorToInt(UnityEngine.Random.Range(0, (WeaponDatabase.Instance.Count))); IM.Add <Weapon>(WeaponDatabase.GetItemFromAsset(WeaponDatabase.Instance.GetAtIndex(rand))); } break; case ItemType.Consumable: if (ConsumableDatabase.Instance.Count >= 0) { int rand = Mathf.FloorToInt(UnityEngine.Random.Range(0, (QuestDatabase.Instance.Count))); IM.Add <Consumable>(ConsumableDatabase.GetItemFromAsset(ConsumableDatabase.Instance.GetAtIndex(rand))); } break; case ItemType.Quest: if (QuestDatabase.Instance.Count >= 0) { int rand = Mathf.FloorToInt(UnityEngine.Random.Range(0, (QuestDatabase.Instance.Count - 1))); IM.Add <QuestItem>(QuestDatabase.GetItemFromAsset(QuestDatabase.Instance.GetAtIndex(rand))); } break; } }
/// <summary> /// 武器のボタン一覧を作る初期化メソッド /// </summary> /// <param name="shopManager"></param> public void initWeaponList(ShopManager shopManager, WeaponDatabase weaponDatabase, DetailWindow detailWindow) { foreach (var weapon in weaponDatabase.weaponList) { //非売品は表示しない if (weapon.isNfs) { continue; } //Resources配下からボタンをロード var itemButton = (Instantiate(Resources.Load("Prefabs/WeaponButton")) as GameObject).transform; //ボタン初期化 今はテキストのみ itemButton.GetComponent <WeaponButton>().Init(weapon, shopManager, detailWindow); itemButton.name = itemButton.name.Replace("(Clone)", ""); //partyWindowオブジェクトをを探して取得 buyWindow = GameObject.Find("BuyWindow"); content = GameObject.Find("Viewport/Content"); //partyWindowオブジェクト配下にprefab作成 itemButton.transform.SetParent(content.transform); } //非表示にする buyWindow.SetActive(false); }
private void DrawWeapon(int weaponID) { meleeObject.SetActive(false); GunController toInstantiate = WeaponDatabase.GetWeaponByID(weaponID); currentGC = (GunController)Instantiate(toInstantiate); currentGC.transform.parent = weaponsParent; currentGC.transform.localPosition = toInstantiate.thirdPersonPosition; currentGC.transform.localRotation = toInstantiate.thirdPersonRotation; currentGC.StripFunctions(true); currentVisuals = currentGC.GetComponent <GunVisuals>(); muzzleBrightness = currentGC.muzzleLight.intensity; GetComponent <AudioSource>().PlayOneShot(drawSound, 0.7f); targetFireRate = 60f / Mathf.Max(currentGC.firstRPM, (currentGC.secondMode != GunController.FireMode.None) ? currentGC.secondRPM : 0f, (currentGC.thirdMode != GunController.FireMode.None) ? currentGC.thirdRPM : 0f); currentGHP = null; pullPinSound = null; throwSound = null; if (currentVisuals) { foreach (GameObject go in currentVisuals.activateOnUse) { go.SetActive(false); } currentGC.firePos.GetComponent <AudioSource>().volume = 1f; } }
public void Load() { Start(); log.InfoFormat("ShipWeapon Load() [dy]"); var character = GetComponent <CharacterObject>(); var dropManager = DropManager.Get(nebulaObject.world.Resource()); var player = GetComponent <MmoActor>(); var app = nebulaObject.mmoWorld().application; bool isNew = false; var dbWeapon = WeaponDatabase.instance(app).LoadWeapon(player.GetComponent <PlayerCharacterObject>().characterId, resource as Res, out isNew); if (isNew) { GenerateNewWeapon(dropManager); string characterID = GetComponent <PlayerCharacterObject>().characterId; WeaponDatabase.instance(app).SaveWeapon(characterID, new ShipWeaponSave { characterID = characterID, weaponObject = weaponObject.GetInfo() }); } else { weaponObject = new WeaponObject(dbWeapon.weaponObject); } }
public Game() { Coins = 0; Level = 1; ExperiencePoints = 0; CurrentLevel = "Suburb"; Bag = new Bag(); InventoryWeapons = new List <InventoryWeapon> (); InventoryWeapon inventoryWeapon = new InventoryWeapon(WeaponDatabase.GetWeapon(0), true); InventoryWeapons.Add(inventoryWeapon); Bag.AddWeapon(InventoryWeapons [0].Weapon.ID); Heroes = new List <HeroParty> (); HeroParty heroParty = new HeroParty(HeroDatabase.GetHero(0), true); Heroes.Add(heroParty); CurrentHero = Heroes [0].Hero; Paused = false; AutoAimTarget = true; savedTimeScale = 1; achievementManager = new AchievementManager(); }
void CheckWeaponForUpdate() { for (int i = 0; i < WeaponDatabase.GetWeaponsLength(); i++) { WeaponData weapon = WeaponDatabase.GetWeapon(i); Game.current.AddWeaponToInventory(weapon); } }
void CloseDatabase() { weaponDatabase = null; if (EditorPrefs.HasKey(editorPref)) { EditorPrefs.DeleteKey(editorPref); } }
private void Start() { gameController = GameObject.FindGameObjectWithTag("GameController"); database = gameController.GetComponent <WeaponDatabase>(); healthPackDatabase = gameController.GetComponent <HealthPackDatabase>(); inventory = gameController.GetComponent <PlayerInventory>(); pickupLayerMask = LayerMask.GetMask("PickUp"); source = GetComponent <AudioSource>(); }
void LoadDatabase() { weapons = (WeaponDatabase)AssetDatabase.LoadAssetAtPath(DATABASE_PATH, typeof(WeaponDatabase)); if (weapons == null) { CreateDatabase(); } }
public static WeaponDatabase Load(string path) { TextAsset _xml = Resources.Load <TextAsset>(path); XmlSerializer serializer = new XmlSerializer(typeof(WeaponDatabase)); StringReader reader = new StringReader(_xml.text); WeaponDatabase items = serializer.Deserialize(reader) as WeaponDatabase; reader.Close(); return(items); }
private void Start() { gameController = GameObject.FindGameObjectWithTag("GameController"); database = gameController.GetComponent <WeaponDatabase>(); id = GameObject.FindGameObjectWithTag("Weapon").GetComponent <ItemID>().itemID; currAmmo = database.weapons[id].maxAmmo; animator = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <Animator>(); enemyAnim = GameObject.FindGameObjectWithTag("Enemy").GetComponentInChildren <Animator>(); coins = 0; }
public WeaponEditForm(Weapon chosenWeapon, IReadOnlyList <Weapon> ownedWeapons) { InitializeComponent(); Weapon = chosenWeapon; OwnedWeapons = ownedWeapons; weaponBox.SelectedIndex = WeaponDatabase.GetIndex(Weapon.Id); weaponBox.Enabled = false; turfInkedBox.Value = Convert.ToInt32(Weapon.TurfInked); newFlagBox.Checked = Weapon.IsNew; }
// Start is called before the first frame update void Start() { weaponDatabase = FindObjectOfType <WeaponDatabase>(); CurrentRagedWeapon.ShootingType.SetupCanWeaponShoot(); CurrentRagedWeapon.SetupCurrentAmmo(); foreach (WeaponData weapon in weaponDatabase.LogicWeaponsDatabase) { weapon.Damage = weapon.StartingDamage; } }
void Start() { playerShoot = GetComponent <PlayerShoot>(); weapons = FindObjectOfType <WeaponDatabase>(); if (photonView.isMine) { weaponWheel = GameObject.Find("myweaponwheel"); weaponWheel.SetActive(false); storedWeaponWheelDisplayCooldown = weaponWheelDisplayCooldown; } }
WeaponDatabase NewDatabase() { Debug.Log("New Weapon Database"); WeaponDatabase asset = ScriptableObject.CreateInstance <WeaponDatabase>(); string path = "Assets/Databases/" + editorPref + ".asset"; AssetDatabase.CreateAsset(asset, path); asset.DB = new List <Weapon>(); AssetDatabase.SaveAssets(); EditorPrefs.SetString(editorPref, path); return(asset); }
public void SetupHotbar() { database = GameObject.Find("Inventory").GetComponent<WeaponDatabase>(); inventory = GameObject.Find("Inventory").GetComponent<Inventory>(); hotbarSlotCount = 6; hotbarStart = inventory.slots.Count - hotbarSlotCount; currentSlot = inventory.slots[hotbarStart].GetComponent<Slot>(); slotColor = new Color32(62, 62, 62, 255); manager = GameObject.Find("GameManager").GetComponent<GameManager>(); playerObject = GameManager.FindLocalPlayer(); }
private void DrawWeapon(int weaponID) { GunController toInstantiate = WeaponDatabase.GetWeaponByID(weaponID); currentGun = (GunController)Instantiate(toInstantiate); currentGun.transform.parent = weaponsParent; currentGun.transform.localPosition = toInstantiate.thirdPersonPosition; currentGun.transform.localRotation = toInstantiate.thirdPersonRotation; currentGun.PrepareForBot(); currentVisuals = currentGun.GetComponent <GunVisuals>(); muzzleBrightness = currentGun.muzzleLight.intensity; curSpread = currentGun.baseSpreadAmount; }
void Start() { _moveRight = GameObject.Find("MoveRight").GetComponent <Button>(); _moveLeft = GameObject.Find("MoveLeft").GetComponent <Button>(); _moveLeft.interactable = false; _characterList = GameObject.Find("CharacterList"); _database = gameObject.GetComponent <CharDatabase>(); _weaponDb = GameObject.Find("_manager").GetComponent <WeaponDatabase>(); _armourDb = GameObject.Find("_manager").GetComponent <ArmourDatabase>(); _name = GameObject.Find("Name").GetComponent <Text>(); _str = GameObject.Find("StrText").GetComponent <Text>(); _dex = GameObject.Find("DexText").GetComponent <Text>(); _vit = GameObject.Find("VitText").GetComponent <Text>(); SetStats(0); }
// Update is called once per frame void Update() { if (life <= 0) { Transform EnemyPosition = gameObject.transform; WeaponDatabase weaponDatabase = FindObjectOfType <WeaponDatabase>(); Instantiate(weaponDatabase.Weapons[Random.Range(0, 4)], EnemyPosition.position, EnemyPosition.rotation); Destroy(gameObject); if (myScript.lifeTimer < myScript.MaxPlayerLife) { myScript.lifeTimer = myScript.lifeTimer + LifeBonus; } } }
public void Apply(DatabaseDef _def) { gameMap = ((GameObject)Instantiate(_def.gameMapPrf.gameObject)).GetComponent <GameMapDatabase>(); gameMap.transform.parent = gameObject.transform; character = ((GameObject)Instantiate(_def.characterPrf.gameObject)).GetComponent <CharacterDatabase>(); character.transform.parent = gameObject.transform; skin = ((GameObject)Instantiate(_def.skinPrf.gameObject)).GetComponent <CharacterSkinDatabase>(); skin.transform.parent = gameObject.transform; weapon = ((GameObject)Instantiate(_def.weaponPrf.gameObject)).GetComponent <WeaponDatabase>(); weapon.transform.parent = gameObject.transform; projectile = ((GameObject)Instantiate(_def.projectilePrf.gameObject)).GetComponent <ProjectileDatabase>(); projectile.transform.parent = gameObject.transform; }
public void BulletInfo(BulletInfo bi, int gunIndex, bool tracer = false, bool isPlayer = false, int botID = -1) { multishotDivider = WeaponDatabase.GetWeaponByID(gunIndex).bulletsPerShot; thisGunIndex = gunIndex; isVisuals = tracer; player = (isPlayer && botID <= -1); botIndex = botID; isServer = Topan.Network.isConnected && (botID > -1 || (player && Topan.Network.isServer)); damage = bi.damage; force = bi.force; speed = bi.muzzleVelocity; gFactor = bi.gravityFactor; dmgCurve = bi.damageFalloff; ricochetAmount = bi.ricochetLength; ricochetAngle = bi.ricochetMaxAngle; friendlyFire = NetworkingGeneral.friendlyFire; }
void Start() { if (WeaponDatabase.ContainsAsset(testingItemID)) { item = WeaponDatabase.GetItemFromAsset(WeaponDatabase.GetAsset(testingItemID)); Debug.Log(item.Name); Debug.Log(item.Description); } if (item != null) { StringItem(item); } else { Debug.Log(string.Format("No item with item id of {0} found", testingItemID)); } }
public void AddWeapon(int weaponID, bool autoSwitch = true) { GunController toInstantiate = WeaponDatabase.GetWeaponByID(weaponID); GunController instantiated = null; int switchTo = 0; if (heldWeapons[0] == null) { heldWeapons[0] = (GunController)Instantiate(toInstantiate); instantiated = heldWeapons[0]; } else if (heldWeapons[1] == null) { switchTo = 1; heldWeapons[1] = (GunController)Instantiate(toInstantiate); instantiated = heldWeapons[1]; } else if (curWeaponMode == CurrentWeaponMode.GenericWeapon) { switchTo = curWeaponNum; DropWeapon(curWeaponNum, false); heldWeapons[curWeaponNum] = (GunController)Instantiate(toInstantiate); instantiated = heldWeapons[curWeaponNum]; } else if (curWeaponMode == CurrentWeaponMode.AlternateWeapon) { } if (instantiated) { instantiated.transform.parent = weaponsParent; instantiated.transform.localPosition = toInstantiate.firstPersonPosition; instantiated.transform.localRotation = toInstantiate.firstPersonRotation; instantiated.RunStart(); instantiated.gameObject.SetActive(false); } if (autoSwitch) { SelectWeapon(switchTo); } }
void OnEnable() { if (!AssetDatabase.IsValidFolder(weaponPath)) { AssetDatabase.CreateFolder("Assets/Databases", "Weapons"); } if (EditorPrefs.HasKey(editorPref)) { string path = EditorPrefs.GetString(editorPref); weaponDatabase = AssetDatabase.LoadAssetAtPath(path, typeof(WeaponDatabase)) as WeaponDatabase; } if (!EditorPrefs.HasKey(idPref)) { EditorPrefs.SetInt(idPref, 1); } }
void Start() { //武器、敵のデータベース取得 weaponDatabase = Resources.Load <WeaponDatabase>("weaponDatabase"); enemyDatabase = Resources.Load <EnemyDatabase>("enemyDatabase"); battleCalculator = new BattleCalculator(); messageList = new List <string>(); //成長率、レベルアップ時の感想を読み込み lvUpManager.init(); //battleStateを初期化状態に battleState = BattleState.INIT; //レベルアップ中、経験値ゲージ上昇中ではないのでtrue isLvupEnd = true; isExpGaugeUpdateEnd = true; }
//Initialized once only, stop _manager GO from being destroyed when loading a new scene void Awake() { print("_CombatManager Awake() Called"); if (NewGame._newGame) { _skills.Add(0); _skills.Add(1); _skills.Add(2); _skills.Add(3); } DontDestroyOnLoad(gameObject); _weaponDb = gameObject.GetComponent <WeaponDatabase>(); _armourDb = gameObject.GetComponent <ArmourDatabase>(); _equipMelee = _weaponDb._meleeDatabase[0]; _equipRanged = _weaponDb._rangedDatabase[0]; _headSlot = _armourDb._headDatabase[0]; _chestSlot = _armourDb._chestDatabase[0]; _legSlot = _armourDb._legDatabase[0]; CalculateStats(); }
void OpenDatabase() { string absPath = EditorUtility.OpenFilePanel("Select Database", "", ""); Debug.Log(absPath); if (absPath.StartsWith(Application.dataPath)) { string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length); weaponDatabase = AssetDatabase.LoadAssetAtPath(relPath, typeof(WeaponDatabase)) as WeaponDatabase; if (weaponDatabase.DB == null) { weaponDatabase.DB = new List <Weapon>(); EditorUtility.SetDirty(weaponDatabase); } if (weaponDatabase) { Debug.Log(relPath); EditorPrefs.SetString(editorPref, relPath); } } }
// Use this for initialization void Start() { dataArmor = ArmorDatabase.Load("Armors"); dataEnemy = EnemyDatabase.Load("Enemies"); dataEss = EssenceDatabase.Load("Essences"); dataItem = ItemDatabase.Load("Items"); dataNpc = NPCDatabase.Load("NPCs"); dataPot = PotionDatabase.Load("Potions"); dataScroll = ScrollDatabase.Load("Scrolls"); dataSkill = SkillDatabase.Load("Skills"); dataTali = TalismanDatabase.Load("Talismans"); dataWep = WeaponDatabase.Load("Weapons"); Debug.Log("Database Loaded"); foreach (Armor arm in dataArmor.armors) { arm.found = true; if (arm.found) { Debug.Log("Armor 0" + arm.ID + ":" + arm.Name); } } }
private void ReloadListBox() { weaponsList.Items.Clear(); foreach (var weapon in WeaponsHax.Weapons) { string name = ""; var index = WeaponDatabase.GetIndex(weapon.Id); if (index == 0) { name = weaponEditFormResources.GetString("weaponBox.Items"); } else { name = weaponEditFormResources.GetString("weaponBox.Items" + index); } if (weapon.Id.Equals(WeaponsHax.EquippedWeapon)) { name += " " + Strings.EQUIPPED; } weaponsList.Items.Add(name); } }
void LoadDatabase() { weapons = (WeaponDatabase)AssetDatabase.LoadAssetAtPath(DATABASE_PATH, typeof(WeaponDatabase)); if (weapons == null) CreateDatabase(); }
void Start() { hotbar = GameObject.Find("Inventory").GetComponent<Hotbar>(); weaponDatabase = GameObject.Find("Inventory").GetComponent<WeaponDatabase>(); ammoDatabase = GameObject.Find("Inventory").GetComponent<AmmoDatabase>(); inventory = GameObject.Find("Inventory").GetComponent<Inventory>(); itemDatabase = GameObject.Find("Inventory").GetComponent<ItemDatabase>(); audioSource = gameObject.AddComponent<AudioSource>(); totalAmmoText = GameObject.Find("TotalAmount").GetComponent<Text>(); currentAmmoText = GameObject.Find("ClipAmount").GetComponent<Text>(); }