Ejemplo n.º 1
0
        //Damage
        //Range
        //ClipSize
        //AmountCount
        //FireRate
        //ReloadTime
        //ImpactForce

        public void SetStats(WeaponStatsTable FromThis, WeaponStatsTable ToThis)
        {
            //Clears all stats form [ToThis]
            ToThis.Damage.RemoveAllModifiers();
            ToThis.Range.RemoveAllModifiers();
            ToThis.ClipSize.RemoveAllModifiers();
            ToThis.AmountCount.RemoveAllModifiers();
            ToThis.FireRate.RemoveAllModifiers();
            ToThis.ReloadTime.RemoveAllModifiers();
            ToThis.ImpactForce.RemoveAllModifiers();
            //Sets all base values from [FromThis] to [ToThis]
            ToThis.Damage.baseValue      = FromThis.Damage.baseValue;
            ToThis.Range.baseValue       = FromThis.Range.baseValue;
            ToThis.ClipSize.baseValue    = FromThis.ClipSize.baseValue;
            ToThis.AmountCount.baseValue = FromThis.AmountCount.baseValue;
            ToThis.FireRate.baseValue    = FromThis.FireRate.baseValue;
            ToThis.ReloadTime.baseValue  = FromThis.ReloadTime.baseValue;
            ToThis.ImpactForce.baseValue = FromThis.ImpactForce.baseValue;
            //Adds all ItemStats from [FromThis] to [ToThis] stats
            ToThis.Damage.AddModifier(FromThis.Damage.GetModifierValue());
            ToThis.Range.AddModifier(FromThis.Range.GetModifierValue());
            ToThis.ClipSize.AddModifier(FromThis.ClipSize.GetModifierValue());
            ToThis.AmountCount.AddModifier(FromThis.AmountCount.GetModifierValue());
            ToThis.FireRate.AddModifier(FromThis.FireRate.GetModifierValue());
            ToThis.ReloadTime.AddModifier(FromThis.ReloadTime.GetModifierValue());
            ToThis.ImpactForce.AddModifier(FromThis.ImpactForce.GetModifierValue());
        }
Ejemplo n.º 2
0
 public void SquishAllValuesToBase(WeaponStatsTable ToThis)
 {
     //Turns all Modifier Values into base
     ToThis.Damage.SquishValueToBase();
     ToThis.Range.SquishValueToBase();
     ToThis.ClipSize.SquishValueToBase();
     ToThis.AmountCount.SquishValueToBase();
     ToThis.FireRate.SquishValueToBase();
     ToThis.ReloadTime.SquishValueToBase();
     ToThis.ImpactForce.SquishValueToBase();
 }
Ejemplo n.º 3
0
 public void AddAllModifiersByPercent(WeaponStatsTable FromThis, WeaponStatsTable ToThis, float percent)
 {
     //Adds all ItemStats from [FromThis] to [ToThis] stats by a percent
     ToThis.Damage.AddModifier(FromThis.Damage.GetModifierValue() * percent);
     ToThis.Range.AddModifier(FromThis.Range.GetModifierValue() * percent);
     ToThis.ClipSize.AddModifier(FromThis.ClipSize.GetModifierValue() * percent);
     ToThis.AmountCount.AddModifier(FromThis.AmountCount.GetModifierValue() * percent);
     ToThis.FireRate.AddModifier(FromThis.FireRate.GetModifierValue() * percent);
     ToThis.ReloadTime.AddModifier(FromThis.ReloadTime.GetModifierValue() * percent);
     ToThis.ImpactForce.AddModifier(FromThis.ImpactForce.GetModifierValue() * percent);
 }
