コード例 #1
0
    public override NodeState RunNode(float p_delta)
    {
        Script_IEntity targetEntity = _tree.GetBlackBoardElement <Script_IEntity>(_targetEnemyFlag);

        bool isForwardSwing = _tree.GetBlackBoardElement <bool> (_isForwardSwingFlag);

        if (targetEntity == null || targetEntity.GetGameObject() == null)
        {
            return(NodeState.Failed);
        }

        if (isForwardSwing)
        {
            NodeState success = ForwardSwing(p_delta, _entityToAttack.GetGridLocation(), _entityToAttack, targetEntity);
            if (success == NodeState.Success)
            {
                Script_HealingVisualEffect healingEffect = new Script_HealingVisualEffect(_manager, targetEntity);
                _manager.CreateVisual(healingEffect);
                targetEntity.Heal(_entityToAttack.GetStats()._healPower);
                return(NodeState.Success);
            }
        }
        else if (!isForwardSwing)
        {
            BackSwing(p_delta, _entityToAttack.GetGridLocation(), _entityToAttack, targetEntity);
        }
        return(NodeState.Running);
    }