예제 #1
0
    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();
        }
    }
예제 #2
0
    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;
        }
    }
예제 #3
0
    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;
        }
    }
예제 #4
0
 public void SwitchOnIBSprite()
 {
     if (carriedIBSpriteControllers.Length == 0)
     {
         return;
     }
     _currentIBSpriteControllerIndex = 0;
     _currentIBSpriteController      = carriedIBSpriteControllers[0];
     _currentIBSpriteController.OnSwitchOn();
 }