private void Start() { string[] array = new string[5] { "K_SHOOTER1", "K_SHOOTER2", "K_SHOOTER3", "K_SHOOTER4", "K_SHOOTER5" }; battleChat = GetComponent <BattleChat>(); VerifyAudioSource(); VerifyLocalController(); tools = new ShooterTool[MyInfoManager.Instance.ShooterTools.Length]; for (int i = 0; i < MyInfoManager.Instance.ShooterTools.Length; i++) { tools[i] = null; ConsumableDesc consumableDesc = null; Item itemBySequence = MyInfoManager.Instance.GetItemBySequence(MyInfoManager.Instance.ShooterTools[i]); if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL) { TSpecial tSpecial = (TSpecial)itemBySequence.Template; string func = TItem.FunctionMaskToString(tSpecial.functionMask); consumableDesc = ConsumableManager.Instance.Get(func); if (consumableDesc != null && !consumableDesc.isShooterTool) { consumableDesc = null; } } if (itemBySequence != null && consumableDesc != null) { tools[i] = new ShooterTool(this, consumableDesc, itemBySequence, base.audio, array[i], custom_inputs.Instance.GetKeyCodeName(array[i]), battleChat, localController); } } }
public int AutoHeal() { int result = 0; int[] array = new int[3] { 100, 50, 30 }; ShooterTool[] array2 = new ShooterTool[3]; ShooterTool shooterTool = null; for (int i = 0; i < tools.Length; i++) { if (tools[i] != null) { if (tools[i].Name == "heal" && tools[i].IsEnable()) { array2[0] = tools[i]; } if (tools[i].Name == "heal50" && tools[i].IsEnable()) { array2[1] = tools[i]; } if (tools[i].Name == "heal30" && tools[i].IsEnable()) { array2[2] = tools[i]; } if (tools[i].Name == "auto_heal" && tools[i].IsEnable()) { shooterTool = tools[i]; } } } ShooterTool shooterTool2 = null; int num = 0; while (shooterTool2 == null && num < 3) { if (array2[num] != null) { shooterTool2 = array2[num]; result = array[num]; } num++; } if (shooterTool2 == null || shooterTool == null) { return(0); } shooterTool2.Use(); shooterTool.Use(); return(result); }