void Start() { base.Init(); ourTransform = transform.parent; CurrentHealthPoints = CurrentPlayer.Instance.HealthPoints; WaitHalfSecond = new WaitForSeconds(WaitTimeForDig); invulCD = new WaitForSeconds(invulTime); for (int i = 0; i < theEquipments.Count; i++) { if (theEquipments[i] is SmallBombData) { TheCurrentItem = theEquipments[i]; } } UiHolder theHolder = GameObject.Find("GameSceneController").GetComponent <UiHolder>(); ourPlayerHealthBar = GetComponent <HealthBar>(); HP = theHolder.HP; NumberOfBombs = theHolder.AmountOfBombs; BombType = theHolder.TypeOfBomb; UpdateUI(TheCurrentItem); //UpdateHealth(CurrentHealthPoints); if (this.player_id == DarkRiftAPI.id) { StartCoroutine(UpdatePosition()); } tilePosBlocker = new Vector2(-1, -1); }
public void UpdateUI(EquipmentBase theBomb) { theBomb.UpdateInGameUI(NumberOfBombs, BombType); }
protected override void OnMouseButtonDown(MouseButtons button, int id, int theItemID) { if (id == player_id) { if (button == MouseButtons.left) { if (theTileMap.theMap.GetTileAt(currentTilePos) is Noblock || theTileMap.theMap.GetTileAt(currentTilePos) is InvisibleWallBlock) { if (TheCurrentItem is GrenadeData) { GrenadeData grenade = (GrenadeData)TheCurrentItem; grenade.SetDirection(ourDirection); } GameObject obj = TheCurrentItem.PlayerSpawnBomb(theTileMap.ConvertTileToWorld(currentTilePos)); if (obj != null) { RemoteBomb remote = obj.GetComponent <RemoteBomb>(); if (remote != null) { remote.id = id; } if (DarkRiftAPI.isConnected) { DarkRiftAPI.SendMessageToOthers(NetworkingTags.Events, NetworkingTags.EventSubjects.leftMouseButton, TheCurrentItem.OrderID); } obj.GetComponent <BombsParent>().ID = id; } } } else if (button == MouseButtons.right) { ActivateRemote(DarkRiftAPI.id); if (DarkRiftAPI.isConnected) { DarkRiftAPI.SendMessageToOthers(NetworkingTags.Events, NetworkingTags.EventSubjects.rightMouseButton, DarkRiftAPI.id); } } else if (button == MouseButtons.ScrollDown) { bool Changed = false; for (int i = TheCurrentItem.OrderID + 1; i < theEquipments.Count; i++) { if (theEquipments[i].Amount > 0) { TheCurrentItem = theEquipments[i]; Changed = true; break; } } if (!Changed) { TheCurrentItem = theEquipments[0]; } } else if (button == MouseButtons.ScrollUp) { bool Changed = false; if (TheCurrentItem.OrderID == 0) { for (int i = theEquipments.Count - 1; i >= 0; i--) { if (theEquipments[i].Amount > 0) { TheCurrentItem = theEquipments[i]; Changed = true; break; } } } else { for (int i = TheCurrentItem.OrderID - 1; i >= 0; i--) { if (theEquipments[i].Amount > 0) { TheCurrentItem = theEquipments[i]; Changed = true; break; } } } if (!Changed) { TheCurrentItem = theEquipments[0]; } } } UpdateUI(TheCurrentItem); }
public void AddItem(EquipmentBase item) { }