void Start() { timer = 0; hero = GameObject.FindGameObjectWithTag("Player"); heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); particles = gameObject.GetComponent <ParticleSystem>(); }
public void InitPlayer(Character character, PlayerController controller) { OwnCharacter = character; _playerController = controller; _playerController.InitController(OwnCharacter, this, ISControlPlayer); PlayerEquipment.InitializeEquipItem(this); }
// Use this for initialization void Start() { DistanceToPlayer = 10; CurrentState = 0; StateTimer = 1000000; SpawnTimer = 20; vanishTimer = 1; player = GameObject.FindGameObjectWithTag("Player"); controller = GetComponent <CharacterController>(); //Random.seed = 8675309; attacking = false; heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); Instantiate(enemySpawner, new Vector3(5, -5, -1), Quaternion.Euler(0, 0, 225)); Instantiate(enemySpawner, new Vector3(14, -5, -1), Quaternion.Euler(0, 0, 135)); Instantiate(enemySpawner, new Vector3(5, -14, -1), Quaternion.Euler(0, 0, 315)); Instantiate(enemySpawner, new Vector3(14, -14, -1), Quaternion.Euler(0, 0, 45)); wayPointTimer = 8; timer = .5f; AttackTimer = 2; DetermineDoorPositions(); Bounds = new Rect(TopDoor, LeftDoor, roomWidth, roomHeight); NewWayPoint(); angleOffset = 0; vanishbool = true; vanishbool2 = true; SummonState = 0; Myhealth = gameObject.GetComponent <Health>(); healthB = (GameObject)Instantiate(BossHealthBar); HealthRemaining = GameObject.FindGameObjectWithTag("Boss Health"); GameObject.FindObjectOfType <BGM>().bossmusic(); }
void Start() { timerforfacingvectorupdate = 2.0f; timerforfacingvectorupdate2 = 2.0f; AttackTimer = .5f; AbleToMelee = false; EnragedSoundPlaying = false; heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); Playsounds = gameObject.GetComponent <AudioSource>(); //Random.seed = 42; player = GameObject.FindGameObjectWithTag("Player"); playerLight = player.GetComponent <PlayerLight>(); playMove = player.GetComponent <PlayerMovement>(); ShadowHealth = GetComponent <Health>(); Moveto = new Vector3(0, 0); controller = GetComponent <CharacterController>(); speed = 1; timerCount = 1; DmgTimer = 1; maxSpeed = 1; timer = 1; playerConsumeTimer = 1; newWayPoint = true; stuckCounter = 0; DistancetoLight = 100; DistancetoPlayer = 100; //AnimTimer = 1; }
void LoadEquipment(PlayerEquipment equipment) { // fill all slots first for (int i = 0; i < equipment.slotInfo.Length; ++i) { equipment.slots.Add(new ItemSlot()); } // then load valid equipment and put into their slots // (one big query is A LOT faster than querying each slot separately) foreach (character_equipment row in connection.Query <character_equipment>("SELECT * FROM character_equipment WHERE character=?", equipment.name)) { if (row.slot < equipment.slotInfo.Length) { if (ScriptableItem.All.TryGetValue(row.name.GetStableHashCode(), out ScriptableItem itemData)) { Item item = new Item(itemData); item.durability = Mathf.Min(row.durability, item.maxDurability); item.summonedHealth = row.summonedHealth; item.summonedLevel = row.summonedLevel; item.summonedExperience = row.summonedExperience; equipment.slots[row.slot] = new ItemSlot(item, row.amount); } else { Debug.LogWarning("LoadEquipment: skipped item " + row.name + " for " + equipment.name + " because it doesn't exist anymore. If it wasn't removed intentionally then make sure it's in the Resources folder."); } } else { Debug.LogWarning("LoadEquipment: skipped slot " + row.slot + " for " + equipment.name + " because it's bigger than size " + equipment.slotInfo.Length); } } }
private void Awake() { _equip = new PlayerEquipment(); _bag = new PlayerBag(); _view = GetComponentInChildren <InventoryView>(); }
void Start() { //Victory = false; //VictoryTimer = 5; // Get Player ref player = GameObject.FindGameObjectWithTag("Player"); // Get Controller ref for movement controller = GetComponent <CharacterController>(); // Pause bool is in player heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); // Ref to Health myHealth = GetComponent <Health>(); meleeAttackObject.SetActive(false); meleeScript = meleeAttackObject.GetComponent <DethrosMeleeAttack>(); Instantiate(enemySpawner, new Vector3(5, -5, -1), Quaternion.Euler(0, 0, 225)); Instantiate(enemySpawner, new Vector3(14, -5, -1), Quaternion.Euler(0, 0, 135)); Instantiate(enemySpawner, new Vector3(5, -14, -1), Quaternion.Euler(0, 0, 315)); Instantiate(enemySpawner, new Vector3(14, -14, -1), Quaternion.Euler(0, 0, 45)); spawners = GameObject.FindGameObjectsWithTag("DethSpawn"); specialTimer = sTimerMax; spellTimer = spTimerMax; Instantiate(Healthbar); HealthRemaining = GameObject.FindGameObjectWithTag("Boss Health"); }
protected override async UniTask OnExecuteAsync() { if (Context.Parameters.Length > 1) { throw new CommandWrongUsageException(Context); } ushort amount = 10; if (Context.Parameters.Length == 1) { amount = await Context.Parameters.GetAsync <ushort>(0); } UnturnedUser uPlayer = (UnturnedUser)Context.Actor; PlayerEquipment equipment = uPlayer.Player.Player.equipment; if (equipment.itemID == 0) { throw new UserFriendlyException(m_StringLocalizer["more:none"]); } Item item = new Item(equipment.itemID, EItemOrigin.ADMIN); await UniTask.SwitchToMainThread(); for (int i = 0; i < amount; i++) { uPlayer.Player.Player.inventory.forceAddItem(item, true); } await PrintAsync(m_StringLocalizer["more:success", new { Amount = amount, Item = equipment.asset.itemName }]); }
public MPQDCC GetPlayerDCC(MPQCOF.COFLayer cofLayer, PlayerEquipment equipment, Palette palette) { // TODO: Smarter hashing maybe return(cache.AddOrGetExisting($"PlayerDCC::{cofLayer.CompositType.ToToken()}{cofLayer.COF.MobMode.ToToken()}{equipment.HashKey}", () => { byte[] binaryData; var streamPath = mpqProvider.GetCharacterDccPath(cofLayer.COF.Hero, cofLayer.COF.MobMode, cofLayer.CompositType, equipment); // If stream path is null, there is nothing to load for this layer (this is NOT an error!) if (streamPath == null) { return null; } using (var stream = mpqProvider.GetStream(streamPath)) { if (stream == null) { log.Error($"Could not load Player DCC: {streamPath}"); return null; } binaryData = new byte[stream.Length]; stream.Read(binaryData, 0, (int)stream.Length); } return new MPQDCC(binaryData, palette); })); }
void Awake() { controller.GetComponent <GameController>(); playerStats = GetComponent <PlayerStat>(); playerEquipment = GetComponent <PlayerEquipment>(); //interactableItems = GetComponent<InteractableItems>(); }
void LoadEquipment(SqliteConnection connection, PlayerEquipment equipment) { // fill all slots first for (int i = 0; i < equipment.slotInfo.Length; ++i) { equipment.slots.Add(new ItemSlot()); } // then load valid equipment and put into their slots // (one big query is A LOT faster than querying each slot separately) List <List <object> > table = ExecuteReader(connection, "SELECT name, slot, amount FROM character_equipment WHERE character=@character", new SqliteParameter("@character", equipment.name)); foreach (List <object> row in table) { string itemName = (string)row[0]; int slot = Convert.ToInt32((long)row[1]); if (slot < equipment.slotInfo.Length) { if (ScriptableItem.dict.TryGetValue(itemName, out ScriptableItem itemData)) { Item item = new Item(itemData); int amount = Convert.ToInt32((long)row[2]); equipment.slots[slot] = new ItemSlot(item, amount); } else { Debug.LogWarning("LoadEquipment: skipped item " + itemName + " for " + equipment.name + " because it doesn't exist anymore. If it wasn't removed intentionally then make sure it's in the Resources folder."); } } else { Debug.LogWarning("LoadEquipment: skipped slot " + slot + " for " + equipment.name + " because it's bigger than size " + equipment.slotInfo.Length); } } }
// Vector3 RemainsPOS; void Start() { // RemainsPOS = new Vector3(1, 1, 1); pauseCanvas = GameObject.FindGameObjectWithTag("PauseCanvas"); heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); pauseCanvas.SetActive(false); isPaused = false; sVolume.enabled = false; mVolume.enabled = false; fullscreen.enabled = false; controlMode.enabled = false; back.enabled = false; resumeRect = new Rect(570, 410, 140, 50); optionsRect = new Rect(570, 360, 140, 50); if (Application.loadedLevelName == "Tutorial") { quitRect = new Rect(600, 250, 80, 50); } else { quitRect = new Rect(540, 250, 200, 50); } sfxRect = new Rect(500, 465, 280, 50); sfxLeftRect = new Rect(715, 465, 30, 50); sfxRightRect = new Rect(750, 465, 30, 50); musicRect = new Rect(490, 420, 300, 45); musicLeftRect = new Rect(730, 420, 30, 45); musicRightRect = new Rect(765, 420, 30, 45); fullscreenRect = new Rect(560, 360, 160, 50); controlsRect = new Rect(480, 310, 320, 50); backRect = new Rect(600, 255, 80, 45); }
// Use this for initialization void Start() { heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); sprite = gameObject.GetComponent <SpriteRenderer>(); active = false; fadingIn = false; fadingOut = false; doingDamage = false; if (timeOffset == timeOffsets.zero) { timer = 0; } else if (timeOffset == timeOffsets.one) { timer = -3; } else if (timeOffset == timeOffsets.two) { timer = -6; } else if (timeOffset == timeOffsets.three) { timer = -9; } }
// Use this for initialization void Start() { if (stats == null) { stats = new PlayerStats(); } if (inventory == null) { inventory = new PlayerInventory(); } if (equipment == null) { equipment = new PlayerEquipment(); } HP = stats.MaxHealth; MaxHP = stats.MaxHealth; playerDamage = stats.Attack; playerDefense = stats.Defense; txtPlayerName = GetComponent <Text>(); }
public PlayerData(PlayerManager Player, PlayerInventory Inv, PlayerEquipment equipment, PlayerInventory Shop, BuffList currentBuffs) { Level = Player.Level; CurrentHealth = Player.CurrentHealth.RuntimeValue; Stars = Player.Stars; MaxHealth = Player.CurrentHealth.InitialValue; Armor = Player.Armor.InitialValue; armorId = equipment.Armor.id; Coins = Player.Coins; bossesProgress = Player.bossesProgres; foreach (var item in currentBuffs.list) { buffsId.Add(item.id); buffsTimeLeft.Add(item.timer); } foreach (var item in Inv.MyInventory) { itemsId.Add(item.id); itemsValue.Add(item.NumberHeld); } foreach (var item in Shop.MyInventory) { shopId.Add(item.id); } foreach (var item in Player.Weapons.thisList) { weaponsId.Add(item.gameObject.GetComponent <MagicCast>().ThisItem.id); } }
public bool CanEquip(PlayerEquipment equipment, int inventoryIndex, int equipmentIndex) { string requiredCategory = equipment.slotInfo[equipmentIndex].requiredCategory; return(requiredCategory != "" && category.StartsWith(requiredCategory)); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); controller = GetComponent <CharacterController>(); AttackCD = 0; castingDarkPULL = castingDarkPUSH = CastingMorriusOrb = Charging = Returning = false; //Spells Set to False FirstShadowSwap = SecondShadowSwap = false; EndShadowSwap = true; timer = 3; currentState = 0; heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); NewWayPoint(); EndSpellTimer = 2; StateTimer = 5; returnOrginTimer = 0; Orgin = transform.position; WayPointLeft = new Vector3(Orgin.x + 8, Orgin.y, Orgin.z); WayPointRight = new Vector3(Orgin.x - 8, Orgin.y, Orgin.z); WayPoint = WayPointRight; Instantiate(DarknessParts2, new Vector3(10, -10, -6), new Quaternion(0, 0, 0, 0)); TheDark = (GameObject)Instantiate(DarknessParts3, new Vector3(10, -10, -6), new Quaternion(0, 0, 0, 0)); TheDark.SetActive(false); currentState = 555; RenderSettings.ambientLight = new Color(42f / 255f, 42f / 255f, 42f / 255f); Myhealth = gameObject.GetComponent <Health>(); GameObject.FindObjectOfType <BGM> ().finalbossmusic(); //healthB = (GameObject)Instantiate(BossHealthBar); //HealthRemaining = GameObject.FindGameObjectWithTag("Boss Health"); Source.PlayOneShot(AwakeSound); }
public static void PostTellEquip(PlayerEquipment __instance, ushort __state, Transform[] ___thirdSlots, CSteamID steamID, ushort id) { if (!__instance.channel.checkServer(steamID)) { return; } if (___thirdSlots == null) { return; } if (__state == 0 && id == 0) { return; } if (__state != 0) { OnItemUnequipped?.Invoke(__instance.player); } if (id != 0 && __instance.asset != null) { var type = Assets.useableTypes.getType(__instance.asset.useable); if (type != null && typeof(Useable).IsAssignableFrom(type)) { OnItemEquipped?.Invoke(__instance.player); } } }
void Awake() { equipment = GameManager.singleton.equipment; inventory = GameManager.singleton.inventory; try { whichUser(); print(armourSprite.name); } catch { SRequipedRight = equipedRight.GetComponent <SpriteRenderer>(); print("FAIL"); armourSprite = armour1; wepSprite = wep1; } SpriteRenderer ago = armourGO.GetComponent <SpriteRenderer>(); SpriteRenderer wgo = wepGO.GetComponent <SpriteRenderer>(); ago.sprite = armourSprite; wgo.sprite = wepSprite; btnEquip.SetActive(false); }
void Start() { playerEquipment = PlayerEquipment.instance; slots = slotHolder.GetComponentsInChildren <EquipmentSlot>(); playerEquipment.onChangeItem += redrawSlotUI; equipmentSet.SetActive(false); }
private void Awake() { playerEquipment = GetComponent <PlayerEquipment>(); playerManager = FindObjectOfType <PlayerManager>(); currentHealth = maxHealth; currentArmor = 0; }
void Start() { if (tag != "Decoy") { // player = GameObject.FindGameObjectWithTag("Player"); anim = gameObject.GetComponent <Animator>(); heroEquipment = gameObject.GetComponent <PlayerEquipment>(); controller = gameObject.GetComponent <CharacterController>(); heroCooldowns = gameObject.GetComponent <PlayerCooldowns>(); //rb2d = GetComponent<Rigidbody2D>(); } else { heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); } fullSpeed = 3.1f; halfSpeed = 1.6f; knockbackTimer = 0; stunned = false; sTimerMax = .5f; stunTimer = sTimerMax; if (GameObject.FindGameObjectWithTag("Dungeon")) { generator = GameObject.FindGameObjectWithTag("Dungeon").GetComponent <RoomGeneration>(); } }
void LoadEquipment(PlayerEquipment equipment) { for (int i = 0; i < equipment.slotInfo.Length; ++i) { equipment.slots.Add(new ItemSlot()); } foreach (character_equipment row in connection.Query <character_equipment>("SELECT * FROM character_equipment WHERE character=?", equipment.name)) { if (row.slot < equipment.slotInfo.Length) { if (ScriptableItem.dict.TryGetValue(row.name.GetStableHashCode(), out ScriptableItem itemData)) { Item item = new Item(itemData); item.ammo = row.ammo; item.durability = Mathf.Min(row.durability, item.maxDurability); equipment.slots[row.slot] = new ItemSlot(item, row.amount); } else { Debug.LogWarning("LoadEquipment: skipped item " + row.name + " for " + equipment.name + " because it doesn't exist anymore. If it wasn't removed intentionally then make sure it's in the Resources folder."); } } else { Debug.LogWarning("LoadEquipment: skipped slot " + row.slot + " for " + equipment.name + " because it's bigger than size " + equipment.slotInfo.Length); } } }
void Start() { timer = 0; heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); distanceTraveled = 0; range = Random.Range(5, 8); }
// Update is called once per frame void Update() { shouldload = options.shouldload; if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); if (player != null) { eq = player.GetComponent <PlayerEquipment>(); theStats = player.GetComponent <PlayerStats>(); } } enemies = GameObject.FindGameObjectsWithTag("Enemy").Length; if (dungeon == null) { dungeon = GameObject.FindGameObjectWithTag("Dungeon"); if (dungeon != null) { theRooms = GameObject.FindGameObjectWithTag("Dungeon").GetComponent <RoomGeneration>(); } } // else // if (theRooms != null) // if (enemies <= 0&&saved==false) // { // Save(); // data.canyousave=true; // Debug.Log("Saved!"); // saved = true; // } }
void Start() { playerObjects = GameObject.Find("Player").GetComponent <PlayerObjects>(); playerEquipment = GameObject.Find("Player").GetComponent <PlayerEquipment>(); player = playerObjects.gameObject; moduleSFX = GetComponent <AudioSource>(); }
private void OnDequipRequested(PlayerEquipment equipment, ref bool shouldAllow) { var player = GetUnturnedPlayer(equipment.player) !; var inv = player.Player.inventory; var page = equipment.equippedPage; var index = inv.getIndex(page, equipment.equipped_x, equipment.equipped_y); var jar = inv.getItem(page, index); if (jar?.item == null) { return; } var @event = new UnturnedPlayerItemUnequippingEvent(player, new UnturnedItem(jar.item)) { IsCancelled = !shouldAllow }; Emit(@event); shouldAllow = [email protected]; }
public override void Use(PlayerInventory inventory, int inventoryIndex) { // find a slot that accepts this category, then equip it PlayerEquipment equipment = inventory.GetComponent <PlayerEquipment>(); int slot = FindEquipableSlotFor(equipment, inventoryIndex); if (slot != -1) { // merge? e.g. ammo stack on ammo stack if (inventory.slots[inventoryIndex].amount > 0 && equipment.slots[slot].amount > 0 && inventory.slots[inventoryIndex].item.Equals(equipment.slots[slot].item)) { ItemSlot slotFrom = inventory.slots[inventoryIndex]; ItemSlot slotTo = equipment.slots[slot]; // merge from -> to // put as many as possible into 'To' slot int put = slotTo.IncreaseAmount(slotFrom.amount); slotFrom.DecreaseAmount(put); // put back into the lists equipment.slots[slot] = slotTo; inventory.slots[inventoryIndex] = slotFrom; } // swap? else { equipment.SwapInventoryEquip(inventoryIndex, slot); } } }
private void Awake() { backpack = new List <GameInventoryItem>(); equipped = new List <Item>(); player = GetComponent <PlayerController>(); equipment = GetComponent <PlayerEquipment>(); }
void Start() { DoOnce2 = true; doOnce = true; currentState = 0; currentWaypoint = 1; stateTimer = 5; WayPointChangeTimer = 5; fairieSpawnTimer = 5; AttackActive = false; WayPoints[0] = new Vector3(4, -16, -1); WayPoints[1] = new Vector3(4, -4, -1); WayPoints[2] = new Vector3(16, -4, -1); WayPoints[3] = new Vector3(16, -16, -1); WayPoints[4] = new Vector3(10, -10, -1); player = GameObject.FindGameObjectWithTag("Player"); playMove = player.GetComponent <PlayerMovement>(); playerHealth = player.GetComponent <Health>(); heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); MyHealth = gameObject.GetComponent <Health>(); //playerHealth = player.GetComponent<Health>(); attackCooldownMax = 1; attackCooldown = attackCooldownMax; //rb2d = GetComponent<Rigidbody2D>(); controller = GetComponent <CharacterController>(); LornSig = (GameObject)Instantiate(LorneSignature, new Vector3(10, -10f, -1), new Quaternion(0, 0, 0, 0)); LornSigHaz = (GameObject)Instantiate(LorneSigHazards, new Vector3(7.25f, -9.55f, -1), new Quaternion(0, 0, 0, 0)); healthB = (GameObject)Instantiate(BossHealthBar); HealthRemaining = GameObject.FindGameObjectWithTag("Boss Health"); }
protected List<StateSkill> playerCardState; //卡片上附加的状态 #endregion Fields #region Constructors public PlayerCard() { this.cardOwnSkill = new List<Skill>(); this.playerCardState = new List<StateSkill>(); this.playerEquipment = new PlayerEquipment(this); }
void Awake () { equipment = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerEquipment>(); movement = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>(); }
void Awake () { equipment = GetComponent<PlayerEquipment>(); rightHand = GameObject.FindGameObjectWithTag("ShootingPoint").transform; }