Exemplo n.º 1
0
    public void ApplyPassiveHardware(Type newHardware, GameObject subject)
    {
        int       hardwareIndex = -1;
        IHardware hardware      = activeHardware[0];

        // Basically "find hardware of type"
        for (int i = 0; i < activeHardware.Length; i++)
        {
            hardware = activeHardware[i];
            if (hardware != null && hardware.GetType() == newHardware)
            {
                hardwareIndex = i;
                break;
            }
        }
        if (hardwareIndex == -1)
        {
            Debug.LogError("Hardware not found in ApplyPassiveHardware.");
        }

        ApplyPassiveHardwareDelegate passiveHardwareDelegate = passiveHardwareDelegates[hardwareIndex];

        if (passiveHardwareDelegate != null)
        {
            passiveHardwareDelegate(hardware.Type, hardware, subject);
        }
    }
Exemplo n.º 2
0
    void ClearPassiveHardware(int index)
    {
        IHardware equippedHardware = passiveHardware[index];

        passiveHardwareDelegates[index] -= equippedHardware.ApplyPassiveHardware;

        Component hardwareComponent = GetComponent(equippedHardware.GetType());

        Destroy(hardwareComponent);
        passiveHardware[index] = null;
    }
Exemplo n.º 3
0
    void ClearActiveHardware(int index)
    {
        if (index == 0 || index == 1)
        {
            Debug.LogError("Trying to unequip Blink or Parry.");
            return;
        }
        IHardware equippedHardware  = activeHardware[index];
        Component hardwareComponent = GetComponent(equippedHardware.GetType());

        Destroy(hardwareComponent);
        activeHardware[index] = null;
    }