Esempio n. 1
0
 void Start()
 {
     EquippedRangedWeapon = GetComponentInChildren<RangedWeapon_Class>();
     EquippedRangedWeapon.TurnOffInteraction();
     StartCoroutine(DetectAllEnemies());
     StartCoroutine(DetectAllLOSEnemies());
     StartCoroutine(DetectBestTarget());
     StartCoroutine(Aim());
     StartCoroutine(ShootAt());
 }
Esempio n. 2
0
    public void SwapWeapon(MasterInventory_Class inventory)
    {
        RangedWeapon_Class WeaponToGive = EquippedRangedWeapon;
        RangedWeapon_Class WeaponToTake = inventory.EquippedRangedWeaponScipt;

        int x = 0;

        foreach (RangedWeapon_Class w in inventory.RangedWeapons)
        {
            if (w != null)
            {
                if (WeaponToGive.weaponName == w.weaponName)
                {
                    x++;
                }
            }
        }

        if (x > 0)
        {
            Debug.Log("hit case 1");
            //Do nothing
            //Make this destroy the weapon we dont want anymore later.
        }

        else
        {
            Debug.Log("hit case 2");


            //give old weapon to the player
            //move to position
            //equip new weapon
            //move to posiiton
            inventory.DropRangedWeapon(WeaponToTake);

            WeaponToGive.MoveToPosition(inventory.RangedWeaponPosition);
            inventory.EquipNewRangedWeapon(WeaponToGive);

            WeaponToTake.gameObject.SetActive(true);

            WeaponToTake.MoveToPosition(GunPosition);
            Debug.Log("Moved Weapon to correct spot");

            EquippedRangedWeapon = WeaponToTake;
            Debug.Log("Replaced old weapon");

            EquippedRangedWeapon.TurnOffInteraction();
        }
    }