IEnumerator UpdateTick(int entityID)
        {
            while (true)
            {
                var playerBonusEntityView   = _playerBonusEntityViews[entityID];
                var playerAmmoBoxComponent  = playerBonusEntityView.playerAmmoBoxComponent;
                var bulletsManagerComponent = _hudEntityView.bulletsManagerComponent;

                // If the player colided with the ammo box and he doesn't have all the bullets then reset his bullets
                // to the initial bullets count

                if (playerAmmoBoxComponent.colided &&
                    bulletsManagerComponent.currentBullets < bulletsManagerComponent.totalBullets)
                {
                    bulletsManagerComponent.ResetBullets();
                    playerAmmoBoxComponent.colided = false;
                    playerAmmoBoxComponent.DestroyBox();
                    // Tell the Bonus Spawner Engine that the ammobox was removed from the scene
                    var pickupInfo = new PickupInfo(playerAmmoBoxComponent.id, SpawnerTypes.Ammobox);
                    _playerPickupSequence.Next(this, ref pickupInfo);
                }

                yield return(null);
            }
        }
Пример #2
0
    private GameObject TryGetRandomPickup()
    {
        float random = Random.Range(0.0f, 1.0f);

        var pickup            = new PickupInfo();
        var chanceAccumulator = 0;
        var availablePickups  = OtherPickups.Where(o => (!o.Singleton || o.SpawnCount == 0)).ToList();

        foreach (var currentPickup in availablePickups)
        {
            chanceAccumulator += currentPickup.Chance;

            if (chanceAccumulator / (float)PickupChanceCount > random)
            {
                pickup = currentPickup;
                break;
            }
        }

        if (pickup.Singleton && pickup.SpawnCount > 0)
        {
            return(null);
        }

        if (pickup.PickupPrefab != null)
        {
            var index = OtherPickups.IndexOf(pickup);
            pickup.SpawnCount++;
            OtherPickups[index] = pickup;

            return(pickup.PickupPrefab);
        }

        return(null);
    }
    public void GiveItem(PickupInfo itemInfo){
        Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Pickup " + itemInfo.itemIndex + " triggered giveitem.");
        if (hasAuthority) {
            //Create all slots if not created yet
            if(m_slots.Count < maxSlotsCount){
                for(int i = 0; i < maxSlotsCount; i++){
                    m_slots.Add(0); // Add an empty slot with itemid 0.
                    m_slotCharges.Add(0); // Add a slotCharges entry with 0 charges.
                    Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Adding slot " + i);
                }
                //if it is a first item switch to it
                m_currentSlot = m_availableItems[itemInfo.itemIndex].m_slot;
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Changing current slot " + m_currentSlot);
                m_syncSlot = m_currentSlot;
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Changing sync'd slot " + m_syncSlot);
                Rpc_FirstItem(m_currentSlot);
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Calling Rpc_FirstItem on " + m_currentSlot);
            }

            if(m_slots[m_availableItems[itemInfo.itemIndex].m_slot] == itemInfo.itemIndex){
                //Add ammo only if item already is in inventory
                m_slotCharges[m_availableItems[itemInfo.itemIndex].m_slot] += itemInfo.itemAmmo;
                //m_availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Gave Ammo " + itemInfo.itemAmmo);
            }
            else{
                //Add item and ammo
                m_slots[m_availableItems[itemInfo.itemIndex].m_slot] = itemInfo.itemIndex;
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Gave ItemID " + itemInfo.itemIndex);
                m_slotCharges[m_availableItems[itemInfo.itemIndex].m_slot] += itemInfo.itemAmmo;
                //m_availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
                Debug.Log(GetObjectDebugInfo() + "|NetworkedObserverInventory::GiveItem:OBSERVATION: Gave Ammo " + itemInfo.itemAmmo);
            }
        }
    }
Пример #4
0
        private void TryPickup()
        {
            Ray        ray = new Ray(cameraPitchPivot.transform.position, cameraPitchPivot.transform.forward);
            RaycastHit hit;

            if (Raycast(ray, out hit, maxPickupDistance))
            {
                Rigidbody rb = hit.collider.gameObject.GetComponentInParent <Rigidbody>();
                if (rb)
                {
                    pickupInfo           = new PickupInfo();
                    pickupInfo.rigidbody = rb;
                    float   divFactor = 0;
                    Vector3 center    = Vector3.zero;
                    foreach (var collider in pickupInfo.rigidbody.GetComponentsInChildren <Collider>())
                    {
                        Vector3 size   = collider.bounds.size;
                        float   volume = size.x * size.y * size.z;
                        center    += collider.bounds.center * volume;
                        divFactor += volume;

                        Physics.IgnoreCollision(capsuleCollider, collider, true);
                    }
                    center           /= divFactor;
                    pickupInfo.center = center;
                }
            }
        }
