Beispiel #1
0
    /// <summary>
    /// Try and enable the module installed in the provided Hardpoint.
    /// Can return a Partial result if the module exists, but there is not
    /// enough energy or computer resources to enable the module.
    /// </summary>
    public OperationResult EnableModule(Hardpoint hardpoint)
    {
        ModuleResult res = hardpoints.EnableModuleIn(hardpoint);

        switch (res)
        {
        case ModuleResult.Success:
            return(OperationResult.OK());

        case ModuleResult.NoModule:
            return(OperationResult.Fail("No Module to disable"));

        case ModuleResult.AlreadyEnabled:
            return(OperationResult.OK("Module already enabled"));

        case ModuleResult.InsufficientPower:
            return(OperationResult.Partial("Not enough energy to activate Module"));

        case ModuleResult.InsufficientCpu:
            return(OperationResult.Partial("Not enough CPU"));

        default:
            return(OperationResult.Fail("Failed because: " + res.ToString()));
        }
    }
Beispiel #2
0
    public OperationResult InstallModuleIn(Hardpoint hardpoint, GameObject prefab)
    {
        ModuleResult res = hardpoints.CanInstallModuleInto(hardpoint, prefab);

        switch (res)
        {
        case ModuleResult.Success:
            ActorModule module = ActorModule.Instantiate(prefab, hardpoint, gameObject);
            hardpoints.RegisterInstalledModuleIn(hardpoint, module);
            return(OperationResult.OK());

        case ModuleResult.HardpointNotEmpty:
            return(OperationResult.Fail("Selected hardpoint is not empty"));

        case ModuleResult.IncompatibleSocket:
            return(OperationResult.Fail("Module cannot be installed in selected hardpoint"));

        default:
            return(OperationResult.Fail("Failed to install Module: " + res.ToString()));
        }
    }