Example #1
0
    void OnDeath(GameObject from)
    {
        if (from.name == "mushMine(Clone)")
        {
            from.GetComponent <MushBehavior>().CollectLoot(lootKind, lootCount);
        }
        else if (from.GetComponent <TankController>() != null)
        {
            UxChatController.SendToConsole(
                String.Format("{0} acquired {1} {2}",
                              from.GetComponent <TankController>().playerName,
                              lootCount,
                              NameMapping.ForProjectile(lootKind)));

            var inventory = from.GetComponent <ProjectileInventory>();
            if (inventory != null)
            {
                inventory.ServerModify(lootKind, lootCount);
            }
        }
        if (lootKind == ProjectileKind.mushboom)
        {
            LootSpawnController.singleton.mushboomCount--;
        }
        Destroy(gameObject);
    }
    // highlight A54202FF
    // normal 6B4E29FF

    public void AssignAmmo(ProjectileKind projectileKind, int count)
    {
        ammoNameText.text = NameMapping.ForProjectile(projectileKind);
        if (count > 99)
        {
            ammoCountText.text = "99+";
        }
        else
        {
            ammoCountText.text = count.ToString();
        }
    }
Example #3
0
    private void DivvyLoot()
    {
        List <int> theIndices = TurnManager.singleton.activeTanks;
        Dictionary <int, TankController> theTanks = TurnManager.singleton.tankRegistry;
        TankController theWinner;
        int            index = UnityEngine.Random.Range(0, theIndices.Count);

        if (theIndices.Count > 1)
        {
            for (int i = 0; i < lootPool.Count; i++)
            {
                if (index >= theIndices.Count)
                {
                    index = 0;
                }
                theWinner = theTanks[theIndices[index]];
                if (theWinner != null)
                {
                    var inventory = theWinner.GetComponent <ProjectileInventory>();
                    if (inventory != null)
                    {
                        inventory.ServerModify(lootPool[i], lootCount[i]);
                    }

                    UxChatController.SendToConsole(
                        String.Format("{0} scavenged {1} {2}",
                                      theWinner.playerName,
                                      lootCount[i],
                                      NameMapping.ForProjectile(lootPool[i])));
                }
                index++;
            }
        }
        lootPool.Clear();
        lootCount.Clear();
    }