Exemplo n.º 1
0
    public void Reload(object[] o)
    {
        Magazine newMagazine;
        Vector3  pos;

        try {
            newMagazine = (Magazine)o[0];
            pos         = (Vector3)o[1];

            if (loadedMagazine != null)
            {
                loadedMagazine.Drop(new object[] { pos });
            }

            CheckMagazineStorage(newMagazine);

            loadedMagazine = newMagazine;
            loadedMagazine.transform.parent = gameObject.transform;
        }
        catch (InvalidCastException) {
            Debug.LogError("The passed variables into Reload were not cast correctly. Please check the position of elements in the passed object array");
        }
    }