//Bear trap void OnTrapArm(BearTrap trap, BasePlayer player) { var info = GetEntityInfo(trap); info.TrapOwner = player.userID; info.LastArmedTime = DateTime.UtcNow; }
public void UnlockPlayer() { if (bearTrap != null) { bearTrap.MakePlayerFree(); bearTrap = null; HideHud(); } }
private void BearTrapAbility() { CancelShooting(); doingBearTrap = true; ChangeAnimation(ref currentAnimation, bearTrapAnimation); ChangeAnimation(ref currentHandAnimation, handBearTrapAnimation); abilityOneCooldown = abilityOneMaxCooldown; UpdateSpriteEffect(); BearTrap bearTrap = new BearTrap(this, bearTrapDmg, shadow.Position, speed, direction); abilityBuffer.Add(bearTrap); }
public void ShowHud(BearTrap trap) { if (Application.platform == RuntimePlatform.Android) { pcHint.SetActive(false); } else { pcHint.SetActive(true); } panel.SetActive(true); bearTrap = trap; sekundyNaUvolnenie = trap.sekundyNaUvolnenie; }
private void RpcSetBearTrap(GameObject trap, string userTag) { if (trap == null) { Debug.Log("Trap is null"); } BearTrap bearTrap = trap.GetComponent <BearTrap>(); bearTrap.trapOwnerTag = userTag; WorldData2.AddTrap(bearTrap); if (userTag == PlayerData2.localPlayer.tag) { ItemUsed(); } else { // For the other player, disable collider that prevents additional traps from being placed nearby trap.transform.GetChild(0).GetComponent <CircleCollider2D>().enabled = false; } }
private object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info) { if (!ignoreProjectiles) { return(null); } BaseTrap trap = entity.GetComponent <BaseTrap>(); if (!trap) { return(null); } if (!info.IsProjectile()) { return(null); } BearTrap bearTrap = entity.GetComponent <BearTrap>(); if (bearTrap) { bearTrap.Arm(); } return(true); }
private void OnTrapTrigger(BearTrap trap, UnityEngine.GameObject go) { HookCalled("OnTrapTrigger"); }
private void OnTrapSnapped(BearTrap trap, UnityEngine.GameObject go) { HookCalled("OnTrapSnapped"); }
private void OnTrapArm(BearTrap trap, BasePlayer player) { HookCalled("OnTrapArm"); }
private void OnTrapArm(BearTrap trap) { HookCalled("OnTrapArm"); }
private void OnTrapTrigger(BearTrap trap, GameObject go) { HookCalled("OnTrapTrigger"); }
private object OnTrapTrigger(BearTrap trap, GameObject go) { return Interface.CallDeprecatedHook("OnBearTrapTrigger", trap, go); }
private void RpcDamageTrap(int id) { BearTrap trap = (BearTrap)WorldData2.traps[id]; trap.Damage(); }
public override void SetTrap() { newBearTrap = PhotonNetwork.Instantiate(bearTrapPrefab.name, transform.position, Quaternion.identity); BearTrapClas = newBearTrap.GetComponent <BearTrap>(); BearTrapClas.SetTheTag(gameObject.tag); }
public static void AddTrap(BearTrap trap) { traps.Add(trap); trap.id = traps.IndexOf(trap); //Debug.Log(trap.id); }
private void Update() { // only listen for clicks on our own game object. if (!hasAuthority) { return; } // highlight interactable at mouseover if in range to grab if (highlightedInteractable != null) { if (canInteract) { highlightedInteractable.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0.5f); } else { highlightedInteractable.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1); } } // Get mouse coordinates (for highlight tile) Vector2 mousePos = Input.mousePosition; Vector2 mouseWorldPos = Camera.main.ScreenToWorldPoint(mousePos); Vector3Int tileCoordinate = WorldData2.highlighter.WorldToCell(mouseWorldPos); if (Vector2.Distance(gameObject.transform.position - new Vector3(0, 0.4f, 0), mouseWorldPos) < interactionRange) { canInteract = true; } else { canInteract = false; } // If placable item is selected form inventory, draw item at cursor if (inventory.selectedSlot.First != null && inventory.selectedSlot.First.Value.itemName == "BearTrap") { WorldData2.highlighter.SetTile(tileCoordinate, null); WorldData2.highlighter.SetTile(previousTileCoordinate, null); DrawItemAtCursor(mouseWorldPos); } // Highlight tile at mouseover else { Color color = selectedItemSR.material.color; color.a = 0; selectedItemSR.material.color = color; CursorHighlight(tileCoordinate); // Cursor disappears when out of range } //Scroll to change items if (Input.mouseScrollDelta.y < 0) { if (oldSlotNumber < 4) { SetSlot(slotNames[oldSlotNumber + 1], oldSlotNumber + 1); } else { SetSlot(slotNames[0], 0); } } if (Input.mouseScrollDelta.y > 0) { if (oldSlotNumber > 0) { SetSlot(slotNames[oldSlotNumber - 1], oldSlotNumber - 1); } else { SetSlot(slotNames[4], 4); } } if (Input.GetKeyDown(KeyCode.R)) { inventory.DropItem(); } // Change Item Cursor with keys 1-5 if (Input.GetKeyDown(KeyCode.Alpha1)) { SetSlot("Slot1UI", 0); } if (Input.GetKeyDown(KeyCode.Alpha2)) { SetSlot("Slot2UI", 1); } if (Input.GetKeyDown(KeyCode.Alpha3)) { SetSlot("Slot3UI", 2); } if (Input.GetKeyDown(KeyCode.Alpha4)) { SetSlot("Slot4UI", 3); } if (Input.GetKeyDown(KeyCode.Alpha5)) { SetSlot("Slot5UI", 4); } // Interact if (Input.GetMouseButtonDown(0) && (canInteract || canInteractWithTile)) { ShopSystem shop; // used to store shop script if exists on interactable // Check if interactable object was clicked if (highlightedInteractable != null) { // Check if interactable object is an item if (highlightedInteractable.GetComponent <Item2>() != null) { highlightedInteractable.gameObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1); Item2 itemToAdd = highlightedInteractable.GetComponent <Item2>(); highlightedInteractable = null; bool couldAdd = inventory.AddItem(itemToAdd); if (couldAdd) { SoundControl.PlayHarvestSound(); //Remove the pickup and planted location from user and all other clients int removedID = WorldData2.RemovePlantedLocation(WorldData2.p1DiggableLayer.WorldToCell(mouseWorldPos)); if (itemToAdd.gameObject.GetComponent <plantID>() != null) { removedID = itemToAdd.gameObject.GetComponent <plantID>().ID; } CmdAddItem(itemToAdd, removedID); } } // Check if interactable object is a seed bin else if (highlightedInteractable.GetComponent <SeedBin>() != null) { SoundControl.PlayButtonSound(); inventory.AddItem(highlightedInteractable.GetComponent <SeedBin>().seed); } // Check if interactable object is a sell bin else if (highlightedInteractable.GetComponent <SellingBin>() != null) { inventory.SellItem(); } // Check if interactable object is the shop else if ((shop = highlightedInteractable.GetComponent <ShopSystem>()) != null) { shop.OpenShopWindow(); } // Check if interactable object is a trap else if (highlightedInteractable.GetComponent <BearTrap>() != null)// && highlightedInteractable.GetComponent<BearTrap>().trapOwnerTag != PlayerData2.localPlayer.tag) { BearTrap bt = highlightedInteractable.GetComponent <BearTrap>(); if (isServer) { RpcDamageTrap(bt.id); } else { CmdDamageTrap(bt.id); } //highlightedInteractable.GetComponent<BearTrap>().Damage(); } } // Use item else if (inventory.selectedSlot.First != null) { Debug.Log("Using Item"); if (inventory.selectedSlot.First.Value.itemName == "BearTrap" && canInteract) { if (canPlaceItem) { inventory.UseSelectedItem(mouseWorldPos); } } else // if item interacts with tiles (e.g. shovel and seeds) if (canInteractWithTile) { inventory.UseSelectedItem(mouseWorldPos); } } // No actions else { // Can test new functions here, Activates when empty item slot is selected when click in radius occurs Debug.Log("false"); } } }
private object IOnTrapArm(BearTrap trap, BaseEntity.RPCMessage msg) { return Interface.CallHook("OnTrapArm", trap, msg.player); }
private void OnTrapSnapped(BearTrap trap, GameObject go) { HookCalled("OnTrapSnapped"); }