Ejemplo n.º 4
0
    public void SpawnItem()
    {
        if (GetCurrentlySelectedTab() == 0 && PlayerManager.instance.GetComponent <PlayerStats>().CheckPoints(OnlineTable.Ammo[CurrentlySelectedItem].Price))
        {
            PlayerManager.instance.GetComponent <PlayerStats>().UsePoints(OnlineTable.Ammo[CurrentlySelectedItem].Price);
            GameObject Item = (GameObject)Instantiate(OnlineTable.Ammo[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop);
            Item.transform.SetParent(GameObject.FindWithTag("Items_Spawn_Here").transform);
            Item.name = OnlineTable.Ammo[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop.name;
            Vector3 tempPos = SpawnPoint.transform.position;
            Item.transform.position = new Vector3(tempPos.x, tempPos.y + 0.50f, tempPos.z);
            if (OnlineTable.Ammo[CurrentlySelectedItem].Item.GetComponent <ItemStats>() && Item.transform.GetChild(0).GetComponent <Gun_Behaviour>())
            {
                OdinTables.WeaponStatsTable FromStats = OnlineTable.Ammo[CurrentlySelectedItem].Item.GetComponent <ItemStats>().itemStats;
                OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats;
                ToStats.SetStats(FromStats, ToStats);
            }

            //Instantiate the Agent so that it will send to the other clients
            Agent tempAgent;
            if (Item.GetComponent <Agent>())
            {
                tempAgent = Item.GetComponent <Agent>();
            }
            else
            {
                Item.gameObject.AddComponent <Agent>();
                tempAgent = Item.GetComponent <Agent>();
            }
            tempAgent.AgentNumber = ID_Table.instance.ItemList[0];
            ID_Table.instance.ItemList.RemoveAt(0);
            tempAgent.RepeatEvery = 10.0f;
            tempAgent.SendInstantiate(Item.transform.position);
        }
        else if (GetCurrentlySelectedTab() == 1 && PlayerManager.instance.GetComponent <PlayerStats>().CheckPoints(OnlineTable.Parts[CurrentlySelectedItem].Price))
        {
            PlayerManager.instance.GetComponent <PlayerStats>().UsePoints(OnlineTable.Parts[CurrentlySelectedItem].Price);
            GameObject Item = (GameObject)Instantiate(OnlineTable.Parts[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop);
            Item.transform.SetParent(GameObject.FindWithTag("Items_Spawn_Here").transform);
            Item.name = OnlineTable.Parts[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop.name;
            Vector3 tempPos = SpawnPoint.transform.position;
            Item.transform.position = new Vector3(tempPos.x, tempPos.y + 0.50f, tempPos.z);
            if (OnlineTable.Parts[CurrentlySelectedItem].Item.GetComponent <ItemStats>() && Item.transform.GetChild(0).GetComponent <Gun_Behaviour>())
            {
                OdinTables.WeaponStatsTable FromStats = OnlineTable.Parts[CurrentlySelectedItem].Item.GetComponent <ItemStats>().itemStats;
                OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats;
                ToStats.SetStats(FromStats, ToStats);
            }

            //Instantiate the Agent so that it will send to the other clients
            Agent tempAgent;
            if (Item.GetComponent <Agent>())
            {
                tempAgent = Item.GetComponent <Agent>();
            }
            else
            {
                Item.gameObject.AddComponent <Agent>();
                tempAgent = Item.GetComponent <Agent>();
            }
            tempAgent.AgentNumber = ID_Table.instance.ItemList[0];
            ID_Table.instance.ItemList.RemoveAt(0);
            tempAgent.RepeatEvery = 10.0f;
            tempAgent.SendInstantiate(Item.transform.position);
        }
        else if (GetCurrentlySelectedTab() == 2 && PlayerManager.instance.GetComponent <PlayerStats>().CheckPoints(OnlineTable.Misc[CurrentlySelectedItem].Price))
        {
            PlayerManager.instance.GetComponent <PlayerStats>().UsePoints(OnlineTable.Misc[CurrentlySelectedItem].Price);
            GameObject Item = (GameObject)Instantiate(OnlineTable.Misc[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop);
            Item.transform.SetParent(GameObject.FindWithTag("Items_Spawn_Here").transform);
            Item.name = OnlineTable.Misc[CurrentlySelectedItem].Item.GetComponent <Drag_Inventory>().ItemOnDrop.name;
            Vector3 tempPos = SpawnPoint.transform.position;
            Item.transform.position = new Vector3(tempPos.x, tempPos.y + 0.50f, tempPos.z);

            if (OnlineTable.Misc[CurrentlySelectedItem].Item.GetComponent <ItemStats>() && Item.transform.GetChild(0).GetComponent <Gun_Behaviour>())
            {
                OdinTables.WeaponStatsTable FromStats = OnlineTable.Misc[CurrentlySelectedItem].Item.GetComponent <ItemStats>().itemStats;
                OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats;
                ToStats.SetStats(FromStats, ToStats);
            }

            //Instantiate the Agent so that it will send to the other clients
            Agent tempAgent;
            if (Item.GetComponent <Agent>())
            {
                tempAgent = Item.GetComponent <Agent>();
            }
            else
            {
                Item.gameObject.AddComponent <Agent>();
                tempAgent = Item.GetComponent <Agent>();
            }
            tempAgent.AgentNumber = ID_Table.instance.ItemList[0];
            ID_Table.instance.ItemList.RemoveAt(0);
            tempAgent.RepeatEvery = 10.0f;
            tempAgent.SendInstantiate(Item.transform.position);
        }
    }
Ejemplo n.º 5
0
    public void SpawnItem(int FromEnemy, List <int> SpawnItem, Transform AtPosition)
    {
        //Go through all the Items that can spawn forn the spawn list
        for (int j = 0; j < SpawnItem.Count; j++)
        {
            //Go through all the Items that the Enemy can spawn
            for (int i = 0; i < Enemies[FromEnemy].Items.Count; i++)
            {
                //If the spawn list item is the same as the one the Enemy can spawn, than spawn it
                if (i == SpawnItem[j])
                {
                    //for (int k = 0; k < Enemies[FromEnemy].Items[i].Amount; k++) {
                    //    GameObject TempItem = Instantiate<GameObject>(Enemies[FromEnemy].Items[i].Item);
                    //    TempItem.name = Enemies[FromEnemy].Items[i].Item.name;
                    //    TempItem.transform.SetParent(GameObject.Find("World").transform.Find("Items").transform);
                    //    TempItem.transform.localPosition = AtPosition.localPosition;
                    //}

                    //Spawn the Item
                    for (int k = 0; k < Enemies[FromEnemy].Items[i].Amount; k++)
                    {
                        GameObject TempItem = (GameObject)Instantiate(Enemies[FromEnemy].Items[i].Item);
                        GameObject Item     = (GameObject)Instantiate(TempItem.GetComponent <Drag_Inventory>().ItemOnDrop);

                        Item.name = TempItem.GetComponent <Drag_Inventory>().ItemOnDrop.name;
                        Item.transform.SetParent(GameObject.Find("World").transform.Find("Items").transform);
                        Item.transform.localPosition = AtPosition.localPosition + new Vector3(0.0f, 0.5f, 0.0f);


                        //Stuff happend and I dont need all of this, but keeping it any-way just in case.
                        if (TempItem.GetComponent <ItemStats>() && Item.transform.GetChild(0).GetComponent <Gun_Behaviour>())
                        {
                            OdinTables.WeaponStatsTable FromStats = TempItem.GetComponent <ItemStats>().itemStats;
                            OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats;
                            ToStats.SetStats(FromStats, ToStats);
                            Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats = ToStats;
                        }
                        else if (TempItem.GetComponent <ItemStats>() && Item.transform.GetChild(0).GetComponent <ItemStats>())
                        {
                            OdinTables.WeaponStatsTable FromStats = TempItem.GetComponent <ItemStats>().itemStats;
                            OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <ItemStats>().itemStats;
                            ToStats.SetStats(FromStats, ToStats);
                            Item.transform.GetChild(0).GetComponent <ItemStats>().itemStats = ToStats;
                        }
                        else if (TempItem.GetComponent <Gun_Behaviour>() && Item.transform.GetChild(0).GetComponent <ItemStats>())
                        {
                            OdinTables.WeaponStatsTable FromStats = TempItem.GetComponent <Gun_Behaviour>().Stats;
                            OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <ItemStats>().itemStats;
                            ToStats.SetStats(FromStats, ToStats);
                            Item.transform.GetChild(0).GetComponent <ItemStats>().itemStats = ToStats;
                        }
                        else if (TempItem.GetComponent <Gun_Behaviour>() && Item.transform.GetChild(0).GetComponent <Gun_Behaviour>())
                        {
                            OdinTables.WeaponStatsTable FromStats = TempItem.GetComponent <Gun_Behaviour>().Stats;
                            OdinTables.WeaponStatsTable ToStats   = Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats;
                            ToStats.SetStats(FromStats, ToStats);
                            Item.transform.GetChild(0).GetComponent <Gun_Behaviour>().Stats = ToStats;
                        }
                        Destroy(TempItem);

                        //Instantiate the Agent so that it will send to the other clients
                        Agent tempAgent;
                        if (Item.GetComponent <Agent>())
                        {
                            tempAgent = Item.GetComponent <Agent>();
                        }
                        else
                        {
                            Item.AddComponent <Agent>();
                            tempAgent = Item.GetComponent <Agent>();
                        }
                        tempAgent.AgentNumber = ID_Table.instance.ItemList[0];
                        ID_Table.instance.ItemList.RemoveAt(0);
                        tempAgent.RepeatEvery = 10.0f;
                        tempAgent.SendInstantiate(Item.transform.position);
                    }
                }
            }
        }
    }