Пример #5
0
    public void GiveItem(PickupInfo itemInfo)
    {
        if (hasAuthority)
        {
            //Create all slots if not created yet
            if (_slots.Count < maxSlotsCount)
            {
                for (int i = 0; i < maxSlotsCount; i++)
                {
                    _slots.Add(-1);
                }
                //if it is a first item switch to it
                _currentSlot = _availableItems[itemInfo.itemIndex].slot;
                _syncSlot    = _currentSlot;
                Rpc_FirstItem(_currentSlot);
            }

            if (_slots[_availableItems[itemInfo.itemIndex].slot] == itemInfo.itemIndex)
            {
                //Add ammo only if item already is in inventory
                _availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
            }
            else
            {
                //Add item and ammo
                _slots[_availableItems[itemInfo.itemIndex].slot] = itemInfo.itemIndex;
                _availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
            }
        }
    }
Пример #6
0
 private void DropPickup()
 {
     foreach (var collider in pickupInfo.rigidbody.GetComponentsInChildren <Collider>())
     {
         Physics.IgnoreCollision(capsuleCollider, collider, false);
     }
     pickupInfo = null;
 }
Пример #7
0
 public void OnAcquirePickup(PickupInfo pickup)
 {
     if (acquiredPickups.ContainsKey(pickup.type)) {
         acquiredPickups[pickup.type].Add (pickup);
     }else{
         acquiredPickups[pickup.type] = pickup;
     }
 }
Пример #8
0
 // This callback is called when the flag is not retrieved for a period of time.
 private void OnFlagIsNotRetrievedPeriodOfTime(object sender, EventArgs e)
 {
     Flag.Delete();
     Flag.Create();
     Flag.IsPositionBase = true;
     PickupInfo.Dispose();
     BasePlayer.SendClientMessageToAll($"{OtherColor}[Auto-Return]: La bandera {NameColor} regresó a su posición inicial.");
 }
Пример #9
0
 // Update is called once per frame
 void Update()
 {
     statusText.text = "";
     foreach (string key in acquiredPickups.Keys)
     {
         PickupInfo pickup = acquiredPickups[key];
         statusText.text += pickup.type + " x" + pickup.count.ToString() + "\n";
     }
     statusText.text += "--------------\nTotal score: " + TotalScore().ToString();
 }
Пример #10
0
 public void Recover(Player player)
 {
     Flag.IsPositionBase = true;
     Flag.Create();
     PickupInfo.Dispose();
     BasePlayer.SendClientMessageToAll($"{OtherColor}[Team {NameTeam}]: {player.Name} recuperó la bandera {NameColor} del equipo {NameTeam}.");
     BasePlayer.GameTextForAll($"~n~~n~~n~{ColorGameText}la bandera {NameColor} fue recuperada!", 5000, 3);
     player.UpdateAdrenaline(4, "recuperar la bandera");
     Timer.Stop();
 }
        public int SetData(Object data)
        {
            if (!(data is PickupInfo))
            {
                return(-1);
            }

            mPickupInfo = data as PickupInfo;
            return(0);
        }
Пример #12
0
 public void OnAcquirePickup(PickupInfo pickup)
 {
     if (acquiredPickups.ContainsKey(pickup.type))
     {
         acquiredPickups[pickup.type].Add(pickup);
     }
     else
     {
         acquiredPickups[pickup.type] = pickup;
     }
 }
Пример #13
0
    public bool INeedAPickUp(GameObject source, int id)
    {
        PickupInfo temp = new PickupInfo(source, id);

        if (PickupQueue.Contains(temp) == false)
        {
            PickupQueue.Add(temp);
            return(true);
        }
        return(false);
    }
