Exemple #1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Bullet")
     {
         drop.DropItem(spaceObject.speedMultiplier);
         Destroy(col.gameObject);
         Destroy(gameObject);
     }
 }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Bullet")
        {
            Destroy(col.gameObject);

            hp--;
            SetStatus();

            if (hp <= 0)
            {
                drop.DropItem(spaceObject.speedMultiplier);
                Destroy(gameObject);
            }
        }
    }
Exemple #3
0
    //Test code to test adding items
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invWhite;
            SelectedItem = 0;
            weaponManager.SwapWeapon(ReturnSelectedItem().Title, SelectedItem);
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invRed;

            weaponManager.SetWeaponStats(SelectedItem, ReturnSelectedItem().Damage, ReturnSelectedItem().Range, ReturnSelectedItem().IsAuto, ReturnSelectedItem().RateOfFire);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invWhite;
            SelectedItem = 1;
            weaponManager.SwapWeapon(ReturnSelectedItem().Title, SelectedItem);
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invRed;

            weaponManager.SetWeaponStats(SelectedItem, ReturnSelectedItem().Damage, ReturnSelectedItem().Range, ReturnSelectedItem().IsAuto, ReturnSelectedItem().RateOfFire);
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invWhite;
            SelectedItem = 2;
            weaponManager.SwapWeapon(ReturnSelectedItem().Title, SelectedItem);
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invRed;

            weaponManager.SetWeaponStats(SelectedItem, ReturnSelectedItem().Damage, ReturnSelectedItem().Range, ReturnSelectedItem().IsAuto, ReturnSelectedItem().RateOfFire);
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invWhite;
            SelectedItem = 3;
            weaponManager.SwapWeapon(ReturnSelectedItem().Title, SelectedItem);
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invRed;

            weaponManager.SetWeaponStats(SelectedItem, ReturnSelectedItem().Damage, ReturnSelectedItem().Range, ReturnSelectedItem().IsAuto, ReturnSelectedItem().RateOfFire);
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invWhite;
            SelectedItem = 4;
            weaponManager.SwapWeapon(ReturnSelectedItem().Title, SelectedItem);
            toolbarSlotPanel.transform.GetChild(SelectedItem).GetComponent <Image>().color = invRed;

            weaponManager.SetWeaponStats(SelectedItem, ReturnSelectedItem().Damage, ReturnSelectedItem().Range, ReturnSelectedItem().IsAuto, ReturnSelectedItem().RateOfFire);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            drop.DropItem("augarino");
        }
        if (Input.GetKeyDown(KeyCode.T))
        {
            drop.DropItem("knife");
        }
        if (Input.GetKeyDown(KeyCode.Y))
        {
            drop.DropItem("matteson");
        }
        if (Input.GetKeyDown(KeyCode.U))
        {
            drop.DropItem("stone");
        }
    }