public void EquipIBSprite(IBSpriteController controller, bool autoSwitch = true) { if (IsIBSpriteFull) { return; } carriedIBSpriteControllers[CarriedIBSpriteCount] = controller; controller.characterMotor = _characterMotor; controller.characterController = this; DetectionSettings detectionSettings = new DetectionSettings(); if (CompareTag(TagManager.ENEMY_TAG)) { detectionSettings.detectsLocalPlayer = true; detectionSettings.detectsEnemy = false; } else { detectionSettings.detectsLocalPlayer = false; detectionSettings.detectsEnemy = true; } controller.DetectionSettings = detectionSettings; if (autoSwitch) { if (IsIBSpriteOn) { _currentIBSpriteController.OnSwitchOff(); } _currentIBSpriteControllerIndex = CarriedIBSpriteCount - 1; _currentIBSpriteController = controller; controller.OnSwitchOn(); } }
public void SwitchPreviousIBSprite() { if (_currentIBSpriteControllerIndex == -1) { return; } int oldIndex = _currentIBSpriteControllerIndex; _currentIBSpriteControllerIndex--; if (_currentIBSpriteControllerIndex < 0) { _currentIBSpriteControllerIndex = CarriedIBSpriteCount - 1; } IBSpriteController controller = carriedIBSpriteControllers[_currentIBSpriteControllerIndex]; if (controller) { _currentIBSpriteController = controller; carriedIBSpriteControllers[oldIndex].OnSwitchOff(); _currentIBSpriteController.OnSwitchOn(); } else { _currentIBSpriteControllerIndex = oldIndex; } }
public void SwitchNextIBSprite() { if (_currentIBSpriteControllerIndex == -1) { return; } int oldIndex = _currentIBSpriteControllerIndex; _currentIBSpriteControllerIndex++; if (_currentIBSpriteControllerIndex == CarriedIBSpriteCount) { _currentIBSpriteControllerIndex = 0; } IBSpriteController controller = carriedIBSpriteControllers[_currentIBSpriteControllerIndex]; if (controller) { _currentIBSpriteController = controller; carriedIBSpriteControllers[oldIndex].OnSwitchOff(); _currentIBSpriteController.OnSwitchOn(); } else { _currentIBSpriteControllerIndex = oldIndex; } }
public void SwitchOnIBSprite() { if (carriedIBSpriteControllers.Length == 0) { return; } _currentIBSpriteControllerIndex = 0; _currentIBSpriteController = carriedIBSpriteControllers[0]; _currentIBSpriteController.OnSwitchOn(); }