Пример #14
0
        /// <summary>
        /// Gets the information for the last pickup played.
        /// </summary>
        /// <returns>The information for the last pickup game played, if any.</returns>
        public PickupInfo GetLastPickupInfo()
        {
            var pInfo = new PickupInfo();

            if (VerifyDb())
            {
                try
                {
                    using (var sqlcon = new SQLiteConnection(_sqlConString))
                    {
                        sqlcon.Open();

                        using (var cmd = new SQLiteCommand(sqlcon))
                        {
                            cmd.CommandText =
                                "SELECT * FROM pickupgames ORDER BY startDate DESC LIMIT 1";
                            using (var reader = cmd.ExecuteReader())
                            {
                                if (!reader.HasRows)
                                {
                                    return(null);
                                }
                                while (reader.Read())
                                {
                                    pInfo.RedTeam     = (string)reader["redTeam"];
                                    pInfo.BlueTeam    = (string)reader["blueTeam"];
                                    pInfo.RedCaptain  = (string)reader["redCaptain"];
                                    pInfo.BlueCaptain =
                                        (string)reader["blueCaptain"];
                                    pInfo.Subs      = (string)reader["subs"];
                                    pInfo.NoShows   = (string)reader["noShows"];
                                    pInfo.StartDate =
                                        (DateTime)reader["startDate"];
                                    Log.Write(string.Format(
                                                  "Got last pickup info from pickup database. Red: {0} (cap: {1}), Blue: {2}" +
                                                  " (cap: {3}), Subs: {4}, No-shows: {5}, Started: {6}", pInfo.RedTeam, pInfo.RedCaptain,
                                                  pInfo.BlueTeam, pInfo.BlueCaptain, pInfo.Subs, pInfo.NoShows, pInfo.StartDate.ToString(
                                                      "G", DateTimeFormatInfo.InvariantInfo)), _logClassType, _logPrefix);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.WriteCritical(string.Format(
                                          "Problem getting info for pickup game (dated: {0}) from pickup database: {1}",
                                          pInfo.StartDate.ToString("G", DateTimeFormatInfo.InvariantInfo), ex.Message),
                                      _logClassType, _logPrefix);
                    return(null);
                }
            }
            return(pInfo);
        }
Пример #15
0
    private void updateArmor(Component other)
    {
        var destructible = other.GetComponent <Destructible>();

        PickupInfo.Spawner("Armor Maximum", ArmorDeltaMax);
        PickupInfo.Spawner("Armor Regeneration", ArmorDeltaRegen);
        PickupInfo.Spawner("Armor Boost", ArmorDelta);

        destructible.MaxArmor          = Mathf.Max(destructible.MaxArmor + ArmorDeltaMax, 0);
        destructible.ArmorRegeneration = Mathf.Max(destructible.ArmorRegeneration + ArmorDeltaRegen, 0);
        destructible.CurrentArmor      = Mathf.Clamp(destructible.CurrentArmor + ArmorDelta, 0, destructible.MaxArmor);
    }
Пример #16
0
    private void updateShields(Component other)
    {
        var destructible = other.GetComponent <Destructible>();

        PickupInfo.Spawner("Shield Maximum", ShieldDeltaMax);
        PickupInfo.Spawner("Shield Regeneration", ShieldDeltaRegen);
        PickupInfo.Spawner("Shield Boost", ShieldDelta);

        destructible.MaxShield          = Mathf.Max(destructible.MaxShield + ShieldDeltaMax, 0);
        destructible.ShieldRegeneration = Mathf.Max(destructible.ShieldRegeneration + ShieldDeltaRegen, 0);
        destructible.CurrentShield      = Mathf.Clamp(destructible.CurrentShield + ShieldDelta, 0, destructible.MaxShield);
    }
Пример #17
0
    public override void OnEnable()
    {
        base.OnEnable();
        pickupInfo = new PickupInfo
        {
            pickupTime = 0.0,
            isPicked   = false,
            acks       = new LinkedList <bool>()
        };

        PhotonNetwork.NetworkingClient.EventReceived += OnAmmoPicked;
    }
Пример #18
0
        /// <summary> Adds the pickup game to the database. </summary> <param name="pInfo">The
        /// pickup game information.</param> <remarks>Note: The game is not added to the database
        /// until both red & blue teams are full after captains have picked players.</remarks>
        public void AddPickupGame(PickupInfo pInfo)
        {
            if (VerifyDb())
            {
                try
                {
                    using (var sqlcon = new SQLiteConnection(_sqlConString))
                    {
                        sqlcon.Open();

                        using (var cmd = new SQLiteCommand(sqlcon))
                        {
                            cmd.CommandText =
                                "INSERT INTO pickupgames(redTeam, blueTeam, redCaptain, blueCaptain, subs," +
                                " noShows, startDate) VALUES(@redTeam, @blueTeam, @redCaptain, " +
                                "@blueCaptain, @subs, @noShows, @startDate)";
                            cmd.Parameters.AddWithValue("@redTeam",
                                                        pInfo.RedTeam);
                            cmd.Parameters.AddWithValue("@blueTeam",
                                                        pInfo.BlueTeam);
                            cmd.Parameters.AddWithValue("@redCaptain",
                                                        pInfo.RedCaptain);
                            cmd.Parameters.AddWithValue("@blueCaptain",
                                                        pInfo.BlueCaptain);
                            cmd.Parameters.AddWithValue("@subs", pInfo.Subs);
                            cmd.Parameters.AddWithValue("@noShows",
                                                        pInfo.NoShows);
                            cmd.Parameters.AddWithValue("@startDate",
                                                        pInfo.StartDate);
                            // default end time. Use UpdatePickupEndTime to change
                            cmd.Parameters.AddWithValue("@endDate",
                                                        default(DateTime));
                            cmd.ExecuteNonQuery();
                            Log.Write(string.Format(
                                          "AddPickupGame: Successfully added pickup game: Red team: {0}, Blue Team: {1}, Red captain: {2}, Blue captain:" +
                                          " {3}, Subs: {4}, No-shows: {5}, Starting at: {6} to pickup database.",
                                          pInfo.RedTeam, pInfo.BlueTeam, pInfo.RedCaptain,
                                          pInfo.BlueCaptain, pInfo.Subs,
                                          pInfo.NoShows,
                                          pInfo.StartDate.ToString("G",
                                                                   DateTimeFormatInfo.InvariantInfo)), _logClassType, _logPrefix);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.WriteCritical(string.Format(
                                          "Problem adding pickup game (dated: {0}) to pickup database: {1}",
                                          pInfo.StartDate.ToString("G", DateTimeFormatInfo.InvariantInfo), ex.Message),
                                      _logClassType, _logPrefix);
                }
            }
        }
Пример #19
0
    void activateItem(PickupInfo info)
    {
        Debug.Log("Attempted to activate " + info.kind.ToString());
        switch (info.kind)
        {
        case PickupInfo.Kind.PizzaHeal:
            if (inventory.pizzaHeals > 0)
            {
                inventory.pizzaHeals--;
                pizza.Heal();
            }
            break;

        case PickupInfo.Kind.PizzaShield:
            if (inventory.pizzaShields > 0)
            {
                inventory.pizzaShields--;
                StartCoroutine(pizza.Shield(info.effectDuration));
            }
            break;

        case PickupInfo.Kind.PizzaBoost:
            if (inventory.pizzaBoosts > 0)
            {
                inventory.pizzaBoosts--;
                pizza.PizzaBoosted();
                StartCoroutine(pizza.GetComponent <PathFollower>().ApplyBoost(info.effectDuration, info.effectStrength));
            }
            break;

        case PickupInfo.Kind.PizzaSlow:
            if (inventory.pizzaSlows > 0)
            {
                inventory.pizzaSlows--;
                pizza.PizzaSlowed();
                StartCoroutine(pizza.GetComponent <PathFollower>().ApplySlow(info.effectDuration, info.effectStrength));
            }
            break;

        case PickupInfo.Kind.PlayerBoost:
            if (inventory.playerBoosts > 0)
            {
                inventory.playerBoosts--;
                audioSource.PlayOneShot(PlayerBoostSound);
                StartCoroutine(playerMovement.ApplyBoost(info.effectDuration, info.effectStrength));
            }
            break;

        default:
            break;
        }
    }
Пример #20
0
    public bool Equals(PickupInfo other)
    {
        if (other == null)
        {
            return(false);
        }

        if (this.Pickup.name.Equals(other.Pickup.name) && this.id.Equals(other.id))
        {
            return(true);
        }
        return(false);
    }
    void Start()
    {
        MyPickup  = new PickupInfo();
        MyDeliv   = new DeliveryItem();
        MaxWeight = 50;
        MyMoney   = GameObject.FindGameObjectWithTag("PlayerTotals").GetComponent <MainMoney> ();
        MyHero    = this.gameObject.GetComponent <HeroAI> ();
//		MainHandWeapon = new WeaponInfo ();
//		OffHandWeapon= new WeaponInfo ();
//		ShieldArmor= new ArmorInfo();
//		ChestArmor = new ArmorInfo();
//		HeadArmor= new ArmorInfo();
//		LegArmor= new ArmorInfo();
//		FeetArmor= new ArmorInfo();
    }
Пример #22
0
 public static List<PickupInfo> GetPickupList(int start,int count)
 {
     string strSQL= "SELECT TOP " + count + " * FROM Pickup WHERE State = '1' AND ID NOT IN(SELECT TOP " + start + " ID FROM Pickup WHERE State = '1' ORDER BY UploadTime DESC) ORDER BY UploadTime DESC";
     SqlDataReader PickupDataReader = DAL.SQLHelper.GetReader(strSQL);
     List<PickupInfo> PickupList = new List<PickupInfo>();
     while (PickupDataReader.Read())
     {
         PickupInfo info = new PickupInfo();
         info.PickupID = PickupDataReader["ID"].ToString();
         info.PickupCommendItem = PickupDataReader["CommendItem"].ToString();
         info.PickupCommendItemIcon = PickupDataReader["CommendItemIcon"].ToString().Replace(",","");
         info.PickupCommendContent = PickupDataReader["CommendContent"].ToString();
         info.PickupUploadTime = Convert.ToDateTime(PickupDataReader["UploadTime"].ToString()).ToString("MM/dd/yyyy");
         PickupList.Add(info);
     }
     return PickupList;
 }
Пример #23
0
    private void updateEnergy(Component other)
    {
        var w = other.GetComponentInChildren <PlayerWeapon>();

        if (!w)
        {
            return;
        }

        PickupInfo.Spawner("Energy Maximum", EnergyDeltaMax);
        PickupInfo.Spawner("Energy Regeneration", EnergyDeltaRegen);
        PickupInfo.Spawner("Energy Boost", EnergyDelta);

        w.MaxEnergy          = Mathf.Max(w.MaxEnergy + EnergyDeltaMax, 0);
        w.EnergyRegeneration = Mathf.Max(w.EnergyRegeneration + EnergyDeltaRegen, 0);
        w.CurrentEnergy      = Mathf.Clamp(w.CurrentEnergy + EnergyDelta, 0, w.MaxEnergy);
    }
Пример #24
0
        /// <summary>
        /// Updates the most recent pickup game.
        /// </summary>
        /// <param name="pInfo">The pickup information.</param>
        public void UpdateMostRecentPickupGame(PickupInfo pInfo)
        {
            if (VerifyDb())
            {
                try
                {
                    using (var sqlcon = new SQLiteConnection(_sqlConString))
                    {
                        sqlcon.Open();

                        using (var cmd = new SQLiteCommand(sqlcon))
                        {
                            cmd.CommandText =
                                "UPDATE pickupgames SET redTeam = @redTeam, blueTeam = @blueTeam, redCaptain = @redCaptain, " +
                                "blueCaptain = @blueCaptain, subs = @subs, noShows = @noShows, startDate = @startDate WHERE" +
                                " id IN (SELECT id FROM pickupgames ORDER BY startDate DESC LIMIT 1)";
                            cmd.Parameters.AddWithValue("@redTeam", pInfo.RedTeam);
                            cmd.Parameters.AddWithValue("@blueTeam", pInfo.BlueTeam);
                            cmd.Parameters.AddWithValue("@redCaptain",
                                                        pInfo.RedCaptain);
                            cmd.Parameters.AddWithValue("@blueCaptain",
                                                        pInfo.BlueCaptain);
                            cmd.Parameters.AddWithValue("@subs", pInfo.Subs);
                            cmd.Parameters.AddWithValue("@noShows", pInfo.NoShows);
                            cmd.Parameters.AddWithValue("@startDate", pInfo.StartDate);
                            cmd.ExecuteNonQuery();
                            Log.Write(string.Format(
                                          "Successfully UPDATED most recent pickup game: Red team: {0}, Blue Team: {1}, Red captain: {2}, Blue captain:" +
                                          " {3}, Subs: {4}, No-shows: {5}, Starting at: {6} in pickup database.",
                                          pInfo.RedTeam, pInfo.BlueTeam, pInfo.RedCaptain,
                                          pInfo.BlueCaptain, pInfo.Subs, pInfo.NoShows,
                                          pInfo.StartDate.ToString("G", DateTimeFormatInfo.InvariantInfo)), _logClassType, _logPrefix);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.WriteCritical(string.Format(
                                          "Problem updating most recent pickup game (dated: {0}) in pickup database: {1}",
                                          pInfo.StartDate.ToString("G", DateTimeFormatInfo.InvariantInfo), ex.Message),
                                      _logClassType, _logPrefix);
                }
            }
        }
        private void Loading(CancellationToken ct, PickupInfo pickupInfo)
        {
            // 开始文件加载
            ShowLoadingState((string)mWin.FindResource("parsing_changelog"));

            int[] startVersion = ParseVersion(mPickupInfo.startVersion);
            int[] endVersion   = ParseVersion(mPickupInfo.endVersion);
            if (null == startVersion || null == endVersion)
            {
                LoadingCompleted(false, (string)mWin.FindResource("parse_changelog_failed"));
                return;
            }

            if (startVersion[0] >= endVersion[0] && startVersion[1] > endVersion[1])
            {
                // 版本号选反了, 交换一下
                int tmp = startVersion[0];
                startVersion[0] = endVersion[0];
                endVersion[0]   = tmp;

                tmp             = startVersion[1];
                startVersion[1] = endVersion[1];
                endVersion[1]   = tmp;
            }

            bool isSameVersion = (startVersion[0] == endVersion[0]) &&
                                 (startVersion[1] == endVersion[1]);

            if (isSameVersion)
            {
                LoadingCompleted(false, (string)mWin.FindResource("parse_changelog_same_version"));
                return;
            }

            mChangelog = BuildPickupDiffVersion(startVersion, endVersion, mPickupInfo.oemName);
            if (null == mChangelog)
            {
                LoadingCompleted(false, (string)mWin.FindResource("parse_changelog_failed"));
                return;
            }

            LoadingCompleted(true);
        }
Пример #26
0
    public override bool Equals(System.Object obj)
    {
        if (obj == null)
        {
            return(false);
        }
        PickupInfo c = obj as PickupInfo;

        if ((System.Object)c == null)
        {
            return(false);
        }


        if (this.Pickup.name.Equals(c.Pickup.name) && this.id.Equals(c.id))
        {
            return(true);
        }
        return(false);
    }
Пример #27
0
 public void Carry(Player player)
 {
     BasePlayer.SendClientMessageToAll($"{OtherColor}[Team {NameTeam}]: {player.Name} llevó la bandera {NameColor} del equipo {NameTeam} a su base.");
     BasePlayer.GameTextForAll($"~n~~n~~n~{TeamRival.ColorGameText}+1 score team {TeamRival.NameTeam}", 5000, 3);
     player.RemoveAttachedObject(0);
     Flag.Create();
     PickupInfo.Dispose();
     Flag.PlayerCaptured = null;
     Flag.IsPositionBase = true;
     ++TeamRival.Score;
     TeamRival.UpdateTdScore();
     player.UpdateAdrenaline(10, "llevar la bandera tu base");
     player.UpdateData("droppedFlags", ++player.Data.DroppedFlags);
     foreach (Player player1 in player.PlayerTeam.Players)
     {
         if (player != player1)
         {
             player1.UpdateAdrenaline(3, "ayudar a capturar la bandera");
         }
     }
 }
    public bool NewDelivry(DeliveryItem newone)
    {
        if (newone.Destination != "" && newone.DesVec != new Vector3() && newone.Isempty() == false)
        {
            MyDeliv        = newone;
            CurrentWeight += newone.DelWeight();
            MyHero.MyWorkControl.PickupDone(MyPickup);
            MyPickup = new PickupInfo();

            return(true);
        }

        MyHero.MyWorkControl.PickupDone(MyPickup);


        if (MyHero.myrole == HeroAI.Role.Hero && MyPickup.Pickup.tag == "ResourceNode")
        {
            MyPickup.Pickup.GetComponent <ResNode> ().IDontWanna(MyHero.HeroIdNumber);
        }
        MyPickup = new PickupInfo();
        return(false);
    }
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            string oemName      = this.OemName.Text;
            string startVersion = this.StartVersion.Text;
            string endVersion   = this.EndVersion.Text;

            if (string.IsNullOrWhiteSpace(oemName) ||
                string.IsNullOrWhiteSpace(startVersion) ||
                string.IsNullOrWhiteSpace(endVersion))
            {
                ShowTipMessage((string)mWin.FindResource("bad_parameters"));
                return;
            }

            mPickupInfo               = new PickupInfo();
            mPickupInfo.oemName       = oemName;
            mPickupInfo.startVersion  = startVersion;
            mPickupInfo.endVersion    = endVersion;
            mPickupInfo.changelogList = mChangelogList;

            mWin.Next();
        }
    public void DropOff()
    {
        if (MyDeliv.Armor.Count != 0)
        {
        }
        if (MyDeliv.Weapon.Count != 0)
        {
        }
        if (MyDeliv.Mats.Count != 0)
        {
            List <MatInfo> Stillneed = new List <MatInfo> ();
            foreach (MatInfo temp in MyDeliv.Mats)
            {
                if ((MyMoney.CanIBuy(MyDeliv.Price, true) == true) && (MyMoney.IsResourceMax(temp, 1, temp.isRefine) == false))
                {
                    MyHero.HeroGold += MyDeliv.Price;
                    MyMoney.AddResource(temp, 1, temp.isRefine);
                }
                else
                {
                    DeliveryFailed = true;
                    Stillneed.Add(temp);
                    TimeBeforeTryDelivery = Time.time + 20.0f;
                }
            }
            if (DeliveryFailed == true)
            {
                MyDeliv.Mats = Stillneed;
            }
        }


        if (DeliveryFailed == false)
        {
            MyDeliv = new DeliveryItem();
        }
        //	resNodeTarget = null;
        MyPickup = new PickupInfo();
    }
        IEnumerator UpdateTick(int spawnerID)
        {
            while (true)
            {
                var playerMedkitEntityView = _playerMedkitEntityViews[spawnerID];

                if (playerMedkitEntityView == null)
                {
                    yield return(null);
                }

                var playerMedkitComponent = playerMedkitEntityView.playerMedkitComponent;
                var healthSliderComponent = _hudEntityView.healthSliderComponent;


                if (playerMedkitComponent.colided)
                {
                    var entityView            = entityViewsDB.QueryEntityView <HealthEntityView>(playerMedkitComponent.instanceID);
                    var playerHealthComponent = entityView.healthComponent;

                    // Don't destroy the health pack and don't heal the player if he is full hp

                    if (playerHealthComponent.currentHealth < playerHealthComponent.maxHealth)
                    {
                        var healInfo = new HealInfo(playerMedkitComponent.healthBonus, playerMedkitComponent.instanceID);
                        _playerHealSequence.Next(this, ref healInfo);

                        playerMedkitComponent.DestroyBox();

                        var pickupInfo = new PickupInfo(playerMedkitComponent.id, SpawnerTypes.Medkit);
                        _playerPickupSequence.Next(this, ref pickupInfo);
                    }

                    playerMedkitComponent.colided = false;
                }

                yield return(null);
            }
        }
Пример #32
0
	public void GiveItem(PickupInfo itemInfo){
		if (hasAuthority) {
			//Create all slots if not created yet
			if(_slots.Count < maxSlotsCount){
				for(int i =0;i < maxSlotsCount;i++){
					_slots.Add(-1);
				}
				//if it is a first item switch to it
				_currentSlot = _availableItems[itemInfo.itemIndex].slot;
				_syncSlot = _currentSlot;
				Rpc_FirstItem(_currentSlot);
			}

			if(_slots[_availableItems[itemInfo.itemIndex].slot] == itemInfo.itemIndex){
				//Add ammo only if item already is in inventory
				_availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
			}else{
				//Add item and ammo
				_slots[_availableItems[itemInfo.itemIndex].slot] = itemInfo.itemIndex;
				_availableItems[itemInfo.itemIndex].GiveAmmo(itemInfo.itemAmmo);
			}
		}
	}
Пример #33
0
 public void Add(PickupInfo other)
 {
     score += other.score * other.count;
     count += other.count;
 }
Пример #34
0
 public void Add(PickupInfo other)
 {
     score += other.score * other.count;
     count += other.count;
 }